[lug] How do you setup a recursive make?

Tom Tromey tromey at redhat.com
Mon Jul 23 20:28:21 MDT 2001


>>>>> "Brad" == Brad Doctor <bdoctor at ps-ax.com> writes:

Brad> SUBDIRS = lib server client docs
Brad> METHODS = all clean
Brad>    default-recursive:
Brad>          @set fnord $(MAKEFLAGS); amf=$$2; \
Brad>          dot_seen=no; \
Brad>          target=`echo $@ | sed s/-recursive//`; \
Brad>          list='$(SUBDIRS)'; for subdir in $$list; do \
Brad>            echo "Making $$target in $$subdir"; \
Brad>            if test "$$subdir" = "."; then \
Brad>              dot_seen=yes; \
Brad>              local_target="$$target-am"; \
Brad>            else \
Brad>              local_target="$$target"; \
Brad>            fi; \
Brad>            (cd $$subdir && $(MAKE) $(LOC_MAKEFLAGS) $$local_target) \
Brad>             || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; 
Brad> esac; \
Brad>          done; \

This looks a lot like automake code (it has a couple additions, but it
pretty much comes straight from lib/am/subdirs.am).

Please be careful when recommending that people copy it.  It is GPL.

The above chunk might even be big enough for this to matter (it's
unclear; the FSF guideline is that 10 lines of code is enough to
require paperwork, so I'm assuming this works both ways).  And in case
anybody thinks this code is obvious (ha, ha) and not worth its
copyright, there are at least 3 things in there that we learned
through long experience.  We certainly didn't write it this way the
first time.  Or the second.

Tom



More information about the LUG mailing list