diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-06-29 08:46:48 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-06-29 08:46:48 -0600 |
commit | bd22a9cc04ad031bc3d472d7b9d61306f6247b4f (patch) | |
tree | 6b1c1d20db73ab6013607b737fa937fae584404c | |
parent | 30e4649c2642351870914985be2b4f1e40bcd83f (diff) |
(rvs) `make dist` wasn't working
-rw-r--r-- | common.bottom.mk | 36 | ||||
-rw-r--r-- | 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 $(<D) $(<F) _copyfile = $(MKDIRS) $(dir $2) && $(CP) $1 $2 _addfile = $(call _copyfile,$3,$2/$(call _relto,$1,$3)) -$(topobjdir)/$(PACKAGE)-$(VERSION): $(all_src_files) $(all_dist_files) +$(topobjdir)/$(PACKAGE)-$(VERSION): $(all_src_files) $(dep_src_files) $(all_dist_files) $(dep_dist_files) $(RM) -r $@ $(MKDIR) $(@D)/tmp.$(@F).$$$$ && \ - $(foreach f,$(all_src_files),$(call _addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ - $(foreach f,$(all_dist_files),$(call _addfile,$(topobjdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ + $(foreach f,$(all_src_files) $(dep_src_files) ,$(call _addfile,$(topsrcdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ + $(foreach f,$(all_dist_files) $(dep_dist_files),$(call _addfile,$(topobjdir),$(@D)/tmp.$(@F).$$$$,$f) &&) \ $(MV) $(@D)/tmp.$(@F).$$$$ $@ || $(RM) -r $(@D)/tmp.$(@F).$$$$ include $(topsrcdir)/common.once.mk diff --git a/common.top.mk b/common.top.mk index 931bc84..a83abb6 100644 --- a/common.top.mk +++ b/common.top.mk @@ -29,8 +29,10 @@ endif objdir := $(call _noslash,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) srcdir := $(firstword $(call _relto,., $(topsrcdir)/$(call _relto,$(topobjdir),$(objdir)) ) .) +included_makefiles := $(included_makefiles) $(abspath $(objdir)/Makefile) + ## Set module name -module := $(firstword $(subst /,_,$(if $(call _is_subdir,.,$(objdir)),$(call _relto,.,$(objdir)),dep-$(call _relto,$(topobjdir),$(objdir)))) all) +module := $(subst /,_,$(if $(call _is_subdir,.,$(objdir)),$(firstword $(call _relto,.,$(objdir)) all),dep-$(firstword $(call _relto,$(topobjdir),$(objdir)) top))) ## Empty variables for use by the module subdirs = |