diff --git a/conf/topdir/Makefile b/conf/topdir/Makefile new file mode 100644 index 00000000..7f6e10f5 --- /dev/null +++ b/conf/topdir/Makefile @@ -0,0 +1,6 @@ +TOPDIR = ../.. + +CONFIG_SUBDIR = $(notdir $(shell pwd)) + +include $(TOPDIR)/make/proj.mk +include $(JWBDIR)/make/conf.mk diff --git a/make/topdir.mk b/make/topdir.mk index 9830022d..cde44114 100644 --- a/make/topdir.mk +++ b/make/topdir.mk @@ -1,3 +1,6 @@ +# Need second expansion for TD_COPY_XXX concatenation rule to work +.SECONDEXPANSION: + .PHONY: \ FORCE \ all \ @@ -107,10 +110,18 @@ STREAMLINE_PROJECT ?= bash $(JWB_SCRIPT_DIR)/streamline-project.sh INSTALLED_TOPDIR_FILES = $(addprefix $(INSTALL_DOCDIR)/, $(DOCS)) +TD_CONF_DIR ?= $(JW_PKG_CONF_BASE_DIR)/topdir +TD_COPY_SRC ?= $(TD_CONF_DIR) +TD_COPY_FILES ?= $(filter-out Makefile,$(notdir $(wildcard $(TD_COPY_SRC)/*))) +# -- Internal variables, define JW_PKG_TOPDIR_COPY_PATH if you want to +# add more files appended to the target files +TD_COPY_SRC_PATH = $(subst :,$(space),$(JW_PKG_TOPDIR_COPY_PATH)) +TD_GENERATE_FILES += $(TD_COPY_FILES) + all: config format: -check-syntax: -check-format: +check-syntax: topdir +check-format: topdir check: check-syntax check-format install: topdir.install clean: topdir.clean @@ -129,10 +140,13 @@ local-%: FORCE unlocal: $(RM) -f $(shell find . -name local.mk) +topdir: $(TD_GENERATE_FILES) +topdir.clean: + $(RM) -rf *.done $(TD_GENERATE_FILES) +clean: topdir.clean topdir.distclean: topdir.clean $(RM) -rf dist *.dist -topdir.clean: - $(RM) -rf *.done +distclean: topdir.distclean topdir.mrproper: topdir.distclean find . -name '*.rep' | xargs -r $(RM) -f @@ -282,3 +296,9 @@ recache-vars: canonicalize-remotes: $(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py projects canonicalize-remotes + +Makefile: ; + +%: $(TD_COPY_SRC)/% $$(foreach path,$$(TD_COPY_SRC_PATH),$$(wildcard $$(addprefix $$(path)/,$$@))) $$(wildcard $$@.*) + cat $^ > $@.tmp + mv $@.tmp $@