Make Recursive Dependencies

I think you got that wrong: Recursive Make Considered Harmful explains that you should not call one make from within another, because neither will have the full overview of dependencies. This sooner or later leads to wrong builds which you can only sort out with make clean.

makepp is an alternative that helps you to avoid that pitfall. It also solves your problem with a recursive (nothing to do with above recursion) wildcard:

RESOURCES := **/resource\*.png
resources.h: $(RESOURCES)
    .$/update.py $(inputs)

This even works if the files are not there yet, because makepp's wildcards take into account what could be built according to your rules. Note how it notices the program dependency automatically. The funny $/ will lean either way depending on what system it runs on, so its more portable.

There is much more to makepp. Besides doing almost all that GNU make can, there are lots more useful things, and you can even extend your makefiles with some Perl programming.


I'm not sure what you've read, but there's no problem writing a rule like this in make:

RESOURCES := $(shell find . -name resource\*.png -print)
resources.h: update.py $(RESOURCES)
        ./update.py $(RESOURCES)

or whatever.

Tags:

Makefile