[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recursive Make Considered Harmful
From: |
gk |
Subject: |
Re: Recursive Make Considered Harmful |
Date: |
Fri, 25 Oct 2002 14:18:02 -0700 |
At 02:21 PM 10/24/2002 -0700, gk wrote:
I see no value for sub-make except in the case where a system already uses
it and you don't want to bother changing things because they aren't broken
(yet).
I have changed my opinion. I think there is a very clear divide between
when recursion is helpful and harmful. See if you agree.
* calling $(MAKE) serially, in a for loop, is generally bad because you
can't take advantage of concurrent jobs (see discussion on phony targets in
the Gnu make manual).
* primary advantage of recursive make is concurrent jobs;
secondary advantage: make won't exit if errors encountered in one
branch
* primary disadvantage of recursive make is that prerequisites may be
missing or the build order might be wrong
secondary disadvantage: higher maintenance costs
THERFORE: any target THAT WILL NEVER HAVE PREREQUISITES (phony targets
especially) can use recursion without risk!
For example, 'clean' is an ideal candidate for recursion.
I am working on this strategy:
* PROJECT_MAKEFILE
- the TOP level, controlling makefile: includes all pattern rules and other
global stuff
- this is always the active makefile invoked when calling make from any
directory:
make -f $PROJECT_MAKEFILE <options> <targets>
- includes the DIRECTORY_MAKEFILE in the top project directory
- includes COMMON_INCLUDED_MAKEFILE in the top project directory
* COMMON_INCLUDED_MAKEFILE
- contains ONLY targets like 'clean' with NO PREREQUISITES
- included by every DIRECTORY_MAKEFILE
- wrapped in ifndef __COMMON_INCLUDED_MAKEFILE ... to avoid infinite
include loop
* DIRECTORY_MAKEFILE
- auto-generated; one per directory
- includes COMMON_INCLUDED_MAKEFILE
- includes every DIRECTORY_MAKEFILE (auto-generated) in immediate
subdirectories (only one-level deep)
- includes every DEPENDENCY_MAKEFILE in the directory
* DEPENDENCY_MAKEFILE
- auto-generated; one per source file
- defines prerequisites of all targets that related to a given source file
- Greg Keraunen <address@hidden>
- Re: executing a rule prior to any targets?, (continued)
- Re: executing a rule prior to any targets?, gk, 2002/10/20
- Re: executing a rule prior to any targets?, Philip Guenther, 2002/10/20
- Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), gk, 2002/10/20
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), Philip Guenther, 2002/10/20
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), gk, 2002/10/23
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), Philip Guenther, 2002/10/24
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), gk, 2002/10/24
- Re: Recursive Make Considered Harmful (was: Re: executing arule prior to any targets?), Johan Bezem, 2002/10/24
- Re: Recursive Make Considered Harmful [Long Post], Johan Bezem, 2002/10/22
- Re: Recursive Make Considered Harmful [Long Post], gk, 2002/10/24
- Re: Recursive Make Considered Harmful,
gk <=
- Re: executing a rule prior to any targets?, Paul D. Smith, 2002/10/20
- Re: executing a rule prior to any targets?, Paul D. Smith, 2002/10/20
- recursive make example (was: Re: executing a rule prior to any targets?), gk, 2002/10/23
- Re: recursive make example (was: Re: executing a rule prior to any targets?), Paul D. Smith, 2002/10/23