diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-08-08 01:09:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-08-08 01:09:59 -0400 |
commit | 7f991fe569fc0562c9d67b3a473f9a4dda8dbc4d (patch) | |
tree | a758411b1801383f766065affcb7911e3475c1e2 | |
parent | 2abe0f2d527c7b3f6b97bd6519bf0e35a266ea68 (diff) |
speed up
-rw-r--r-- | build-aux/Makefile.each.head/00-am.mk | 3 | ||||
-rw-r--r-- | build-aux/Makefile.each.head/00-files.mk | 4 | ||||
-rw-r--r-- | build-aux/Makefile.each.tail/10-files.mk | 22 | ||||
-rw-r--r-- | build-aux/Makefile.each.tail/60-am.mk | 63 | ||||
-rw-r--r-- | build-aux/Makefile.head.mk | 6 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/30-am.mk | 64 | ||||
-rw-r--r-- | build-aux/Makefile.once.head/zz-mod.mk | 2 | ||||
-rw-r--r-- | build-aux/Makefile.tail.mk | 10 |
8 files changed, 93 insertions, 81 deletions
diff --git a/build-aux/Makefile.each.head/00-am.mk b/build-aux/Makefile.each.head/00-am.mk index f8c20b7706..46cc20194d 100644 --- a/build-aux/Makefile.each.head/00-am.mk +++ b/build-aux/Makefile.each.head/00-am.mk @@ -1,5 +1,4 @@ -$(foreach v,$(foreach p,$(am.primaries),am.inst_$p am.noinst_$p am.check_$p),\ - $(eval $v ?=)) +$(eval $(foreach v,$(foreach p,$(am.primaries),am.inst_$p am.noinst_$p am.check_$p),$v ?=$(at.nl))) am.CFLAGS ?= am.CPPFLAGS ?= am.subdirs ?= diff --git a/build-aux/Makefile.each.head/00-files.mk b/build-aux/Makefile.each.head/00-files.mk index 7bf323e0c7..c9a94e11a8 100644 --- a/build-aux/Makefile.each.head/00-files.mk +++ b/build-aux/Makefile.each.head/00-files.mk @@ -22,8 +22,8 @@ files.src = $(sort $(foreach _files.v,$(filter files.src.%,$(.VARIABLES)),$($(_f files.out.slow ?= files.out.int ?= files.out.cfg ?= -$(foreach t,$(files.groups),$(eval files.out.$t ?=)) +$(eval $(foreach t,$(files.groups),files.out.$t ?=$(at.nl))) files.out = $(sort $(foreach _files.v,$(filter files.out.%,$(.VARIABLES)),$($(_files.v)))) -$(foreach t,$(files.groups),$(eval files.sys.$t ?=)) +$(eval $(foreach t,$(files.groups),files.sys.$t ?=$(at.nl))) files.sys = $(sort $(foreach _files.v,$(filter files.sys.%,$(.VARIABLES)),$($(_files.v)))) diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk index 4607c433d0..8ab187b401 100644 --- a/build-aux/Makefile.each.tail/10-files.mk +++ b/build-aux/Makefile.each.tail/10-files.mk @@ -14,12 +14,13 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Add some more defaults to the *_files variables -$(foreach _files.var,$(patsubst files.%,%,files.src $(filter files.src.%,$(.VARIABLES))),\ - $(eval _files.$(_files.var) = $$(call at.addprefix,$$(srcdir),$$(files.$(_files.var))))) -$(foreach _files.var,$(patsubst files.%,%,files.out $(filter files.out.%,$(.VARIABLES))),\ - $(eval _files.$(_files.var) = $$(call at.addprefix,$$(outdir),$$(files.$(_files.var))))) -$(foreach _files.var,$(patsubst files.%,%,files.sys $(filter files.sys.%,$(.VARIABLES))),\ - $(eval _files.$(_files.var) = $$(addprefix $$(DESTDIR),$$(files.$(_files.var))))) +$(eval \ + $(foreach _files.var,$(filter files.src files.src.%,$(.VARIABLES)),\ + _$(_files.var) = $$(call at.addprefix,$$(srcdir),$$($(_files.var)))$(at.nl))\ + $(foreach _files.var,$(filter files.out files.out.%,$(.VARIABLES)),\ + _$(_files.var) = $$(call at.addprefix,$$(outdir),$$($(_files.var)))$(at.nl))\ + $(foreach _files.var,$(filter files.sys files.sys.%,$(.VARIABLES)),\ + _$(_files.var) = $$(addprefix $$(DESTDIR),$$($(_files.var)))$(at.nl))) _files.all = $(_files.src) $(_files.out) $(_files.sys) @@ -29,10 +30,11 @@ at.targets += $(subst *,%,$(_files.all)) $(outdir)/$(files.generate): $(_files.src.gen) $(_files.src.cfg) $(outdir)/install: $(_files.sys.$(files.default)) $(outdir)/installdirs: $(sort $(dir $(_files.sys))) -$(foreach _files.g,$(files.groups),\ - $(eval $$(outdir)/$(_files.g): $$(_files.out.$(_files.g)))) -$(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ - $(eval $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g)))) +$(eval \ + $(foreach _files.g,$(files.groups),\ + $$(outdir)/$(_files.g): $$(_files.out.$(_files.g))$(at.nl))\ + $(foreach _files.g,$(filter-out $(files.default),$(files.groups)),\ + $$(outdir)/install-$(_files.g): $$(_files.sys.$(_files.g)))$(at.nl)) # Destructive targets _files.uninstall = $(_files.sys) diff --git a/build-aux/Makefile.each.tail/60-am.mk b/build-aux/Makefile.each.tail/60-am.mk index ac8785d6ee..0524dc6ad9 100644 --- a/build-aux/Makefile.each.tail/60-am.mk +++ b/build-aux/Makefile.each.tail/60-am.mk @@ -1,64 +1,13 @@ mod.am.depends += files -######################################################################## -_am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\ - $(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES)))) -define _am.per_primary -noinst_$p ?= -check_$p ?= +$(eval \ + $(foreach p,$(am.primaries) ,$(call _am.per_primary,$p)$(at.nl))) +$(eval \ + $(foreach f,$(am.PROGRAMS) ,$(call _am.per_PROGRAM,$f,$(call am.file2var,$f))$(at.nl))\ + $(foreach f,$(am.LTLIBRARIES),$(call _am.per_LTLIBRARY,$f,$(call am.file2var,$f))$(at.nl))\ + $(foreach d,$(am.inst2dirs) ,$(call _am.per_directory,$d)$(at.nl))) -am.inst_$p := $$(foreach d,$$(call _am.primary2dirs,$p),$$($$d_$p)) -am.noinst_$p := $$(noinst_$p) -am.check_$p := $$(check_$p) -$(foreach d,$(call _am.primary2dirs,$p) nointt check,undefine $d_$p$(at.nl)) -ifneq ($$(am.inst_$p),) -$$(am.inst_$p): private am.INSTALL = $$(am.INSTALL_$p) -endif -am.$p = $$(am.check_$p) $$(am.noinst_$p) $$(call am.inst2noinst_$p,$$(am.inst_$p)) -endef -$(foreach p,$(am.primaries),$(eval $(_am.per_primary))) -######################################################################## files.sys.all += $(foreach p,$(am.primaries),$(am.inst_$p)) files.out.all += $(foreach p,$(am.primaries),$(am.noinst_$p)) files.out.all += $(foreach p,$(am.primaries),$(call am.inst2noinst_$p,$(am.inst_$p))) files.out.check += $(foreach p,$(am.primaries),$(am.check_$p)) -######################################################################## -# TODO: I'm not in love with how _am.per_PROGRAM figures out at.subdirs -define _am.per_PROGRAM -$$(foreach var,_am.depends $$(call am.var_PROGRAMS,$v),$$(eval $$(var) ?=)) -_am.depends += $$(call at.path,$$(call am.file2.o,$f) $$(call am.file2lib,$f,LDADD)) -am.CPPFLAGS += $$($v_CPPFLAGS) $$(call am.file2cpp,$f,LDADD) -am.CFLAGS += $$($v_CFLAGS) -$$(outdir)/$f: private ALL_LDFLAGS += $$($v_LDFLAGS) -$$(outdir)/$f: $$(_am.depends) -am.subdirs := $$(sort $$(am.subdirs)\ - $$(filter-out $$(abspath $$(srcdir)),\ - $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) -$$(foreach var,_am.depends $$(call am.var_PROGRAMS,$v),$$(eval undefine $$(var))) -endef -$(foreach f,$(am.PROGRAMS),$(foreach v,$(call am.file2var,$f),$(eval $(_am.per_PROGRAM)))) -######################################################################## -# TODO: I'm not in love with how _am.per_LTLIBRARY figures out at.subdirs -define _am.per_LTLIBRARY -$$(foreach var,_am.depends $$(call am.var_LTLIBRARIES,$v),$$(eval $$(var) ?=)) -_am.depends += $$(call at.path,$$(call am.file2.lo,$f) $$(call am.file2lib,$f,LIBADD)) -am.CPPFLAGS += $$($v_CPPFLAGS) $$(call am.file2cpp,$f,LIBADD) -am.CFLAGS += $$($v_CFLAGS) -$$(outdir)/$f: private ALL_LDFLAGS += $$($v_LDFLAGS) -$$(outdir)/$f: $$(_am.depends) -am.subdirs := $$(sort $$(am.subdirs)\ - $$(filter-out $$(abspath $$(srcdir)),\ - $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) -$$(foreach var,_am.depends $$(call am.var_LTLIBRARIES,$v),$$(eval undefine $$(var))) -endef -$(foreach f,$(am.LTLIBRARIES),$(foreach v,$(call am.file2var,$f),$(eval $(_am.per_LTLIBRARY)))) -######################################################################## -define _am.per_directory -$$(DESTDIR)$d/%: $$(outdir)/% - @$$(NORMAL_INSTALL) - $$(am.INSTALL) -$$(DESTDIR)$d/%: $$(srcdir)/% - @$$(NORMAL_INSTALL) - $$(am.INSTALL) -endef -$(foreach d,$(sort $(dir $(foreach p,$(am.primaries),$(am.inst_$p)))),$(eval $(_am.per_directory))) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index 8213043c79..105432c77a 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -47,6 +47,10 @@ _at.addprefix = $(call _at.path,$(if $(filter-out /%,$2),$1/$2,$2)) _at.rest = $(wordlist 2,$(words $1),$1) _at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1) +_at.target_variable = $(_at.target_variable.$(flavor $2)) +_at.target_variable.recursive = $1: private $2 = $(subst $(at.nl),$$(at.nl),$(value $2)) +_at.target_variable.simple = $1: private $2 := $$($2) + # Sanity checking ###################################################### ifeq ($(filter undefine,$(.FEATURES)),) $(error Autothing: We need a version of Make that supports 'undefine') @@ -61,8 +65,6 @@ ifneq ($(call _at.is_strict_subdir,$(topoutdir),$(topsrcdir)),) $(error Autothing: topsrcdir=$(topsrcdir) must not be a subdirectory of topoutdir=$(topoutdir)) endif -# Internal setup ####################################################### - # External provisions ################################################## # These 4 functions are all $(call _at.func,parent,child) diff --git a/build-aux/Makefile.once.head/30-am.mk b/build-aux/Makefile.once.head/30-am.mk index 9049f2c88a..bea6e2aee9 100644 --- a/build-aux/Makefile.once.head/30-am.mk +++ b/build-aux/Makefile.once.head/30-am.mk @@ -13,11 +13,15 @@ am.INSTALL_SCRIPT ?= $(INSTALL) $< $@ am.INSTALL_LTLIBRARY ?= $(INSTALL) $< $@ am.INSTALL_DATA ?= $(INSTALL_DATA) $< $@ -################################################################################ +######################################################################## # this list of primaries is based on the Automake 1.15 manual am.primaries ?= PROGRAMS LIBRARIES LTLIBRARIES LISP PYTHON JAVA SCRIPTS DATA HEADERS MANS TEXINFOS -$(foreach p,$(am.primaries),$(eval am.inst2noinst_$p ?= $$(notdir $$1))) +$(eval $(foreach p,$(am.primaries),am.inst2noinst_$p ?= $$(notdir $$1)$(at.nl))) + +am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\ + $(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES)))) +am.inst2dirs = $(sort $(dir $(foreach p,$(am.primaries),$(am.inst_$p)))) am.file2var = $(subst -,_,$(subst .,_,$1)) am.file2sources = $(addprefix $(srcdir)/,$(notdir $($(am.file2var)_SOURCES))) @@ -26,3 +30,59 @@ am.file2.o = $(patsubst $(srcdir)/%,$(outdir)/%,$(patsubst %.c,%.o ,$(filter %. am.file2.lo = $(patsubst %.o,%.lo,$(am.file2.o)) am.file2lib = $(foreach l, $($(am.file2var)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).DEPENDS) , $l )) am.file2cpp = $(foreach l,$1 $($(am.file2var)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).CPPFLAGS) , )) + +define _am.per_primary +noinst_$1 ?= +check_$1 ?= + +am.inst_$1 := $$(foreach d,$$(call am.primary2dirs,$1),$$($$d_$1)) +am.noinst_$1 := $$(noinst_$1) +am.check_$1 := $$(check_$1) +$(foreach d,$(call am.primary2dirs,$1) noinst check,undefine $d_$1$(at.nl)) +ifneq ($$(am.inst_$1),) +$$(am.inst_$1): private am.INSTALL = $$(am.INSTALL_$1) +endif +am.$1 = $$(am.check_$1) $$(am.noinst_$1) $$(call am.inst2noinst_$1,$$(am.inst_$1)) +endef +######################################################################## +# TODO: I'm not in love with how _am.per_PROGRAM figures out at.subdirs +# $1 = filename +# $2 = varname +define _am.per_PROGRAM +$(foreach var,_am.depends $(call am.var_PROGRAMS,$2),$(var) ?=$(at.nl)) +_am.depends += $$(call at.path,$$(call am.file2.o,$1) $$(call am.file2lib,$1,LDADD)) +am.CPPFLAGS += $$($2_CPPFLAGS) $$(call am.file2cpp,$1,LDADD) +am.CFLAGS += $$($2_CFLAGS) +$$(outdir)/$1: private ALL_LDFLAGS += $$($2_LDFLAGS) +$$(outdir)/$1: $$(_am.depends) +am.subdirs := $$(sort $$(am.subdirs)\ + $$(filter-out $$(abspath $$(srcdir)),\ + $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) +$(foreach var,_am.depends $(call am.var_LTLIBRARIES,$2),undefine $(var)$(at.nl)) +endef +######################################################################## +# TODO: I'm not in love with how _am.per_LTLIBRARY figures out at.subdirs +# $1 = filename +# $2 = varname +define _am.per_LTLIBRARY +$(foreach var,_am.depends $(call am.var_LTLIBRARIES,$2),$(var) ?=$(at.nl)) +_am.depends += $$(call at.path,$$(call am.file2.lo,$1) $$(call am.file2lib,$1,LIBADD)) +am.CPPFLAGS += $$($2_CPPFLAGS) $$(call am.file2cpp,$1,LIBADD) +am.CFLAGS += $$($2_CFLAGS) +$$(outdir)/$1: private ALL_LDFLAGS += $$($2_LDFLAGS) +$$(outdir)/$1: $$(_am.depends) +am.subdirs := $$(sort $$(am.subdirs)\ + $$(filter-out $$(abspath $$(srcdir)),\ + $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends)))))) +$(foreach var,_am.depends $(call am.var_LTLIBRARIES,$2),undefine $(var)$(at.nl)) +endef +######################################################################## +define _am.per_directory +$$(DESTDIR)$1/%: $$(outdir)/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +$$(DESTDIR)$1/%: $$(srcdir)/% + @$$(NORMAL_INSTALL) + $$(am.INSTALL) +endef + diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk index 3bf6398e13..7e526063c3 100644 --- a/build-aux/Makefile.once.head/zz-mod.mk +++ b/build-aux/Makefile.once.head/zz-mod.mk @@ -19,6 +19,8 @@ _mod.target = at-mod-info _mod.modules := $(sort $(patsubst %.mk,%,$(filter %.mk,$(subst -, ,$(notdir $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk)))))) _mod.quote = '$(subst ','\'',$1)' +$(eval $(foreach _mod.tmp,$(_mod.modules),mod.$(_mod.tmp).description ?=$(at.nl)mod.$(_mod.tmp).depends ?=$(at.nl))) + _mod.vars = $(filter $(addsuffix .%,$(_mod.modules)),$(.VARIABLES)) _mod.once := $(_mod.vars) _mod.each := diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk index 136e483837..aeba2d1b09 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,\ |