2001-07-06 13:12:14 +00:00
|
|
|
# generic utility modules
|
|
|
|
|
# (c) 2001 jannet it services
|
|
|
|
|
# contact@jannet.de
|
|
|
|
|
# $Id$
|
|
|
|
|
|
2013-08-01 13:26:05 +00:00
|
|
|
ALLOWED_SUBDIR_TARGETS ?= all install clean distclean test
|
|
|
|
|
|
2009-05-27 11:56:26 +00:00
|
|
|
.NOTPARALLEL:
|
2013-08-01 13:26:05 +00:00
|
|
|
.PHONY: $(SUBDIRS_TO_ITERATE) $(ALLOWED_SUBDIR_TARGETS)
|
2012-01-30 14:59:21 +00:00
|
|
|
|
|
|
|
|
ifneq ($(FORCE_REBUILD_SUBDIRS),)
|
|
|
|
|
.PHONY: dirs-all.done
|
|
|
|
|
endif
|
2009-05-27 11:56:26 +00:00
|
|
|
|
2001-07-27 22:02:40 +00:00
|
|
|
include $(MODDIR)/make/defs.mk
|
2001-07-06 13:12:14 +00:00
|
|
|
|
2009-06-02 12:46:17 +00:00
|
|
|
SUBDIRS ?= $(FIND_SUBDIRS)
|
|
|
|
|
|
2010-12-04 13:59:24 +00:00
|
|
|
ifeq ($(SUBDIRS_TO_ITERATE),)
|
2010-12-02 21:43:03 +00:00
|
|
|
|
2013-08-01 13:26:05 +00:00
|
|
|
$(ALLOWED_SUBDIR_TARGETS):
|
2010-12-02 21:43:03 +00:00
|
|
|
|
2001-10-29 17:10:45 +00:00
|
|
|
else
|
2010-12-02 21:43:03 +00:00
|
|
|
|
2011-02-20 14:15:22 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),)
|
2011-06-15 08:36:58 +00:00
|
|
|
SUBDIR_TARGETS = all
|
|
|
|
|
else
|
2013-08-01 13:26:05 +00:00
|
|
|
SUBDIR_TARGETS = $(filter $(ALLOWED_SUBDIR_TARGETS),$(MAKECMDGOALS))
|
2011-02-20 14:15:22 +00:00
|
|
|
endif
|
2001-07-06 13:12:14 +00:00
|
|
|
|
2012-09-02 16:06:47 +00:00
|
|
|
ifneq ($(DONT_CHECK_PREREQ_DONE),true)
|
2016-02-03 17:41:30 +00:00
|
|
|
PREREQ += $(call proj_query, prereq build $(PROJECT))
|
|
|
|
|
PREREQ_DIRS = $(foreach p, $(PREREQ), $(call proj_dir, $(p)))
|
|
|
|
|
PREREQ_DIRS_DONE = $(addsuffix /dirs-all.done,$(filter-out $(TOPDIR) /opt/%,$(PREREQ_DIRS)))
|
2012-09-02 16:06:47 +00:00
|
|
|
endif
|
2011-06-15 10:12:37 +00:00
|
|
|
|
|
|
|
|
all: dirs-all.done
|
|
|
|
|
install: dirs-install.done
|
2010-12-02 21:43:03 +00:00
|
|
|
clean: dirs.clean
|
2011-06-15 08:36:58 +00:00
|
|
|
distclean: dirs.clean dirs.distclean
|
|
|
|
|
|
2016-09-21 14:30:07 +00:00
|
|
|
subdirs-%:
|
|
|
|
|
FORCE_REBUILD_SUBDIRS=true make $*
|
|
|
|
|
|
2013-08-01 13:26:05 +00:00
|
|
|
define subdir_rule
|
|
|
|
|
|
|
|
|
|
$(1): dirs-$(1).done
|
|
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
$(foreach t,$(filter-out all install clean distclean,$(ALLOWED_SUBDIR_TARGETS)),$(eval $(call subdir_rule,$(t))))
|
|
|
|
|
|
2011-06-15 12:39:53 +00:00
|
|
|
%/dirs-all.done:
|
2011-06-20 07:47:23 +00:00
|
|
|
@echo $@ needs to be rebuilt
|
2016-03-30 21:40:47 +00:00
|
|
|
ifneq ($(DONT_CHECK_PREREQ_PROJECTS),true)
|
2011-06-15 12:39:53 +00:00
|
|
|
exit 1
|
2016-03-30 21:40:47 +00:00
|
|
|
endif
|
2011-06-15 12:39:53 +00:00
|
|
|
|
2012-01-30 14:59:21 +00:00
|
|
|
# explicit duplication of pattern-rule is needed, otherwise .PHONY: dirs-all.done won't match
|
|
|
|
|
dirs-all.done:
|
2017-05-09 10:19:34 +00:00
|
|
|
touch dirs-started-all.done
|
2012-01-30 14:59:21 +00:00
|
|
|
set -e; for d in $(SUBDIRS) ; do make -wC $$d $*; done
|
2012-09-02 16:06:47 +00:00
|
|
|
ifneq ($(DONT_CHECK_PREREQ_DONE),true)
|
2012-01-30 14:59:21 +00:00
|
|
|
touch $@
|
2012-09-02 16:06:47 +00:00
|
|
|
endif
|
2012-01-30 14:59:21 +00:00
|
|
|
|
2011-06-15 10:12:37 +00:00
|
|
|
dirs-%.done:
|
2017-05-09 10:19:34 +00:00
|
|
|
touch dirs-started-$*.done
|
2011-06-15 10:12:37 +00:00
|
|
|
set -e; for d in $(SUBDIRS) ; do make -wC $$d $*; done
|
2012-09-02 16:06:47 +00:00
|
|
|
ifneq ($(DONT_CHECK_PREREQ_DONE),true)
|
2011-06-15 08:36:58 +00:00
|
|
|
touch $@
|
2012-09-02 16:06:47 +00:00
|
|
|
endif
|
2010-12-02 21:43:03 +00:00
|
|
|
|
2011-06-15 14:55:50 +00:00
|
|
|
ifeq ($(DEVELOPMENT),true)
|
2011-08-09 19:34:12 +00:00
|
|
|
|
|
|
|
|
dirs-all.done: $(wildcard $(BUILD_HDRDIR))
|
|
|
|
|
|
2012-09-02 16:06:47 +00:00
|
|
|
ifeq ($(SUBDIR_TARGETS),all)
|
2011-08-09 19:34:12 +00:00
|
|
|
dirs-all.done: $(PREREQ_DIRS_DONE)
|
|
|
|
|
endif
|
2012-09-02 16:06:47 +00:00
|
|
|
ifeq ($(SUBDIR_TARGETS),install)
|
2011-08-09 19:34:12 +00:00
|
|
|
dirs-all.done: $(PREREQ_DIRS_DONE)
|
|
|
|
|
endif
|
|
|
|
|
|
2011-06-15 10:12:37 +00:00
|
|
|
dirs-install.done: dirs-all.done
|
2011-06-15 14:55:50 +00:00
|
|
|
endif
|
2011-06-15 10:12:37 +00:00
|
|
|
|
2010-12-02 21:43:03 +00:00
|
|
|
dirs.clean:
|
2011-06-20 07:47:23 +00:00
|
|
|
set -e; for d in $(SUBDIRS) ; do make -wC $$d clean; done
|
2017-05-09 10:19:34 +00:00
|
|
|
rm -rf $(TEXTCLEAN) $(CLEAN) *.done *~ .*.swp *.tmp core *.rep dirs-started-*.done
|
2001-07-06 13:12:14 +00:00
|
|
|
|
2010-12-02 21:43:03 +00:00
|
|
|
dirs.distclean:
|
2011-06-20 07:47:23 +00:00
|
|
|
set -e; for d in $(SUBDIRS) ; do make -wC $$d distclean; done
|
2002-07-25 10:39:55 +00:00
|
|
|
rm -rf $(DISTCLEAN)
|
|
|
|
|
|
2011-06-15 08:36:58 +00:00
|
|
|
endif # SUBDIRS_TO_ITERATE
|
2016-02-03 17:41:30 +00:00
|
|
|
|