summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.each.tail
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-08-07 21:03:44 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-08-07 21:03:44 -0400
commit2abe0f2d527c7b3f6b97bd6519bf0e35a266ea68 (patch)
tree02eb54ce46d51f11defb2c6481cd23ee006d39c0 /build-aux/Makefile.each.tail
parent09010ac6999db43e39cde92200fc4a10858f5c51 (diff)
stuff
Diffstat (limited to 'build-aux/Makefile.each.tail')
-rw-r--r--build-aux/Makefile.each.tail/10-files.mk55
-rw-r--r--build-aux/Makefile.each.tail/10-nested.mk19
-rw-r--r--build-aux/Makefile.each.tail/10-std.mk46
-rw-r--r--build-aux/Makefile.each.tail/20-systemd.mk99
-rw-r--r--build-aux/Makefile.each.tail/30-automake2autothing.mk36
-rw-r--r--build-aux/Makefile.each.tail/30-directory-info.mk4
-rw-r--r--build-aux/Makefile.each.tail/50-sd.mk85
-rw-r--r--build-aux/Makefile.each.tail/60-am.mk64
8 files changed, 223 insertions, 185 deletions
diff --git a/build-aux/Makefile.each.tail/10-files.mk b/build-aux/Makefile.each.tail/10-files.mk
new file mode 100644
index 0000000000..4607c433d0
--- /dev/null
+++ b/build-aux/Makefile.each.tail/10-files.mk
@@ -0,0 +1,55 @@
+# 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 <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)))))
+
+_files.all = $(_files.src) $(_files.out) $(_files.sys)
+
+at.targets += $(subst *,%,$(_files.all))
+
+# Creative targets
+$(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))))
+
+# Destructive targets
+_files.uninstall = $(_files.sys)
+_files.mostlyclean = $(filter-out $(_files.out.slow) $(_files.out.cfg),$(_files.out))
+_files.clean = $(filter-out $(_files.out.cfg),$(_files.out))
+_files.distclean = $(_files.out)
+$(addprefix $(outdir)/,uninstall mostlyclean clean distclean): %: %-hook
+ $(RM) -- $(sort $(filter-out %/,$(_files.$(@F))))
+ $(RM) -r -- $(sort $(filter %/,$(_files.$(@F))))
+ $(RMDIR_P) -- $(sort $(dir $(_files.$(@F))))
+_files.maintainer-clean = $(filter-out $(_files.src.cfg) $(_files.src.src),$(_files.src))
+_files.$(files.vcsclean) = $(filter-out $(_files.src.src),$(_files.src))
+$(addprefix $(outdir)/,maintainer-clean $(files.vcsclean)): $(outdir)/%: $(outdir)/distclean $(outdir)/%-hook
+ @echo 'This command is intended for maintainers to use; it'
+ @echo 'deletes files that may need special tools to rebuild.'
+ $(RM) -- $(sort $(filter-out %/,$(_files.$(@F))))
+ $(RM) -r -- $(sort $(filter %/,$(_files.$(@F))))
+ $(RMDIR_P) -- $(sort $(dir $(_files.$(@F))))
+$(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook)::
+.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean $(files.vcsclean), $(outdir)/$t-hook)
diff --git a/build-aux/Makefile.each.tail/10-nested.mk b/build-aux/Makefile.each.tail/10-nested.mk
new file mode 100644
index 0000000000..e9d02ca5b0
--- /dev/null
+++ b/build-aux/Makefile.each.tail/10-nested.mk
@@ -0,0 +1,19 @@
+# Copyright (C) 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 <http://www.gnu.org/licenses/>.
+
+$(addprefix $(outdir)/,$(nested.targets)): $(outdir)/%: $(addsuffix /%,$(call at.addprefix,$(outdir),$(nested.subdirs)))
+.PHONY: $(addprefix $(outdir)/,$(nested.targets))
+
+at.subdirs += $(nested.subdirs)
diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk
deleted file mode 100644
index ca78f3cf8c..0000000000
--- a/build-aux/Makefile.each.tail/10-std.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-# 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 <http://www.gnu.org/licenses/>.
-# Add some more defaults to the *_files variables
-std.clean_files += $(std.gen_files) $(std.cfg_files) $(std.out_files)
-
-# Fix each variable at its current value to avoid any weirdness
-$(foreach c,src gen cfg out sys clean slow,$(eval std.$c_files := $$(std.$c_files)))
-
-# Make each of the standard variables relative to the correct directory
-std.src_files := $(call at.addprefix,$(srcdir)/,$(std.src_files))
-std.gen_files := $(call at.addprefix,$(srcdir)/,$(std.gen_files))
-std.cfg_files := $(call at.addprefix,$(outdir)/,$(std.cfg_files))
-std.out_files := $(call at.addprefix,$(outdir)/,$(std.out_files))
-std.sys_files := $(addprefix $(DESTDIR),$(std.sys_files))
-std.clean_files := $(call at.addprefix,$(outdir)/,$(std.clean_files))
-std.slow_files := $(call at.addprefix,$(outdir)/,$(std.slow_files))
-
-# Creative targets
-$(outdir)/build : $(std.out_files)
-$(outdir)/install : $(std.sys_files)
-$(outdir)/installdirs: $(sort $(dir $(std.sys_files)))
-
-# Destructive targets
-_std.uninstall/$(outdir) := $(std.sys_files)
-_std.mostlyclean/$(outdir) := $(filter-out $(std.slow_files) $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files))
-_std.clean/$(outdir) := $(filter-out $(std.cfg_files) $(std.gen_files) $(std.src_files),$(std.clean_files))
-_std.distclean/$(outdir) := $(filter-out $(std.gen_files) $(std.src_files),$(std.clean_files))
-_std.maintainer-clean/$(outdir) := $(filter-out $(std.src_files),$(std.clean_files))
-$(addprefix $(outdir)/,uninstall mostlyclean clean distclean maintainer-clean): %: %-hook
- $(RM) -- $(sort $(filter-out %/,$(_std.$(@F)/$(@D))))
- $(RM) -r -- $(sort $(filter %/,$(_std.$(@F)/$(@D))))
- $(RMDIR_P) $(sort $(dir $(_std.$(@F)/$(@D)))) 2>/dev/null || $(TRUE)
-$(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook)::
-.PHONY: $(foreach t,uninstall mostlyclean clean distclean maintainer-clean, $(outdir)/$t-hook)
diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk
deleted file mode 100644
index 1a65c000e2..0000000000
--- a/build-aux/Makefile.each.tail/20-systemd.mk
+++ /dev/null
@@ -1,99 +0,0 @@
-# -*- Mode: makefile; indent-tabs-mode: t -*-
-#
-# This file is part of systemd.
-#
-# Copyright 2010-2012 Lennart Poettering
-# Copyright 2010-2012 Kay Sievers
-# Copyright 2013 Zbigniew Jędrzejewski-Szmek
-# Copyright 2013 David Strauss
-# Copyright 2016 Luke Shumaker
-#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
-#
-# systemd 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with systemd; If not, see <http://www.gnu.org/licenses/>.
-
--include $(wildcard $(outdir)/$(DEPDIR)/*.P*)
-
-std.clean_files += *.o *.lo *.so .deps/ .libs/
-std.clean_files += *-list.txt
-std.clean_files += *-from-name.gperf
-std.clean_files += *-from-name.h
-std.clean_files += *-to-name.h
-std.clean_files += *-gperf.c
-
-$(outdir)/%.o : $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(COMPILE) -c -o $@ $<
-$(outdir)/%.o : $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(COMPILE) -c -o $@ $<
-$(outdir)/%.lo: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
-$(outdir)/%.lo: $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/.deps; $(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
-
-$(outdir)/.deps:
- $(AM_V_at)$(MKDIR_P) $@
-
-_systemd.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l)))
-_systemd.patsubst-all = $(if $1,$(call _systemd.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3)
-_systemd.lt_libs = $(foreach l,$(filter %.la,$1), $l $(call _systemd.lt_libs,$($(notdir $l).DEPENDS)))
-_systemd.lt_filter = $(filter-out $(call _systemd.dups,$(call _systemd.lt_libs,$1)),$1)
-
-_systemd.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(std.sys_files/$(@D)))))
-_systemd.link_files = $(call _systemd.lt_filter,$(filter %.o %.lo %.la,$^)) $(call _systemd.patsubst-all,$(.LIBPATTERNS),-l%,$(filter $(.LIBPATTERNS),$(notdir $^)))
-$(outdir)/%.la:
- @if test $(words $^) = 0; then echo 'Cannot link library with no dependencies: $@' >&2; exit 1; fi
- $(AM_V_CCLD)$(LINK) $(if $(_systemd.rpath),-rpath $(_systemd.rpath)) $(_systemd.link_files)
-$(addprefix $(outdir)/,$(foreach d,$(am.bindirs),$($d_PROGRAMS))): $(outdir)/%:
- @if test $(words $^) = 0; then echo 'Cannot link executable with no dependencies: $@' >&2; exit 1; fi
- $(AM_V_CCLD)$(LINK) $(_systemd.link_files)
-
-_systemd.in_destdir = $(foreach f,$(std.sys_files),$(if $(filter $1,$(patsubst %/,%,$(dir $f))),$(DESTDIR)$f))
-
-define install_bindir
-$(call _systemd.in_destdir,$(bindir)): $(DESTDIR)$(bindir)/%: $(outdir)/%
- @$(NORMAL_INSTALL)
- $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(SYS_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@
-endef
-$(foreach bindir,$(sort $(foreach d,$(am.bindirs),$($ddir))),$(eval $(value install_bindir)))
-
-define install_libdir
-$(call _systemd.in_destdir,$(libdir)): $(DESTDIR)$(libdir)/%.la: $(outdir)/%.la
- @$(NORMAL_INSTALL)
- $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(SYS_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@
-endef
-$(foreach libdir,$(sort $(foreach d,lib rootlib,$($ddir))),$(eval $(value install_libdir)))
-
-define install_datadir
-$(call _systemd.in_destdir,$(datadir)): $(DESTDIR)$(datadir)/%: $(outdir)/%
- @$(NORMAL_INSTALL)
- $(AM_V_DATA)$(INSTALL_DATA) $< $@
-endef
-$(foreach datadir,$(sort $(foreach d,pkgconfigdata pkgconfiglib bootlib,$($ddir))),$(eval $(value install_datadir)))
-
-$(outdir)/%-from-name.gperf: $(outdir)/%-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
-
-$(outdir)/%-from-name.h: $(outdir)/%-from-name.gperf
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
-
-$(addprefix $(outdir)/,$(systemd.sed_files)): $(outdir)/%: $(srcdir)/%.in
- $(SED_PROCESS)
-
-#$(outdir)/%.sh: $(srcdir)/%.sh.in
-# $(SED_PROCESS)
-# $(AM_V_GEN)chmod +x $@
-
-$(outdir)/%.c: $(srcdir)/%.gperf
- $(AM_V_GPERF)$(GPERF) < $< > $@
-$(outdir)/%.c: $(outdir)/%.gperf
- $(AM_V_GPERF)$(GPERF) < $< > $@
-
-$(outdir)/%: $(srcdir)/%.m4 $(top_builddir)/config.status
- $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
diff --git a/build-aux/Makefile.each.tail/30-automake2autothing.mk b/build-aux/Makefile.each.tail/30-automake2autothing.mk
deleted file mode 100644
index cd5cc4300d..0000000000
--- a/build-aux/Makefile.each.tail/30-automake2autothing.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-std.out_files += $(noinst_LTLIBRARIES) $(lib_LTLIBRARIES)
-std.sys_files += $(addprefix $(libdir)/,$(lib_LTLIBRARIES))
-
-_programs =
-$(foreach d,$(am.bindirs), \
- $(eval _programs += $($d_PROGRAMS) )\
- $(eval std.sys_files += $(addprefix $($(d)dir)/,$($d_PROGRAMS)) ))
-_programs += $(noinst_PROGRAMS)
-std.out_files += $(_programs)
-
-std.out_files += $(notdir $(pkgconfiglib_DATA))
-std.sys_files += $(addprefix $(pkgconfiglibdir)/,$(notdir $(pkgconfiglib_DATA)))
-
-$(foreach n,$(call automake_name,$(std.out_files)),\
- $(eval $n_SOURCES ?=)\
- $(eval nodist_$n_SOURCES ?=)\
- $(eval $n_CFLAGS ?=)\
- $(eval $n_CPPFLAGS ?=)\
- $(eval $n_LDFLAGS ?=)\
- $(eval $n_LIBADD ?=)\
- $(eval $n_LDADD ?=))
-$(foreach t,$(filter %.la,$(std.out_files)), \
- $(eval $t.DEPENDS += $(call at.path,$(call automake_lo,$t) $(call automake_lib,$t,LIBADD)) )\
- $(eval am.CPPFLAGS += $($(call automake_name,$t)_CPPFLAGS) $(call automake_cpp,$t,LIBADD) )\
- $(eval am.CFLAGS += $($(call automake_name,$t)_CFLAGS) )\
- $(eval $t: private ALL_LDFLAGS += $($(call automake_name,$t)_LDFLAGS) )\
- $(eval $(outdir)/$t: $($t.DEPENDS) )\
- $(eval at.depdirs += $(abspath $(sort $(dir $(filter-out -l% /%,$($t.DEPENDS))))) ))
-$(foreach t,$(_programs), \
- $(eval $t.DEPENDS += $(call at.path,$(call automake_o,$t) $(call automake_lib,$t,LDADD)) )\
- $(eval am.CPPFLAGS += $($(call automake_name,$t)_CPPFLAGS) $(call automake_cpp,$t,LDADD) )\
- $(eval am.CFLAGS += $($(call automake_name,$t)_CFLAGS) )\
- $(eval $t: private ALL_LDFLAGS += $($(call automake_name,$t)_LDFLAGS) )\
- $(eval $(outdir)/$t: $($t.DEPENDS) )\
- $(eval at.depdirs += $(sort $(filter-out $(abspath $(srcdir)), \
- $(abspath $(dir $(filter-out -l% /%,$($t.DEPENDS)))))) ))
diff --git a/build-aux/Makefile.each.tail/30-directory-info.mk b/build-aux/Makefile.each.tail/30-directory-info.mk
deleted file mode 100644
index 80f5e68c29..0000000000
--- a/build-aux/Makefile.each.tail/30-directory-info.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-dir_variables = $(foreach v,$(filter-out _%,$(patsubst %/$(@D),%,$(filter %/$(@D),$(.VARIABLES)))),$(if $(findstring /,$v),, $v))
-$(outdir)/directory-info:
- $(AM_V_at)printf '%s = «%s»\n' $(foreach v,$(dir_variables),$(if $($v/$(@D)),'$v' '$($v/$(@D))')) | sort | column -s= -o= -t
-.PHONY: $(outdir)/module-info
diff --git a/build-aux/Makefile.each.tail/50-sd.mk b/build-aux/Makefile.each.tail/50-sd.mk
new file mode 100644
index 0000000000..832247ef72
--- /dev/null
+++ b/build-aux/Makefile.each.tail/50-sd.mk
@@ -0,0 +1,85 @@
+# -*- Mode: makefile; indent-tabs-mode: t -*-
+#
+# This file is part of systemd.
+#
+# Copyright 2010-2012 Lennart Poettering
+# Copyright 2010-2012 Kay Sievers
+# Copyright 2013 Zbigniew Jędrzejewski-Szmek
+# Copyright 2013 David Strauss
+# Copyright 2016 Luke Shumaker
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# systemd 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+mod.sd.depends += files am lt
+
+-include $(wildcard $(outdir)/$(DEPDIR)/*.P*)
+
+files.out.int += *.o *.lo *.so .deps/ .libs/
+files.out.int += *-list.txt
+files.out.int += *-from-name.gperf
+files.out.int += *-from-name.h
+files.out.int += *-to-name.h
+files.out.int += *-gperf.c
+
+$(outdir)/%.o : $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.COMPILE) -c -o $@ $<
+$(outdir)/%.o : $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.COMPILE) -c -o $@ $<
+$(outdir)/%.lo: $(srcdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.LTCOMPILE) -c -o $@ $<
+$(outdir)/%.lo: $(outdir)/%.c $(topoutdir)/config.h | $(outdir)/$(DEPDIR); $(AM_V_CC)$(sd.LTCOMPILE) -c -o $@ $<
+
+$(outdir)/$(DEPDIR):
+ $(AM_V_at)$(MKDIR_P) $@
+
+$(outdir)/%.la:
+ @if test $(words $(lt.link_files)) = 0; then echo 'Cannot link library with no dependencies: $@' >&2; exit 1; fi
+ $(AM_V_CCLD)$(sd.LINK) $(if $(lt.rpath),-rpath $(lt.rpath)) $(lt.link_files)
+$(addprefix $(outdir)/,$(am.PROGRAMS)): $(outdir)/%:
+ @if test $(words $(lt.link_files)) = 0; then echo 'Cannot link executable with no dependencies: $@' >&2; exit 1; fi
+ $(AM_V_CCLD)$(sd.LINK) $(lt.link_files)
+
+# Stupid test that everything purported to be exported really is
+$(outdir)/test-lib%-sym.c: lib%.sym
+ $(AM_V_GEN){\
+ printf '#include <stdio.h>\n' && \
+ printf '#include "%s"\n' $(notdir $(filter %.h, $^)) && \
+ printf 'void* functions[] = {\n' && \
+ sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< && \
+ printf '};\nint main(void) {\n' && \
+ printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' && \
+ printf 'return 0; }\n' && \
+ :; } > $@
+
+_sd.files_in = $(foreach f,$(files.sys),$(if $(filter $1,$(patsubst %/,%,$(dir $f))),$(DESTDIR)$f))
+
+$(outdir)/%-from-name.gperf: $(outdir)/%-list.txt
+ $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
+
+$(outdir)/%-from-name.h: $(outdir)/%-from-name.gperf
+ $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
+
+ifneq ($(sd.sed_files),)
+$(addprefix $(outdir)/,$(sd.sed_files)): $(outdir)/%: $(srcdir)/%.in
+ $(sd.SED_PROCESS)
+endif
+
+#$(outdir)/%.sh: $(srcdir)/%.sh.in
+# $(SED_PROCESS)
+# $(AM_V_GEN)chmod +x $@
+
+$(outdir)/%.c: $(srcdir)/%.gperf
+ $(AM_V_GPERF)$(GPERF) < $< > $@
+$(outdir)/%.c: $(outdir)/%.gperf
+ $(AM_V_GPERF)$(GPERF) < $< > $@
+
+$(outdir)/%: $(srcdir)/%.m4 $(top_builddir)/config.status
+ $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
diff --git a/build-aux/Makefile.each.tail/60-am.mk b/build-aux/Makefile.each.tail/60-am.mk
new file mode 100644
index 0000000000..ac8785d6ee
--- /dev/null
+++ b/build-aux/Makefile.each.tail/60-am.mk
@@ -0,0 +1,64 @@
+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 ?=
+
+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)))