This sounds about right for a recursive make structure. Alternatively, you can go for a non-recursive make (I call it a recursive makefile) structure. See http://aegis.sourceforge.net/auug97.pdf.
In a recursive makefile structure, rather than running make for the subdirectories, each subdirectory will publish how to build its stuff via a makefile that gets included. For example, it may have something like: # contents of d1/GNUbuild.mk build: build-d1 #clean: # don't have to include this since there's nothing to clean in d1 Within the top-level makefile, you'd do something like: -include $(addsuffix /GNUbuild.mk.mk,$(TARGETS)) HTH, Noel "Robert P. J. Day" wrote: > > (sorry about all the traffic my previous posting caused -- i didn't realize i > was disturbing the hornet's nest quite that much. i did eventually figure out > that i was looking at the wrong section in the make manual. and now, > onward.) > > i want to define a standard set of targets for a multi-level directory structure: > build, rebuild, clean, realclean, install, ... etc etc, that sort of thing. these > targets > should be defined at the top-level makefile and, as the make progresses > recursively, at some lower level, unless that target is explicitly handled > somehow by a lower-level makefile, the sub-directory makes should be > invoked for it. i'm just trying to get this nailed exactly, so here's what i have > so far. > > at the top level, i can define > > TARGETS = build rebuild clean realclean install check ... > .PHONY: TARGETS > > SUBDIRS = d1 d2 d3 d4 d5 > > $(TARGETS): > for d in $(SUBDIRS) ; do # ignore possible syntax errors for now > $(MAKE) -C $d $@ > done > > so that, obviously, regardless of the target used for the top-level make, this > will recursively invoke all subdirectories with the same target. > > now, at any level where that target can actually be handled, i can do the > following (as i read it): > > TARGETS := $(TARGETS:clean=) # just as an example > SUBDIRS = ... subdirectories at *this* level > > clean: > .... whatever it actually takes to clean at this level ... > > $(TARGETS): > for d in $(SUBDIRS) ... # recursively deal with remaining targets > > and, finally, if a subdirectory has *nothing* to do for a given target, what's > the best thing to do? i see a couple of options: > > clean; > @echo Nothing to do for clean here. > > or > > clean: ; > > this should let me have a fairly modular structure so that all top-level > targets will either be processed at some level or recursively passed to the > subdirectories. > > is this about right? sorry for the newbie-level questions, i'm still poring > over the manual. > > rday > > _______________________________________________ > Help-make mailing list > [EMAIL PROTECTED] > http://mail.gnu.org/mailman/listinfo/help-make -- NOTICE: If received in error, please destroy and notify sender. Sender does not waive confidentiality or privilege, and use is prohibited. _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
