help-make
[Top][All Lists]
Advanced

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

RE: Makefiles in Nested Directories


From: Mark Galeck (CW)
Subject: RE: Makefiles in Nested Directories
Date: Wed, 9 Mar 2011 10:07:02 -0800

>1) Should I keep a Makefile in every directory and subdirectory? What should 
>the top level directory contain? and What should the subdirectories contain?

>2) OR there should only be makefiles at top level?

I had the same problem and went through a thorough design phase with good 
feedback from users.  

Each library or program (or some other software module) has its own "build 
directory", with one makefile, in which (or its subdirectories), the results of 
the build and any temporary or intermediate files are kept.  If you go to that 
directory and do >make, that module gets built (but there may be other modules 
on which this depends, that have their own directories, that have to be built 
as well, using recursive $(MAKE) -C ...  )

There may be special goals, which typically build only part of the module (like 
>make foobar.o)

Build directories cannot be subdirectories of one another. 

Any directory above a build directory, also has a makefile, but that makefile 
does not build anything in that directory. Instead, it is a multiple-module 
build:  it has a list of build subdirectories that it supports (and a list of 
goals supported).  If you do >make there, with the default or special goal, 
that gets built in all the supported subdirectories.  

Mark




reply via email to

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