From c7ad27355696282b0b5f17b658e5b8f4d6102aae Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 15 Jun 2011 08:36:58 +0000 Subject: [PATCH] dirs.mk: Now shortcutting already built directories (dirs.done) --- make/dirs.mk | 55 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/make/dirs.mk b/make/dirs.mk index 3f279b92..30871b86 100644 --- a/make/dirs.mk +++ b/make/dirs.mk @@ -11,32 +11,59 @@ SUBDIRS ?= $(FIND_SUBDIRS) ifeq ($(SUBDIRS_TO_ITERATE),) -all: -subdirs: -clean distclean: +all install clean distclean: + +else + +ifeq ($(MAKECMDGOALS),) +SUBDIR_TARGETS = all +else +SUBDIR_TARGETS = $(filter all install clean distclean,$(MAKECMDGOALS)) +endif + +all: dirs.done +subdirs: dirs.done +clean: dirs.clean +distclean: dirs.clean dirs.distclean + .DEFAULT: install: -else .PHONY: $(SUBDIRS_TO_ITERATE) -ifeq ($(MAKECMDGOALS),) -all: - $(make_subdirs) -endif +#ifeq ($(MAKECMDGOALS),) +#all: +# $(make_subdirs) +# touch dirs.done +# +#$(MAKECMDGOALS): +# $(make_subdirs_target) +# touch dirs.done -$(MAKECMDGOALS): - $(make_subdirs_target) -clean: dirs.clean -distclean: dirs.distclean clean +define make_dirs + set -e; for t in $(SUBDIR_TARGETS); do \ + for d in $(SUBDIRS) ; do \ + make -wC $$d $$t ;\ + done ;\ + done +endef + +PREREQ_DIRS_DONE = $(foreach p,$(PREREQ),$($(p)_DIR)/dirs.done) + +dirs.done: $(wildcard $(BUILD_HDRDIR)) $(PREREQ_DIRS_DONE) + $(make_dirs) + touch $@ dirs.clean: + $(make_dirs) rm -rf $(TEXTCLEAN) $(CLEAN) dist *.done *~ .*.swp *.tmp core *.rep dirs.distclean: + $(make_dirs) rm -rf $(DISTCLEAN) .DEFAULT: - $(make_subdirs_target) -endif + $(make_dirs) + +endif # SUBDIRS_TO_ITERATE