summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-08-08 01:09:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-08-08 01:09:59 -0400
commit7f991fe569fc0562c9d67b3a473f9a4dda8dbc4d (patch)
treea758411b1801383f766065affcb7911e3475c1e2 /build-aux/Makefile.once.head
parent2abe0f2d527c7b3f6b97bd6519bf0e35a266ea68 (diff)
speed up
Diffstat (limited to 'build-aux/Makefile.once.head')
-rw-r--r--build-aux/Makefile.once.head/30-am.mk64
-rw-r--r--build-aux/Makefile.once.head/zz-mod.mk2
2 files changed, 64 insertions, 2 deletions
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 :=