LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2005, 01:08 PM   #1
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Rep: Reputation: 15
Make files


I have recently pushed all my files into sub directories. I wish to be able keep them there in an organised fashion. However I am having trouble getting a makefile to do this job, currently I have in each subdirectory the header file and .cpp file associated with that unit of functionality.

I have this type of arrangement here:

all: Sim

Sim: .Energy.o Sorts.o FileHandling.o MyMatrix.o BeadBead.o Cell.o Display.o Initialize.o Translation.o Clash.o MyRandom.o MC.o

g++ -o Sim Energy.o Sorts.o FileHandling.o MyMatrix.o BeadBead.o Cell.o Display.o Initialize.o Translation.o Clash.o MyRandom.o MC.o


Energy.o: Energy.cpp

g++ -c -Wno-deprecated Energy.cpp


I have tried the usual ../Energy/kjhkdh.cpp but this does not seem to work. How can I do this easily and simply. I dont mind where the object files end up, but would like the executable in the main directory.

Thanks
 
Old 12-01-2005, 02:06 PM   #2
gruby12
LQ Newbie
 
Registered: Aug 2005
Location: Poland
Distribution: SUSE 10.1, Mandriva 2008.1
Posts: 26

Rep: Reputation: 15
Maybe try to use -o option of g++.

Regards Janusz
 
Old 12-02-2005, 02:52 AM   #3
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Original Poster
Rep: Reputation: 15
what do you do you have an example?
 
Old 12-02-2005, 02:59 PM   #4
gruby12
LQ Newbie
 
Registered: Aug 2005
Location: Poland
Distribution: SUSE 10.1, Mandriva 2008.1
Posts: 26

Rep: Reputation: 15
-o option gives name and location of executable file.

Janusz
 
Old 12-02-2005, 03:02 PM   #5
disruptive
Member
 
Registered: Dec 2005
Posts: 76

Original Poster
Rep: Reputation: 15
i am not sure what you mean?
 
Old 12-02-2005, 09:33 PM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Just remember that everything is relative to the current execution path of the makefile. If you have a dependency that is not in the same path, you need to specify the path in the dependency list. Maybe you need this?
Code:
Sim: Energy/Energy.o #...
        g++ -o Sim Energy/Energy.o #...

#...

Energy/Energy.o: Energy/Energy.cpp
        g++ -c -Wno-deprecated Energy/Energy.cpp -o Energy/Energy.o
ta0kira
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't make files in directorys Rangerjim Linux - Newbie 2 08-03-2004 03:28 PM
Want to make HTML help files IgD Linux - Software 5 09-18-2003 07:47 AM
How can Make sure I have all the files needed ikw38 Linux - Newbie 6 12-18-2002 12:03 AM
Make files rao Programming 3 07-18-2002 01:20 PM
make files Darkstone Linux - Newbie 5 07-14-2001 07:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration