# Makefile for a directory with several sub-directories # Last edited on 2023-04-28 18:35:53 by stolfi ###################################################################### # To be included by the top-level Makefile in the program's directory. # The caller must define # # ${STOLFIHOME} directory with stolfi's bin, lib, include, etc. # ${IGNOREDIRS} a list of sub-dirs of current dir where "make" should NOT be run # # "make XXX" will perform "make XXX" on each of the ${MK_SUBDIRS}, in order. include ${STOLFIHOME}/programs/GENERIC.make # ---------------------------------------------------------------------- # "make actions" performs all of the ${ACTIONS} in each subdir, in turn: ALLDIRS := ${shell find ./* -maxdepth 0 -type d -print | sort | sed -e 's:^[.][/]::g' } MK_SUBDIRS := ${filter-out JUNK SAVE LATER ${IGNOREDIRS},${ALLDIRS}} actions: @echo "ACTIONS = ${ACTIONS}" @echo "IGNOREDIRS = ${IGNOREDIRS}" @echo "MK_SUBDIRS = ${MK_SUBDIRS}" for dir in ${MK_SUBDIRS}; do \ ( echo '#-- GENERIC-ROOT-DIR.make : start ${ACTIONS} in $$dir --#'; \ echo "$$dir"; \ cd $$dir/. && \ make ACTIONS="${ACTIONS}" actions ; \ echo '#-- GENERIC-ROOT-DIR.make : end ${ACTIONS} in $$dir --#' ; \ ) ; \ done # ---------------------------------------------------------------------- # "make all" # "make clean" # "make uninstall" # "make install" # "make build-libs" # "make build-progs" # "make build-tests" # "make build" # "make check" # "make depend" # "make tar-export" # These actions are just performed on all sub-directories in the # list ${MK_SUBDIRS}, in order. all: ${MAKE} ACTIONS="all" actions build-libs: ${MAKE} ACTIONS="build-libs" actions build-progs: ${MAKE} ACTIONS="build-progs" actions build-tests: ${MAKE} ACTIONS="build-tests" actions build: ${MAKE} ACTIONS="build" actions uninstall: ${MAKE} ACTIONS="uninstall" actions install: ${MAKE} ACTIONS="install" actions check: ${MAKE} ACTIONS="check" actions clean: ${MAKE} ACTIONS="clean" actions depend: ${MAKE} ACTIONS="depend" actions #--------------------------------------------------------------------- # "make debug" prints some debugging info: debug: @echo "MK_SUBDIRS = ${MK_SUBDIRS}" @echo "ACTIONS = ${ACTIONS}"