# Makefile for a directory with several sub-directories # Last edited on 2016-12-26 21:40:56 by stolfilocal ###################################################################### # To be included by the top-level Makefile in the program's directory. # The caller must define # # ${SUBDIRS} a list of sub-dirs of current dir where "make" needs to run # # "make XXX" will perform "make XXX" on each of the ${SUBDIRS}, in order. include GENERIC.make # ---------------------------------------------------------------------- # "make actions" performs all of the ${ACTIONS} in each subdir, in turn: actions: for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make ACTIONS="${ACTIONS}" actions ; \ ) ; \ done # ---------------------------------------------------------------------- # "make all" # "make clean" # "make build-libs" # "make build-progs" # "make build-tests" # "make build" # "make check" # "make depend" # These actions are just performed on all sub-directories in the # client-defined list ${SUBDIRS}, in order. all: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make all ; \ ) ; \ done build-libs: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make build-libs ; \ ) ; \ done build-progs: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make build-progs ; \ ) ; \ done build-tests: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make build-tests ; \ ) ; \ done build: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make build ; \ ) ; \ done check: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make check ; \ ) ; \ done clean: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make clean ; \ ) ; \ done depend: @for dir in ${SUBDIRS}; do \ ( echo '= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ='; \ echo "$$dir"; \ cd $$dir/. && \ make depend ; \ ) ; \ done #--------------------------------------------------------------------- # "make debug" prints some debugging info: debug: @echo "SUBDIRS = ${SUBDIRS}" @echo "ACTIONS = ${ACTIONS}"