Hi there,

I use seperate makefiles for seperate subsystems that compose a larger system. Each subsystem resides in its own subdirectory. I want "make" to recursively call all the makefiles in those directories.

SUBDIRS = foo bar baz
all install:
        for dir in $(SUBDIRS); do \
          $(MAKE) -C $$dir $@; \
        done

The "make" manual discourages to use a shell "for loop" and instead recommends to declare subdirs as phony targets:

http://www.gnu.org/software/make/manual/html_mono/make.html#SEC41

SUBDIRS = foo bar baz
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
        $(MAKE) -C $@
foo: baz

This method is more powerful than the plain "for loop" as you can declare dependencies (here: foo subdirectory cannot be built until after the baz subdirectory has finished).

My problem though:
I fail to see how I can apply this construct to have "make all" and "make install" work recursively. It only works if you call "make subdirs".

How can I take advantage of this construct _and_ propagate a different target (e.g. "all" or "install") to the sub-makefiles?

Cheers
Daniel Kabs
--
Granted, CVS does not handle binary files as well as it handles
mergeable text files.  But even with CVS's handicaps and limitations
WRT binary, CVS is still orders of magnitude better than manually
maintaining versions of files in a directory.(Jim Hyslop on info-cvs)
_______________________________________________
help-gnu-utils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-utils

Reply via email to