help-make
[Top][All Lists]
Advanced

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

make across multiple directories


From: desertweather
Subject: make across multiple directories
Date: Tue, 15 Jun 2004 00:21:19 -0700 (PDT)

Hi,

I'm searching for an elegant way to write a Makefile
for compiling a simple C++ application whose source
files span multiple directories.  I know this must be
a common problem, but I can't seem to find any
satisfactory examples or explanations of solutions on
Google or the gnu.utils.help newsgroup.  The general
problem I have in mind can be summed up as follows:

/module1/ -- contains .h .cpp files for module1 and
(after make is run) the .o files
/module2/ -- same as above but for module2
/module2/subModuleA -- same thing, but accounting for
nesting deeper than 1 level
....
etc

The final executable should be placed in the root
directory.

Ideally, the Makefile will:

1. Be simple and clean, using Automatic Variables
whenever possible.

2. Be robust to changes in the directory structure.
For example, if file A.cpp moves from module1 to
module2 for some reason, only one or two lines in the
Makefile should change.  I imagine info about the
directory structure would be set at the top of the
file using variables somehow, and the guts of the
Makefile would depend only on those variables.

Can anyone send a simple example of such a solution,
or point me to a good reference?

Thanks for any help,
John


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

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