mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
The contents of this variable got lost somewhere along the way, don't know when. This led to prerequisites not being checked, most notably from topdir.mk, where the build should bail out if attempting a build modules out of order. It's now filled in every directory by running projects.py, which might be somehwat overkill. Signed-off-by: Jan Lindemann <jan@janware.com>
105 lines
2.7 KiB
Makefile
105 lines
2.7 KiB
Makefile
# generic utility modules
|
|
# (c) 2001 jannet it services
|
|
# contact@jannet.de
|
|
# $Id$
|
|
|
|
ALLOWED_SUBDIR_TARGETS ?= all install clean distclean test link-in
|
|
|
|
reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
|
|
|
|
.NOTPARALLEL:
|
|
.PHONY: $(SUBDIRS_TO_ITERATE) $(ALLOWED_SUBDIR_TARGETS)
|
|
|
|
ifneq ($(FORCE_REBUILD_SUBDIRS),)
|
|
.PHONY: dirs-all.done
|
|
endif
|
|
|
|
include $(MODDIR)/make/defs.mk
|
|
|
|
SUBDIRS ?= $(ORDERED_SUBDIRS) $(filter-out $(ORDERED_SUBDIRS),$(FIND_SUBDIRS))
|
|
#SUBDIRS ?= $(filter-out $(ORDERED_SUBDIRS),$(FIND_SUBDIRS))
|
|
#SUBDIRS ?= $(FIND_SUBDIRS)
|
|
|
|
ifeq ($(SUBDIRS_TO_ITERATE),)
|
|
|
|
$(ALLOWED_SUBDIR_TARGETS):
|
|
|
|
else
|
|
|
|
ifeq ($(MAKECMDGOALS),)
|
|
SUBDIR_TARGETS = all
|
|
else
|
|
SUBDIR_TARGETS = $(filter $(ALLOWED_SUBDIR_TARGETS),$(MAKECMDGOALS))
|
|
endif
|
|
|
|
ifneq ($(DONT_CHECK_PREREQ_DONE),true)
|
|
PREREQ := $(call proj_query,pkg-requires --no-version --no-subpackages --subsections=jw --delimiter=' ' build $(PROJECT))
|
|
PREREQ_DIRS := $(call proj_query,proj-dir $(PREREQ))
|
|
PREREQ_DIRS_DONE := $(addsuffix /dirs-all.done,$(filter-out $(TOPDIR) /opt/%,$(PREREQ_DIRS)))
|
|
endif
|
|
|
|
all: dirs-all.done
|
|
install: dirs-install.done
|
|
clean: dirs.clean
|
|
distclean: dirs.clean dirs.distclean
|
|
|
|
subdirs-%:
|
|
FORCE_REBUILD_SUBDIRS=true make $*
|
|
|
|
local-%:
|
|
FORCE_REBUILD_SUBDIRS=true DONT_CHECK_PREREQ_DONE=true make $*
|
|
|
|
define subdir_rule
|
|
|
|
$(1): dirs-$(1).done
|
|
|
|
endef
|
|
|
|
$(foreach t,$(filter-out all install clean distclean,$(ALLOWED_SUBDIR_TARGETS)),$(eval $(call subdir_rule,$(t))))
|
|
|
|
%/dirs-all.done:
|
|
@echo $@ needs to be rebuilt
|
|
ifneq ($(DONT_CHECK_PREREQ_PROJECTS),true)
|
|
exit 1
|
|
endif
|
|
|
|
# explicit duplication of pattern-rule is needed, otherwise .PHONY: dirs-all.done won't match
|
|
dirs-all.done:
|
|
touch started-dirs-all.done
|
|
set -e; for d in $(SUBDIRS_TO_ITERATE) ; do make -wC $$d $*; done
|
|
ifneq ($(DONT_CHECK_PREREQ_DONE),true)
|
|
touch $@
|
|
endif
|
|
|
|
ifeq ($(filter clean distclean,$(MAKECMDGOALS)),)
|
|
dirs-all.done: $(wildcard $(BUILD_HDRDIR)/*.h) $(wildcard $(BUILD_HDRDIR)/$(HDRDIR_SCOPE_PREFIX)/*.h)
|
|
endif
|
|
|
|
dirs-%.done:
|
|
touch started-dirs-$*.done
|
|
set -e; for d in $(SUBDIRS_TO_ITERATE) ; do make -wC $$d $*; done
|
|
ifneq ($(DONT_CHECK_PREREQ_DONE),true)
|
|
touch $@
|
|
endif
|
|
|
|
ifeq ($(DEVELOPMENT),true)
|
|
|
|
ifeq ($(SUBDIR_TARGETS),all)
|
|
dirs-all.done: $(PREREQ_DIRS_DONE)
|
|
endif
|
|
ifeq ($(SUBDIR_TARGETS),install)
|
|
dirs-all.done: $(PREREQ_DIRS_DONE)
|
|
endif
|
|
|
|
dirs-install.done: dirs-all.done
|
|
endif
|
|
|
|
dirs.clean:
|
|
set -e; for d in $(call reverse,$(SUBDIRS_TO_ITERATE)) ; do make -wC $$d clean; done
|
|
$(RM) -rf $(TEXTCLEAN) $(CLEAN) *.done *~ .*.swp *.tmp core *.rep dirs-*.done
|
|
|
|
dirs.distclean:
|
|
set -e; for d in $(call reverse,$(SUBDIRS_TO_ITERATE)) ; do make -wC $$d distclean; done
|
|
$(RM) -rf $(DISTCLEAN)
|
|
|
|
endif # SUBDIRS_TO_ITERATE
|