(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