From 42f72fea1078ddb379dd4e6df80a98e1072ba726 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 27 May 2016 21:09:58 -0400 Subject: move everything into build-aux --- build-aux/Makefile.tail.mk | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 build-aux/Makefile.tail.mk (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk new file mode 100644 index 0000000..472d2db --- /dev/null +++ b/build-aux/Makefile.tail.mk @@ -0,0 +1,52 @@ +# Copyright (C) 2015-2016 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +# This bit gets evaluated for each Makefile processed + +include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk) + +# Make the namespaced versions of all of the dirlocal variables +$(foreach v,$($(_am)dirlocal),$(eval $v/$(outdir) = $($v))) + +# Remember that this is a directory that we've visited +_am_outdirs := $(_am_outdirs) $(outdir) + +# Generic phony target declarations: +# mark them phony +.PHONY: $(addprefix $(outdir)/,$($(_am)phony)) +# have them depend on subdirs +$(foreach t,$($(_am)phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) + +# Include Makefiles from other directories + +define _am_nl + + +endef +$(foreach _am_NO_ONCE,y,\ + $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$($(_am)subdirs) $($(_am)depdirs))),\ + $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) + +# This bit only gets evaluated once, after all of the other Makefiles are read +ifeq ($(_am_NO_ONCE),) + +outdir = /bogus +srcdir = /bogus + +$(foreach v,$($(_am)dirlocal),$(eval $v=)) + +include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk) + +endif # _am_NO_ONCE -- cgit v1.2.3 From feadb8948e04996a4d024896dc50c82e62ceac56 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 29 May 2016 16:05:16 -0400 Subject: work on things --- build-aux/Makefile.tail.mk | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index 472d2db..bb197dc 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -18,35 +18,30 @@ include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk) # Make the namespaced versions of all of the dirlocal variables -$(foreach v,$($(_am)dirlocal),$(eval $v/$(outdir) = $($v))) +$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) = $($v))) # Remember that this is a directory that we've visited -_am_outdirs := $(_am_outdirs) $(outdir) +_at.outdirs := $(_at.outdirs) $(outdir) # Generic phony target declarations: # mark them phony -.PHONY: $(addprefix $(outdir)/,$($(_am)phony)) +.PHONY: $(addprefix $(outdir)/,$(at.phony)) # have them depend on subdirs -$(foreach t,$($(_am)phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) +$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) # Include Makefiles from other directories - -define _am_nl - - -endef -$(foreach _am_NO_ONCE,y,\ - $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$($(_am)subdirs) $($(_am)depdirs))),\ - $(eval include $(filter-out $(_am_included_makefiles),$(makefile))))) +$(foreach _at.NO_ONCE,y,\ + $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$(at.subdirs) $(at.depdirs))),\ + $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_am_NO_ONCE),) +ifeq ($(_at.NO_ONCE),) outdir = /bogus srcdir = /bogus -$(foreach v,$($(_am)dirlocal),$(eval $v=)) +$(foreach v,$(at.dirlocal),$(eval $v=)) include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk) -endif # _am_NO_ONCE +endif # _at.NO_ONCE -- cgit v1.2.3 From b910b85b2d7d732ccfeaf69ab7ec79140a4a7802 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 30 May 2016 23:58:38 -0400 Subject: fix - Make at.relto public, as mod-dist needs it - Include the correct files in .head.mk - Sort the head includes forwards - Sort the tail includes backwards - Correctly prefix at.{sub,dep}dirs with $(outdir) - Undefine variables after they have been namespaced. - Don't try to access at.{sub,dep}dirs after they have been undefined --- build-aux/Makefile.tail.mk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index bb197dc..f7d42b9 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -15,10 +15,14 @@ # This bit gets evaluated for each Makefile processed -include $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk) +include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -# Make the namespaced versions of all of the dirlocal variables -$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) = $($v))) +at.subdirs := $(addprefix $(outdir)/,$(at.subdirs)) +at.depdirs := $(addprefix $(outdir)/,$(at.depdirs)) + +# Move all of the dirlocal variables to their namespaced version +$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) +$(foreach v,$(at.dirlocal),$(eval undefine $v)) # Remember that this is a directory that we've visited _at.outdirs := $(_at.outdirs) $(outdir) @@ -27,11 +31,11 @@ _at.outdirs := $(_at.outdirs) $(outdir) # mark them phony .PHONY: $(addprefix $(outdir)/,$(at.phony)) # have them depend on subdirs -$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(subdirs)))) +$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outdir))))) # Include Makefiles from other directories $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call am_path,$(addsuffix /Makefile,$(at.subdirs) $(at.depdirs))),\ + $(foreach makefile,$(call at.path,$(addsuffix /Makefile,$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read @@ -42,6 +46,6 @@ srcdir = /bogus $(foreach v,$(at.dirlocal),$(eval $v=)) -include $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk) +include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk))) endif # _at.NO_ONCE -- cgit v1.2.3 From 00eedbd6178cd92409be08d62b395f92680858ef Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 31 May 2016 00:54:10 -0400 Subject: avoid prefixing things with ./ --- build-aux/Makefile.tail.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index f7d42b9..dfbad5a 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,8 +17,8 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -at.subdirs := $(addprefix $(outdir)/,$(at.subdirs)) -at.depdirs := $(addprefix $(outdir)/,$(at.depdirs)) +at.subdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.subdirs))) +at.depdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.depdirs))) # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) -- cgit v1.2.3 From b8dd4cd68e0d3b09a53b602306e587cbfd4ecedf Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 4 Jun 2016 17:06:17 -0400 Subject: (systemd) stuff --- build-aux/Makefile.tail.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index dfbad5a..b1c5045 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -18,7 +18,7 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) at.subdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.subdirs))) -at.depdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.depdirs))) +at.depdirs := $(at.depdirs) # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) -- cgit v1.2.3 From f602c8fe063392e9f38390c6eb0816bef85063ac Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 11:12:23 -0400 Subject: (systemd) add at.addprefix, a safe root-aware addprefix for directories --- build-aux/Makefile.tail.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index b1c5045..be3a8c2 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,8 +17,8 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -at.subdirs := $(patsubst ./%,%,$(addprefix $(outdir)/,$(at.subdirs))) -at.depdirs := $(at.depdirs) +at.subdirs := $(call at.addprefix,$(outdir)/,$(at.subdirs)) +at.depdirs := $(call at.addprefix,$(outdir)/,$(at.depdirs)) # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) @@ -35,7 +35,7 @@ $(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outd # Include Makefiles from other directories $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call at.path,$(addsuffix /Makefile,$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ + $(foreach makefile,$(call at.path,$(addsuffix /$(at.Makefile),$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read -- cgit v1.2.3 From edaf4f48d0844a6d606debbb478c39ba8ba02b7e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 12:25:04 -0400 Subject: (systemd) fixity --- build-aux/Makefile.tail.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index be3a8c2..38f40c2 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,13 +17,14 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -at.subdirs := $(call at.addprefix,$(outdir)/,$(at.subdirs)) -at.depdirs := $(call at.addprefix,$(outdir)/,$(at.depdirs)) - # Move all of the dirlocal variables to their namespaced version $(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) $(foreach v,$(at.dirlocal),$(eval undefine $v)) +# Adjust subdirs and depdirs to be relative to $(outdir) +at.subdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.subdirs/$(outdir))))) +at.depdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.depdirs/$(outdir))))) + # Remember that this is a directory that we've visited _at.outdirs := $(_at.outdirs) $(outdir) -- cgit v1.2.3 From 7c52645f1dcf5274d05990a25024d652934737cd Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Jun 2016 14:40:34 -0400 Subject: (systemd) fix --- build-aux/Makefile.tail.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index 38f40c2..a8b3d89 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -40,7 +40,7 @@ $(foreach _at.NO_ONCE,y,\ $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) # This bit only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_at.NO_ONCE),) +ifeq ($(origin _at.NO_ONCE),undefined) outdir = /bogus srcdir = /bogus -- cgit v1.2.3 From 8a5ecbb4fcaf0d9864074666a45d9263b73f31b8 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 7 Aug 2016 21:03:44 -0400 Subject: (systemd) stuff --- build-aux/Makefile.tail.mk | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index a8b3d89..136e483 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -17,36 +17,26 @@ include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk))) -# Move all of the dirlocal variables to their namespaced version -$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v))) -$(foreach v,$(at.dirlocal),$(eval undefine $v)) - -# Adjust subdirs and depdirs to be relative to $(outdir) -at.subdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.subdirs/$(outdir))))) -at.depdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.depdirs/$(outdir))))) - -# Remember that this is a directory that we've visited -_at.outdirs := $(_at.outdirs) $(outdir) - -# Generic phony target declarations: -# mark them phony -.PHONY: $(addprefix $(outdir)/,$(at.phony)) -# have them depend on subdirs -$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outdir))))) - -# Include Makefiles from other directories +_at.tmp_targets := $(at.targets) +_at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) + +# Clean the environment +$(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)), \ + $(foreach _at.tmp_target,$(_at.tmp_targets), \ + $(if $(filter recursive,$(flavor $(_at.tmp_variable))), \ + $(eval $(_at.tmp_target): private $(_at.tmp_variable) = $(subst $(at.nl),$$(at.nl),$(value $(_at.tmp_variable)))), \ + $(eval $(_at.tmp_target): private $(_at.tmp_variable) := $$($(_at.tmp_variable))))) \ + $(eval undefine $(_at.tmp_variable))) + +# Recurse $(foreach _at.NO_ONCE,y,\ - $(foreach makefile,$(call at.path,$(addsuffix /$(at.Makefile),$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\ - $(eval include $(filter-out $(_at.included_makefiles),$(makefile))))) + $(foreach _at.tmp,$(call at.path,$(addsuffix /$(at.Makefile),$(_at.tmp_subdirs))),\ + $(if $(filter-out $(_at.MAKEFILE_LIST),$(abspath $(_at.tmp))),\ + $(eval include $(_at.tmp))))) # This bit only gets evaluated once, after all of the other Makefiles are read ifeq ($(origin _at.NO_ONCE),undefined) -outdir = /bogus -srcdir = /bogus - -$(foreach v,$(at.dirlocal),$(eval $v=)) - include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk))) endif # _at.NO_ONCE -- cgit v1.2.3 From bf8f76973a833659ce4ac730c4918c382192d3e0 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 8 Aug 2016 01:09:59 -0400 Subject: (systemd) speed up --- build-aux/Makefile.tail.mk | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index 136e483..aeba2d1 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -21,12 +21,10 @@ _at.tmp_targets := $(at.targets) _at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) # Clean the environment -$(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)), \ - $(foreach _at.tmp_target,$(_at.tmp_targets), \ - $(if $(filter recursive,$(flavor $(_at.tmp_variable))), \ - $(eval $(_at.tmp_target): private $(_at.tmp_variable) = $(subst $(at.nl),$$(at.nl),$(value $(_at.tmp_variable)))), \ - $(eval $(_at.tmp_target): private $(_at.tmp_variable) := $$($(_at.tmp_variable))))) \ - $(eval undefine $(_at.tmp_variable))) +$(eval \ + $(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)),\ + $(call _at.target_variable,$(_at.tmp_targets),$(_at.tmp_variable))$(at.nl)\ + undefine $(_at.tmp_variable)$(at.nl))) # Recurse $(foreach _at.NO_ONCE,y,\ -- cgit v1.2.3 From 88d181c25d2f99f8b510afe2f2cc7e1ba1fa012c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 10 Aug 2016 11:22:38 -0400 Subject: (systemd) fix build system --- build-aux/Makefile.tail.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'build-aux/Makefile.tail.mk') diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index aeba2d1..2e4adc6 100644 --- a/build-aux/Makefile.tail.mk +++ b/build-aux/Makefile.tail.mk @@ -22,7 +22,7 @@ _at.tmp_subdirs := $(call at.addprefix,$(outdir),$(at.subdirs)) # Clean the environment $(eval \ - $(foreach _at.tmp_variable,$(filter-out _at.tmp_variable $(_at.VARIABLES),$(.VARIABLES)),\ + $(foreach _at.tmp_variable,$(filter-out $(call _at.quote-pattern,_at.tmp_variable $(_at.VARIABLES)),$(.VARIABLES)),\ $(call _at.target_variable,$(_at.tmp_targets),$(_at.tmp_variable))$(at.nl)\ undefine $(_at.tmp_variable)$(at.nl))) -- cgit v1.2.3