On Fri, 2009-04-10 at 07:36 +0200, Sam Ravnborg wrote:
> I just tried it myself.
> It works for me with the following Makefile:
>
> =====
> SUBDIRS = foo bar baz
> subdirs: $(SUBDIRS)
>
> .PHONY: $(SUBDIRS)
> $(SUBDIRS):
> $(MAKE) -C $@
>
> =====
> Try to use that pattern and it should work for you too.
So this is a common pattern, but we all know that it leads to a lot of
extra invocations of make and extra output when, most of the time,
nothing needs to be done.
I'm wondering if it's sensible to do something along these lines, which
I haven't tried and may require a .SECONDEXPANSION:
$(SUBDIRS): %: $(find % -type f)
$(MAKE) -C $@
Is this crazy? It would probably be bad on NFS due to an large number of
stats, but on a local filesystem it seems like it would be a win.
Also, for doing a recursive clean, I've found the following pattern
helpful. Is this the best way to approach it?
SUBDIRS = foo bar baz
CLEAN_SUBDIRS = $(SUBDIRS:%=clean.%)
all: $(SUBDIRS)
$(SUBDIRS):
make -c $@
clean:
# clean up this directory
veryclean: clean $(CLEAN_SUBDIRS)
$(CLEAN_SUBDIRS): clean.%:
make -C $* clean
.PHONY: $(SUBDIRS) $(CLEAN_SUBDIRS)
> Sam
--
Michael R. Head <[email protected]>
suppressingfire.org
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make