From bd22a9cc04ad031bc3d472d7b9d61306f6247b4f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 29 Jun 2015 08:46:48 -0600 Subject: (rvs) `make dist` wasn't working --- common.bottom.mk | 36 +++++++++++++++++++++++++----------- common.top.mk | 4 +++- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/common.bottom.mk b/common.bottom.mk index 0e2c039..016e093 100644 --- a/common.bottom.mk +++ b/common.bottom.mk @@ -39,9 +39,6 @@ $(parent)_clean_files := $($(parent)_clean_files) $($(module)_clean_files) $(parent)_slow_files := $($(parent)_slow_files) $($(module)_slow_files) $(parent)_conf_files := $($(parent)_conf_files) $($(module)_conf_files) $(parent)_dist_files := $($(parent)_dist_files) $($(module)_dist_files) -$(info added <$(module)> to <$(parent)>) -$(info $(parent)_clean_files => $($(parent)_clean_files)) -$(info $(parent)_obj_files => $($(parent)_obj_files)) endif modules := $(modules) $(module) @@ -53,19 +50,36 @@ define _nl endef +define _include_makefile +ifeq ($(filter $(abspath $1),$(included_makefiles)),) +include $(if $(call _is_subdir,.,$1),$(call _relto,.,$1),$(topobjdir)/$(call _relto,$(topobjdir),$1)) +endif +endef $(eval \ _COMMON_MK_NOONCE = n$(_nl)\ - $(foreach dir,$(subdirs),parent=$(module)$(_nl)include $(objdir)/$(dir)/Makefile$(_nl)) \ - $(foreach dir,$(depdirs),parent=dep $(_nl)include $(objdir)/$(dir)/Makefile$(_nl)) \ + $(foreach dir,$(subdirs),parent=$(module)$(_nl)$(call _include_makefile,$(objdir)/$(dir)/Makefile)$(_nl))\ + parent=dep$(_nl)\ + $(call _include_makefile,$(topobjdir)/$(dir)/Makefile)$(_nl)\ _COMMON_MK_NOONCE = $(_COMMON_MK_NOONCE)) -# This only gets evaluated once, after all of the other Makefiles a read +# This only gets evaluated once, after all of the other Makefiles are read ifeq ($(_COMMON_MK_NOONCE),) - -.phony = build install uninstall mostlyclean clean distclean maintainer-clean check +# Empty module-level variables +objdir = /bogus +srcdir = /bogus +subdirs = +depdirs = +src_files = +obj_files = +sys_files = +clean_files = +slow_files = +conf_files = +dist_files = # Declare phony targets +.phony = build install uninstall mostlyclean clean distclean maintainer-clean check define module_rules .PHONY: $(addsuffix -%(module),$(.phony)) # Constructive phony targets @@ -93,11 +107,11 @@ $(topobjdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topobjdir)/$(PACKAGE)-$(VERSION) $(TAR) czf $@ -C $(