dirs.mk: Now shortcutting already built directories (dirs.done)

This commit is contained in:
Jan Lindemann 2011-06-15 08:36:58 +00:00 committed by Jan Lindemann
commit c7ad273556

View file

@ -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