help-make
[Top][All Lists]
Advanced

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

Re: Makefiles in Nested Directories


From: David Boyce
Subject: Re: Makefiles in Nested Directories
Date: Wed, 9 Mar 2011 08:33:28 -0500

On Wed, Mar 9, 2011 at 4:55 AM, Ajay Jain <address@hidden> wrote:
> HI,
>
> I need a design suggestion. I am starting to write a build system
> using make. My project is quite exhaustive. There are directories,
> sub-directories and so on. What should be the structure of my
> makefiles?
>
> 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?

There are many different approaches and philosophies. However, make
was designed with the assumption that there would be a local
./Makefile and most developers expect/prefer that to be the case, so
I'd lean toward #1.

I maintain a toy build model at
https://github.com/boyski/RMCH-Sample#readme. It builds a couple of
HelloWorld-level programs and exists only to demonstrate my ideas
about best practices. You're welcome to look at it. It _should_ work
out of the box on any Unixy platform with gcc and GNU make 3.82 - run
"make help" for details. This is an evolving thing, in fact I'm
enhancing it at the moment.

-David Boyce



reply via email to

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