help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to: organize application files and get GNU make to put the output fi


From: Ted Byers
Subject: How to: organize application files and get GNU make to put the output files into the right place.
Date: Thu, 21 Jan 2010 17:16:10 -0500

I managed to get GNU make to find the source files and headers from the right paths, but I am having trouble to get it to put gcc's output into the right place.

I made the following directory structure:

app1
app1/include
app1/src
app1/objs
app1/test
app2
app2/include
app2/src
app2/objs
app2/test
lib/src
lib/include
lib/test

If I go into a given objs subdirectory, I can get the object files put into it.  So far, so good.
I could not get the same result from a given application's directory

app1 and app2 both use/ depend on, my library lib.

I was hoping it was possible to run make from an application's directory and put the main executable there.  And I wanted it to have each source file in each test directory be compiled to an executable in the same directory.  I am not sure I can automate inference of what cpp files in src a given  exe file in test would depend on (is there a way?).  But I want to prevent the production of the application exe or the library, if any of the tests fail.

Can I do this entirely from a single makefile in each application's directory, or do I have to put a makefile into the lib and each objs and test directory and somehow have the makefile in each application's directory invoke make on the makefiles in the corresponding objs and test subdirectories?  If so, how?  If this is in the manual, I seem to have somehow missed it.

Thanks for any help you can provide.

Ted

reply via email to

[Prev in Thread] Current Thread [Next in Thread]