summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux')
-rw-r--r--build-aux/Makefile.each.head/00-am.mk3
-rw-r--r--build-aux/Makefile.each.head/00-sd.mk6
-rw-r--r--build-aux/Makefile.each.tail/50-sd.mk94
-rw-r--r--build-aux/Makefile.each.tail/60-am.mk6
-rw-r--r--build-aux/Makefile.each.tail/60-amcfg.mk52
-rw-r--r--build-aux/Makefile.each.tail/70-sdcompletion.mk23
-rw-r--r--build-aux/Makefile.each.tail/70-sdman.mk73
-rw-r--r--build-aux/Makefile.once.head/10-lt.mk57
-rw-r--r--build-aux/Makefile.once.head/20-amcfg.mk77
-rw-r--r--build-aux/Makefile.once.head/20-sd.mk256
-rw-r--r--build-aux/Makefile.once.head/20-sdman.mk93
-rw-r--r--build-aux/Makefile.once.head/30-am.mk286
-rw-r--r--build-aux/Makefile.once.tail/10-sd.mk112
13 files changed, 1138 insertions, 0 deletions
diff --git a/build-aux/Makefile.each.head/00-am.mk b/build-aux/Makefile.each.head/00-am.mk
new file mode 100644
index 0000000000..09a2d3c5ac
--- /dev/null
+++ b/build-aux/Makefile.each.head/00-am.mk
@@ -0,0 +1,3 @@
+am.CFLAGS ?=
+am.CPPFLAGS ?=
+am.subdirs ?=
diff --git a/build-aux/Makefile.each.head/00-sd.mk b/build-aux/Makefile.each.head/00-sd.mk
new file mode 100644
index 0000000000..43d1625245
--- /dev/null
+++ b/build-aux/Makefile.each.head/00-sd.mk
@@ -0,0 +1,6 @@
+sd.CFLAGS ?=
+sd.CPPFLAGS ?=
+sd.LDFLAGS ?=
+sd.LIBTOOLFLAGS ?=
+
+sd.sed_files ?=
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..9917a0ce54
--- /dev/null
+++ b/build-aux/Makefile.each.tail/50-sd.mk
@@ -0,0 +1,94 @@
+# -*- 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.lib.files.all)) = 0; then echo 'Cannot link library with no dependencies: $@' >&2; exit 1; fi
+ @if test $(origin am.LDFLAGS) = undefined; then echo 'Cannot link library with undefined am.LDFLAGS: $@' >&2; exit 1; fi
+ $(AM_V_CCLD)$(sd.LINK) $(if $(lt.lib.rpath),-rpath $(lt.lib.rpath)) $(lt.lib.files.ld)
+ $(AM_V_at)$(lt.lib.post)
+$(addprefix $(outdir)/,$(am.out_PROGRAMS)): $(outdir)/%:
+ @if test $(words $(lt.exe.files.all)) = 0; then echo 'Cannot link executable with no dependencies: $@' >&2; exit 1; fi
+ @if test $(origin am.LDFLAGS) = undefined; then echo 'Cannot link executable with undefined am.LDFLAGS: $@' >&2; exit 1; fi
+ $(AM_V_CCLD)$(sd.LINK) $(lt.exe.files.ld)
+
+# Stupid test that everything purported to be exported really is
+$(outdir)/test-lib%-sym.c: $(srcdir)/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 <$< >$@
+
+ifeq ($(sd.sed_files),)
+EXTRA_DIST ?=
+sd.sed_files += $(notdir $(patsubst %.in,%,$(filter %.in,$(EXTRA_DIST))))
+endif
+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) < $< > $@
+$(outdir)/%: $(outdir)/%.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..38ebc10ea9
--- /dev/null
+++ b/build-aux/Makefile.each.tail/60-am.mk
@@ -0,0 +1,6 @@
+$(eval $(value _am.pass0))
+$(eval $(value _am.pass1))
+$(eval $(value _am.pass2))
+$(eval $(value _am.pass3))
+$(eval $(value _am.pass4))
+$(eval $(value _am.pass5))
diff --git a/build-aux/Makefile.each.tail/60-amcfg.mk b/build-aux/Makefile.each.tail/60-amcfg.mk
new file mode 100644
index 0000000000..ae9d25457b
--- /dev/null
+++ b/build-aux/Makefile.each.tail/60-amcfg.mk
@@ -0,0 +1,52 @@
+$(DESTDIR)$(includedir)/%.h: $(srcdir)/include/%.h
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+
+$(DESTDIR)$(sysusersdir)/%.conf: $(srcdir)/%.sysusers
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+$(DESTDIR)$(sysusersdir)/%.conf: $(outdir)/%.sysusers
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+
+$(DESTDIR)$(sysctldir)/%.conf: $(srcdir)/%.sysctl
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+$(DESTDIR)$(sysctldir)/%.conf: $(outdir)/%.sysctl
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+
+$(DESTDIR)$(tmpfilesdir)/%.conf: $(srcdir)/%.tmpfiles
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+$(DESTDIR)$(tmpfilesdir)/%.conf: $(outdir)/%.tmpfiles
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+
+$(DESTDIR)$(pamconfdir)/%: $(srcdir)/%.pam
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+$(DESTDIR)$(pamconfdir)/%: $(outdir)/%.pam
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+
+$(DESTDIR)$(bashcompletiondir)/%: $(srcdir)/%.completion.bash
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+$(DESTDIR)$(bashcompletiondir)/%: $(outdir)/%.completion.bash
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+
+$(DESTDIR)$(zshcompletiondir)/_%: $(srcdir)/%.completion.zsh
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+$(DESTDIR)$(zshcompletiondir)/_%: $(outdir)/%.completion.zsh
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+
+$(DESTDIR)$(xinitrcdir)/%.sh: $(srcdir)/%.xinitrc
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
+$(DESTDIR)$(xinitrcdir)/%.sh: $(outdir)/%.xinitrc
+ @$(NORMAL_INSTALL)
+ $(am.INSTALL)
diff --git a/build-aux/Makefile.each.tail/70-sdcompletion.mk b/build-aux/Makefile.each.tail/70-sdcompletion.mk
new file mode 100644
index 0000000000..22a0d1be62
--- /dev/null
+++ b/build-aux/Makefile.each.tail/70-sdcompletion.mk
@@ -0,0 +1,23 @@
+mod.sdcompletion.description = (systemd) shell completion
+mod.sdcompletion.depends += am
+define mod.sdcompletion.doc
+# Inputs:
+# - Directory variable : `rootbin_PROGRAMS`
+# - Directory variable : `bin_PROGRAMS`
+# - Directory variable : `dist_bin_SCRIPTS`
+# - Directory variable : `bashcompletion_DATA`
+# - Directory variable : `zshcompletion_DATA`
+# Outputs:
+# - Directory variable : `dist_bashcompletion_DATA`
+# - Directory variable : `dist_zshcompletion_DATA`
+endef
+mod.sdcompletion.doc := $(value mod.sdcompletion.doc)
+
+rootbin_PROGRAMS ?=
+bin_PROGRAMS ?=
+dist_bin_SCRIPTS ?=
+bashcompletion_DATA ?=
+zshcompletion_DATA ?=
+# We use `dist_` to trick `am` into not putting it in `am.out_DATA`
+dist_bashcompletion_DATA := $(sort $(bashcompletion_DATA) $(rootbin_PROGRAMS) $(bin_PROGRAMS) $(dist_bin_SCRIPTS))
+dist_zshcompletion_DATA := $(sort $(zshcompletion_DATA) $(addprefix _,$(rootbin_PROGRAMS) $(bin_PROGRAMS) $(dist_bin_SCRIPTS)))
diff --git a/build-aux/Makefile.each.tail/70-sdman.mk b/build-aux/Makefile.each.tail/70-sdman.mk
new file mode 100644
index 0000000000..ccbb1bd4e1
--- /dev/null
+++ b/build-aux/Makefile.each.tail/70-sdman.mk
@@ -0,0 +1,73 @@
+# -*- 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/>.
+
+_sdman.man_xml = $(foreach _sdman.tmp,$(filter %.xml,$(files.src.src)),$(if $(findstring /,$(_sdman.tmp)),,$(_sdman.tmp)))
+
+ifneq ($(_sdman.man_xml),)
+
+$(srcdir)/Makefile-man.mk: $(topsrcdir)/tools/make-man-rules.py $(topsrcdir)/tools/xml_helper.py $(topsrcdir)/man/custom-entities.ent.in $(outdir)/.var._sdman.man_xml $(call at.addprefix,$(srcdir),$(_sdman.man_xml))
+ $(AM_V_GEN)$(PYTHON) $< $(filter %.xml,$^) | $(WRITE_ATOMIC) $@
+files.src.gen += Makefile-man.mk
+
+sdman.MANPAGES =
+sdman.MANPAGES_ALIAS =
+#-include $(srcdir)/Makefile-man.mk
+
+_sdman.XML_FILES = \
+ ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(sdman.MANPAGES)}}}}}
+_sdman.HTML_FILES = \
+ ${_sdman.XML_FILES:.xml=.html}
+_sdman.HTML_ALIAS = \
+ ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(sdman.MANPAGES_ALIAS)}}}}}
+
+ifneq ($(ENABLE_MANPAGES),)
+man_MANS = \
+ $(sdman.MANPAGES) \
+ $(sdman.MANPAGES_ALIAS)
+
+noinst_DATA += \
+ $(_sdman.HTML_FILES) \
+ $(_sdman.HTML_ALIAS)
+endif # ENABLE_MANPAGES
+
+at.subdirs += $(abspath $(topoutdir)/man)
+
+$(outdir)/%.1: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(_sdman.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.3: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(_sdman.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.5: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(_sdman.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.7: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(_sdman.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.8: $(srcdir)/%.xml $(topsrcdir)/man/custom-man.xsl $(topoutdir)/man/custom-entities.ent
+ $(_sdman.XSLTPROC_PROCESS_MAN)
+
+$(outdir)/%.html: $(srcdir)/%.xml $(topsrcdir)/man/custom-html.xsl $(topoutdir)/man/custom-entities.ent
+ $(_sdman.XSLTPROC_PROCESS_HTML)
+
+endif # _sdman.man_xml
diff --git a/build-aux/Makefile.once.head/10-lt.mk b/build-aux/Makefile.once.head/10-lt.mk
new file mode 100644
index 0000000000..9d27d62870
--- /dev/null
+++ b/build-aux/Makefile.once.head/10-lt.mk
@@ -0,0 +1,57 @@
+mod.lt.description = (systemd) Easy handling of libtool dependencies
+mod.lt.depends += files
+define mod.lt.doc
+# Inputs:
+# - Global variable : `$(.LIBPATTERNS)`
+# - Directory variable : `$(files.sys)`
+# - Target variable : `$@`
+# - Target variable : `$(@F)`
+# - Target variable : `$^`
+# Outputs:
+# - Target variable : `lt.lib.rpath` (`$(@D)`, `$(files.sys)`)
+# - Target variable : `lt.lib.files.all` (`$^`, `$(.LIBPATTERNS)`)
+# - Target variable : `lt.lib.files.ld` (`$(lt.lib.rpath)`, `$(lt.lib.files.all)`)
+# - Target variable : `lt.lib.post` (`$(lt.lib.rpath)`, `$(lt.lib.files.all)`)
+# - Target variable : `lt.exe.files.all` (`$^`, `$(.LIBPATTERNS)`)
+# - Target variable : `lt.exe.files.ld` (an alias for `lt.exe.files.all`)
+#
+# A set of variables to make interacting with libtool a little easier.
+#
+# libtool tries to abstract away the difference between static libraries
+# and dynamic libraries. But, it does a crappy job. If one library
+# depends on another library, you have to care about which of them are
+# static and which are dynamic, or you'll either end up with missing
+# symbols, or duplicate symbols. Either way, it will fail to link your
+# executable.
+#
+# So, our workaround: don't pass any .la libraries to libtool/ld when
+# linking a convenience library, but then run a post-libtool command to
+# insert them into the .la file's dependency_libs. This uses the
+# emptiness of lt.lib.rpath to determine if a library is a static
+# convenience library or not.
+endef
+mod.lt.doc := $(value mod.lt.doc)
+
+_lt.patsubst-all = $(if $1,$(call _lt.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3)
+_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(notdir $(_lt.tmp))),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(notdir $(_lt.tmp))),$(_lt.tmp)))
+_lt.rest = $(wordlist 2,$(words $1),$1)
+# Usage: $(call _lt.dedup,ITEM1 ITEM2 ITEM3)
+# Removes duplicate items while keeping the order the same (the leftmost of a duplicate is used).
+_lt.dedup = $(if $1,$(if $(filter $(firstword $1),$(call _lt.rest,$1)),,$(firstword $1) )$(call _lt.dedup,$(call _lt.rest,$1)))
+# Usage: $(call _lt.dependency_libs,LIB1.la OBJ.lo LIB2.la)
+# => LIB1.la LIB1.la:dependency_libs OBJ.lo LIB2.la LIB2.la:dependency_libs
+# Insert a .la library's dependency_libs after the library itself in the list.
+_lt.dependency_libs = $(foreach _lt.tmp,$1,$(_lt.tmp)$(if $(filter %.la,$(_lt.tmp)), $(shell . $(_lt.tmp); echo $$dependency_libs)))
+
+ lt.lib.rpath = $(patsubst %/,%,$(dir $(filter %/$(@F),$(files.sys))))
+ lt.lib.files.all = $(filter %.lo %.la -l%,$(call _lt.unLIBPATTERNS,$^))
+ lt.lib.files.ld = $(strip $(if $(lt.lib.rpath),\
+ $(lt.lib.files.all),\
+ $(filter-out %.la,$(lt.lib.files.all))))
+_lt.lib.files.dep = $(strip $(call _lt.dedup,$(filter %.la -l%,$(call _lt.dependency_libs,$(lt.lib.files.all)))))
+ lt.lib.post = $(strip $(if $(lt.lib.rpath),\
+ true,\
+ sed -i 's|^dependency_libs=.*|dependency_libs='\''$(_lt.lib.files.dep)'\''|' $@))
+
+lt.exe.files.all = $(filter %.o %.la -l%,$(call _lt.unLIBPATTERNS,$^))
+lt.exe.files.ld = $(lt.exe.files.all)
diff --git a/build-aux/Makefile.once.head/20-amcfg.mk b/build-aux/Makefile.once.head/20-amcfg.mk
new file mode 100644
index 0000000000..e5a674116c
--- /dev/null
+++ b/build-aux/Makefile.once.head/20-amcfg.mk
@@ -0,0 +1,77 @@
+mod.amcfg.description = (systemd) Automake-to-Autothing configuration
+mod.amcfg.depends += am
+define mod.amcfg.doc
+# User variables:
+# - `V`
+# - `AM_V_*`
+# - `pamconfdir`
+# - `tmpfilesdir`
+# - `sysusersdir`
+# - `sysctldir`
+# - `bashcompletiondir`
+# - `zshcompletiondir`
+# - `LIBTOOL`
+# - `INSTALL_PROGRAM`
+# - `INSTALL_SCRIPT`
+# - `INSTALL_DATA`
+# Inputs:
+# - Global variable: `sd.ALL_LIBTOOLFLAGS`
+# Outputs:
+# - Global variable: `am.sys2out_*`
+# - Global variable: `am.INSTALL_*`
+endef
+mod.amcfg.doc := $(value mod.amcfg.doc)
+
+am.sys2out_DATA = \
+ $(notdir \
+ $(patsubst $(pamconfdir)/%,%.pam,\
+ $(patsubst $(tmpfilesdir)/%.conf,%.tmpfiles,\
+ $(patsubst $(sysusersdir)/%.conf,%.sysusers,\
+ $(patsubst $(sysctldir)/%.conf,%.sysctl,\
+ $(patsubst $(bashcompletiondir)/%,%.completion.bash,\
+ $(patsubst $(zshcompletiondir)/_%,%.completion.zsh,\
+ $1)))))))
+am.sys2out_SCRIPTS = \
+ $(notdir \
+ $(patsubst $(xinitrcdir)/%.sh,%.xinitrc,\
+ $1))
+am.sys2out_HEADERS = $(abspath $(addprefix $(srcdir)/include/,$(notdir $1)))
+
+V ?=
+
+AM_V_PROG ?= $(AM_V_PROG_$(V))
+AM_V_PROG_ ?= $(AM_V_PROG_$(AM_DEFAULT_VERBOSITY))
+AM_V_PROG_0 ?= @echo " PROG " $@;
+AM_V_PROG_1 ?=
+
+AM_V_SCRIPT ?= $(AM_V_SCRIPT_$(V))
+AM_V_SCRIPT_ ?= $(AM_V_SCRIPT_$(AM_DEFAULT_VERBOSITY))
+AM_V_SCRIPT_0 ?= @echo " SCRIPT " $@;
+AM_V_SCRIPT_1 ?=
+
+AM_V_LIB ?= $(AM_V_LIB_$(V))
+AM_V_LIB_ ?= $(AM_V_LIB_$(AM_DEFAULT_VERBOSITY))
+AM_V_LIB_0 ?= @echo " LIB " $@;
+AM_V_LIB_1 ?=
+
+AM_V_DATA ?= $(AM_V_DATA_$(V))
+AM_V_DATA_ ?= $(AM_V_DATA_$(AM_DEFAULT_VERBOSITY))
+AM_V_DATA_0 ?= @echo " DATA " $@;
+AM_V_DATA_1 ?=
+
+AM_V_HEADER ?= $(AM_V_HEADER_$(V))
+AM_V_HEADER_ ?= $(AM_V_HEADER_$(AM_DEFAULT_VERBOSITY))
+AM_V_HEADER_0 ?= @echo " HEADER " $@;
+AM_V_HEADER_1 ?=
+
+AM_V_MAN ?= $(AM_V_MAN_$(V))
+AM_V_MAN_ ?= $(AM_V_MAN_$(AM_DEFAULT_VERBOSITY))
+AM_V_MAN_0 ?= @echo " MAN " $@;
+AM_V_MAN_1 ?=
+
+am.INSTALL_PROGRAMS = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@
+am.INSTALL_SCRIPTS = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@
+am.INSTALL_LTLIBRARIES = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@
+am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@
+am.INSTALL_HEADERS = $(AM_V_HEADER)$(INSTALL_DATA) $< $@
+am.INSTALL_MANS = $(AM_V_MAN)$(INSTALL_DATA) $< $@
diff --git a/build-aux/Makefile.once.head/20-sd.mk b/build-aux/Makefile.once.head/20-sd.mk
new file mode 100644
index 0000000000..4e44d2f7b3
--- /dev/null
+++ b/build-aux/Makefile.once.head/20-sd.mk
@@ -0,0 +1,256 @@
+# -*- 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.description = (systemd) shared build rules
+mod.sd.depends += am
+define mod.sd.doc
+# User variables:
+# (flags)
+# - `CFLAGS`
+# - `CPPFLAGS`
+# - `LDFLAGS`
+# - `LIBTOOLFLAGS`
+# (programs)
+# - `CC`
+# - `CCLD`
+# - `LIBTOOL`
+# - `MKDIR_P`
+# - `SED`
+# (verbosity)
+# - `V`
+# - `AM_V_*`
+# - `INTLTOOL_V_MERGE*`
+# (substitutions)$(foreach v,$(sort $(sd.substitution_keys)),$(at.nl)# - $v)
+# Inputs:
+# - Global variable : `DEPDIR`
+# - Global variable : `ENABLE_TESTS`
+# - Global variable : `ENABLE_UNSAFE_TESTS`
+# - Global variable : `OUR_CFLAGS`
+# - Global variable : `OUR_CPPFLAGS`
+# - Global variable : `OUR_LDFLAGS`
+# - Global variable : `OUR_LIBTOOLFLAGS`
+# (Makefiles)
+# - Directory variable : `sd.CFLAGS`
+# - Directory variable : `sd.CPPFLAGS`
+# - Directory variable : `sd.LDFLAGS`
+# - Directory variable : `sd.LIBTOOLFLAGS`
+# - Directory variable : `sd.sed_files` (default based on `EXTRA_DIST`)
+# (am)
+# - Directory variable : `EXTRA_DIST`
+# - Directory variable : `am.out_PROGRAMS`
+# - Directory variable : `am.CFLAGS`
+# - Directory variable : `am.CPPFLAGS`
+# - Target variable : `am.LDFLAGS`
+# Outputs:
+# - Global variable : `SHELL`
+# - Make setting : `.DELETE_ON_ERROR`
+# - Make setting : `.SECONDARY`
+# - Global variable : `sd.substitutions`
+# - Global variable : `sd.substitution_keys`
+# - Global variable : `sd.sed_process`
+# - Directory variable : `files.out.int`
+# - Target variable : `sd.ALL_CFLAGS`
+# - Target variable : `sd.ALL_CPPFLAGS`
+# - Target variable : `sd.ALL_LDFLAGS`
+# - Target variable : `sd.ALL_LIBTOLFLAGS`
+# - Target variable : `sd.COMPILE`
+# - Target variable : `sd.LTCOMPILE`
+# - Target variable : `sd.LINK`
+# - Target : `$$(outdir)/%.o`
+# - Target : `$$(outdir)/%.lo`
+# - Target : `$$(outdir)/$$(DEPDIR)`
+# - Target : `$$(outdir)/%.la`
+# - Target : `$$(addprefix $$(outdir)/,$$(am.out_PROGRAMS))`
+# - Target : `$$(outdir)/test-lib%-sym.c`
+# - Target : `$$(outdir)/%-from-name.gperf`
+# - Target : `$$(outdir)/%-from-name.h`
+# - Target : `$$(addprefix $$(outdir)/,$$(sd.sed_files))`
+# - Target : `$$(outdir)/%.c: $$(srcdir)/%.gperf`
+# - Target : `$$(outdir)/%: $$(srcdir)/%.m4`
+# ???:
+# - tests
+# - unsafe_tests
+# - TESTS
+
+endef
+
+tests ?=
+unsafe_tests ?=
+TESTS = $(if $(ENABLE_TESTS),$(tests) \
+ $(if $(ENABLE_UNSAFE_TESTS),$(unsafe_tests)))
+
+# Make behavior
+SHELL = bash -o pipefail
+
+.DELETE_ON_ERROR:
+.SECONDARY:
+
+# Autoconf
+OUR_CPPFLAGS += -MT $@ -MD -MP -MF $(@D)/$(DEPDIR)/$(basename $(@F)).P$(patsubst .%,%,$(suffix $(@F)))
+OUR_CPPFLAGS += -include $(topoutdir)/config.h
+OUR_CPPFLAGS += $(sort -I$(@D) $(if $(<D),-I$(<D) -I$(call at.out2src,$(<D))))
+
+sd.ALL_CFLAGS = $(strip $(OUR_CFLAGS) $(am.CFLAGS) $(sd.CFLAGS) $(CFLAGS) )
+sd.ALL_CPPFLAGS = $(strip $(OUR_CPPFLAGS) $(am.CPPFLAGS) $(sd.CPPFLAGS) $(CPPFLAGS) )
+sd.ALL_LDFLAGS = $(strip $(OUR_LDFLAGS) $(am.LDFLAGS) $(sd.LDFLAGS) $(LDFLAGS) )
+sd.ALL_LIBTOOLFLAGS = $(strip $(OUR_LIBTOOLFLAGS) $(sd.LIBTOOLFLAGS) $(LIBTOOLFLAGS) )
+
+sd.COMPILE = $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS)
+sd.LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=compile $(CC) $(sd.ALL_CPPFLAGS) $(sd.ALL_CFLAGS)
+sd.LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=link $(CCLD) $(sd.ALL_CFLAGS) $(sd.ALL_LDFLAGS) -o $@
+
+CC ?= c99
+CCLD ?= c99
+LIBTOOL ?= libtool
+
+V ?=
+
+AM_V_at ?= $(AM_V_at_$(V))
+AM_V_at_ ?= $(AM_V_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at_0 ?= @
+AM_V_at_1 ?=
+
+AM_V_M4 ?= $(AM_V_M4_$(V))
+AM_V_M4_ ?= $(AM_V_M4_$(AM_DEFAULT_VERBOSITY))
+AM_V_M4_0 ?= @echo " M4 " $@;
+AM_V_M4_1 ?=
+
+AM_V_GPERF ?= $(AM_V_GPERF_$(V))
+AM_V_GPERF_ ?= $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY))
+AM_V_GPERF_0 ?= @echo " GPERF " $@;
+AM_V_GPERF_1 ?=
+
+AM_V_RM ?= $(AM_V_RM_$(V))
+AM_V_RM_ ?= $(AM_V_RM_$(AM_DEFAULT_VERBOSITY))
+AM_V_RM_0 ?= @echo " RM " $@;
+AM_V_RM_1 ?=
+
+AM_V_CC ?= $(AM_V_CC_$(V))
+AM_V_CC_ ?= $(AM_V_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_CC_0 ?= @echo " CC " $@;
+AM_V_CC_1 ?=
+
+AM_V_CCLD ?= $(AM_V_CCLD_$(V))
+AM_V_CCLD_ ?= $(AM_V_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_CCLD_0 ?= @echo " CCLD " $@;
+AM_V_CCLD_1 ?=
+
+AM_V_EFI_CC ?= $(AM_V_EFI_CC_$(V))
+AM_V_EFI_CC_ ?= $(AM_V_EFI_CC_$(AM_DEFAULT_VERBOSITY))
+AM_V_EFI_CC_0 ?= @echo " EFI_CC " $@;
+AM_V_EFI_CC_1 ?=
+
+AM_V_EFI_CCLD ?= $(AM_V_EFI_CCLD_$(V))
+AM_V_EFI_CCLD_ ?= $(AM_V_EFI_CCLD_$(AM_DEFAULT_VERBOSITY))
+AM_V_EFI_CCLD_0 ?= @echo " EFI_CCLD" $@;
+AM_V_EFI_CCLD_1 ?=
+
+AM_V_P ?= $(AM_V_P_$(V))
+AM_V_P_ ?= $(AM_V_P_$(AM_DEFAULT_VERBOSITY))
+AM_V_P_0 ?= false
+AM_V_P_1 ?= :
+
+AM_V_GEN ?= $(AM_V_GEN_$(V))
+AM_V_GEN_ ?= $(AM_V_GEN_$(AM_DEFAULT_VERBOSITY))
+AM_V_GEN_0 ?= @echo " GEN " $@;
+AM_V_GEN_1 ?=
+
+AM_V_lt ?= $(AM_V_lt_$(V))
+AM_V_lt_ ?= $(AM_V_lt_$(AM_DEFAULT_VERBOSITY))
+AM_V_lt_0 ?= --silent
+AM_V_lt_1 ?=
+
+INTLTOOL_V_MERGE ?= $(INTLTOOL_V_MERGE_$(V))
+INTLTOOL_V_MERGE_OPTIONS ?= $(intltool_v_merge_options_$(V))
+INTLTOOL_V_MERGE_ ?= $(INTLTOOL_V_MERGE_$(AM_DEFAULT_VERBOSITY))
+INTLTOOL_V_MERGE_0 ?= @echo " ITMRG " $@;
+INTLTOOL_V_MERGE_1 ?=
+
+sd.substitutions = \
+ '|rootlibexecdir=$(rootlibexecdir)|' \
+ '|rootbindir=$(rootbindir)|' \
+ '|bindir=$(bindir)|' \
+ '|SYSTEMCTL=$(rootbindir)/systemctl|' \
+ '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \
+ '|pkgsysconfdir=$(pkgsysconfdir)|' \
+ '|SYSTEM_CONFIG_UNIT_PATH=$(pkgsysconfdir)/system|' \
+ '|USER_CONFIG_UNIT_PATH=$(pkgsysconfdir)/user|' \
+ '|pkgdatadir=$(pkgdatadir)|' \
+ '|systemunitdir=$(systemunitdir)|' \
+ '|userunitdir=$(userunitdir)|' \
+ '|systempresetdir=$(systempresetdir)|' \
+ '|userpresetdir=$(userpresetdir)|' \
+ '|udevhwdbdir=$(udevhwdbdir)|' \
+ '|udevrulesdir=$(udevrulesdir)|' \
+ '|catalogdir=$(catalogdir)|' \
+ '|tmpfilesdir=$(tmpfilesdir)|' \
+ '|sysusersdir=$(sysusersdir)|' \
+ '|sysctldir=$(sysctldir)|' \
+ '|systemgeneratordir=$(systemgeneratordir)|' \
+ '|usergeneratordir=$(usergeneratordir)|' \
+ '|CERTIFICATEROOT=$(CERTIFICATEROOT)|' \
+ '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
+ '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
+ '|PACKAGE_URL=$(PACKAGE_URL)|' \
+ '|RANDOM_SEED_DIR=$(localstatedir)/lib/systemd/|' \
+ '|RANDOM_SEED=$(localstatedir)/lib/systemd/random-seed|' \
+ '|prefix=$(prefix)|' \
+ '|exec_prefix=$(exec_prefix)|' \
+ '|libdir=$(libdir)|' \
+ '|includedir=$(includedir)|' \
+ '|VERSION=$(VERSION)|' \
+ '|rootprefix=$(rootprefix)|' \
+ '|udevlibexecdir=$(udevlibexecdir)|' \
+ '|SUSHELL=$(SUSHELL)|' \
+ '|SULOGIN=$(SULOGIN)|' \
+ '|DEBUGTTY=$(DEBUGTTY)|' \
+ '|KILL=$(KILL)|' \
+ '|KMOD=$(KMOD)|' \
+ '|MOUNT_PATH=$(MOUNT_PATH)|' \
+ '|UMOUNT_PATH=$(UMOUNT_PATH)|' \
+ '|MKDIR_P=$(MKDIR_P)|' \
+ '|QUOTAON=$(QUOTAON)|' \
+ '|QUOTACHECK=$(QUOTACHECK)|' \
+ '|SYSTEM_SYSVINIT_PATH=$(sysvinitdir)|' \
+ '|VARLOGDIR=$(varlogdir)|' \
+ '|RC_LOCAL_SCRIPT_PATH_START=$(RC_LOCAL_SCRIPT_PATH_START)|' \
+ '|RC_LOCAL_SCRIPT_PATH_STOP=$(RC_LOCAL_SCRIPT_PATH_STOP)|' \
+ '|PYTHON=$(PYTHON)|' \
+ '|NTP_SERVERS=$(NTP_SERVERS)|' \
+ '|DNS_SERVERS=$(DNS_SERVERS)|' \
+ '|DEFAULT_DNSSEC_MODE=$(DEFAULT_DNSSEC_MODE)|' \
+ '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \
+ '|systemuidmax=$(SYSTEM_UID_MAX)|' \
+ '|systemgidmax=$(SYSTEM_GID_MAX)|' \
+ '|TTY_GID=$(TTY_GID)|' \
+ '|systemsleepdir=$(systemsleepdir)|' \
+ '|systemshutdowndir=$(systemshutdowndir)|' \
+ '|binfmtdir=$(binfmtdir)|' \
+ '|modulesloaddir=$(modulesloaddir)|'
+
+sd.substitution_keys := $(subst |,,$(shell printf '%s\n' $(sd.substitutions) | cut -d= -f1))
+
+sd.SED_PROCESS = \
+ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
+ $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(sd.substitutions)))) \
+ < $< > $@
diff --git a/build-aux/Makefile.once.head/20-sdman.mk b/build-aux/Makefile.once.head/20-sdman.mk
new file mode 100644
index 0000000000..558c60531d
--- /dev/null
+++ b/build-aux/Makefile.once.head/20-sdman.mk
@@ -0,0 +1,93 @@
+# -*- 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.sdman.description = (systemd) manpages
+mod.sdman.depends += am files write-atomic
+define mod.sdman.doc
+# User variables:
+# - `V`
+# - `AM_V_LN*`
+# - `AM_V_XSLT*`
+# - `LN_S`
+# - `XSLTPROC`
+# Inputs:
+# - Global variable : `ENABLE_MANPAGES`
+# - Global variable : `VERSION`
+# - Directory variable : `files.src.src`
+# Outputs:
+# - File : `$(srcdir)/Makefile-man.mk`
+# - Directory variable : `at.subdirs`
+# - Directory variable : `files.src.gen`
+# - Directory variable : `man_MANS`
+# - Directory variable : `noinst_DATA` (HTML)
+# - Target : `$(outdir)/%.1`
+# - Target : `$(outdir)/%.3`
+# - Target : `$(outdir)/%.5`
+# - Target : `$(outdir)/%.7`
+# - Target : `$(outdir)/%.8`
+# - Target : `$(outdir)/%.html`
+#
+# sdman -> Makefile-man.mk:
+# - Global variable : `sdman.html-alias`
+# Makefile-man.mk -> sdman:
+# - Directory variable : `sdman.MANPAGES`
+# - Directory variable : `sdman.MANPAGES_ALIAS`
+#
+# The `sdman.*` variables are the interface by which the module
+# communicates with the genrated Makefile-man.mk file. They should not
+# be used outside of the `sdman` module.
+endef
+mod.sdman.doc := $(value mod.sdman.doc)
+
+V ?=
+LN_S ?= ln -s
+
+AM_V_LN ?= $(AM_V_LN_$(V))
+AM_V_LN_ ?= $(AM_V_LN_$(AM_DEFAULT_VERBOSITY))
+AM_V_LN_0 ?= @echo " LN " $@;
+AM_V_LN_1 ?=
+
+AM_V_XSLT ?= $(AM_V_XSLT_$(V))
+AM_V_XSLT_ ?= $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
+AM_V_XSLT_0 ?= @echo " XSLT " $@;
+AM_V_XSLT_1 ?=
+
+_sdman.XSLTPROC_FLAGS = \
+ --nonet \
+ --xinclude \
+ --stringparam man.output.quietly 1 \
+ --stringparam funcsynopsis.style ansi \
+ --stringparam man.authors.section.enabled 0 \
+ --stringparam man.copyright.section.enabled 0 \
+ --stringparam systemd.version $(VERSION) \
+ --path '$(outdir):$(srcdir):$(topoutdir)/man:$(topsrcdir)/man'
+
+_sdman.XSLT = $(if $(XSLTPROC), $(XSLTPROC), xsltproc)
+_sdman.XSLTPROC_PROCESS_MAN = \
+ $(AM_V_XSLT)$(_sdman.XSLT) -o $@ $(_sdman.XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
+
+_sdman.XSLTPROC_PROCESS_HTML = \
+ $(AM_V_XSLT)$(_sdman.XSLT) -o $@ $(_sdman.XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
+
+sdman.html-alias = \
+ $(AM_V_LN)$(LN_S) -f $(notdir $<) $@
diff --git a/build-aux/Makefile.once.head/30-am.mk b/build-aux/Makefile.once.head/30-am.mk
new file mode 100644
index 0000000000..3be5e011f8
--- /dev/null
+++ b/build-aux/Makefile.once.head/30-am.mk
@@ -0,0 +1,286 @@
+mod.am.description = (systemd) Automake-to-Autothing magic
+mod.am.depends += gnuconf
+define mod.am.doc
+# Because many of the inputs/outpus are repetative, they are defined
+# here in terms of $$(primary), which may be any of the supported
+# Automake primaries (see below for a table).
+#
+# | Automake 1.15 primaries |
+# +-------------------------+
+# | name | supported |
+# +-------------+-----------+
+# | PROGRAMS | yes |
+# | LIBRARIES | no |
+# | LTLIBRARIES | yes |
+# | LISP | no |
+# | PYTHON | no |
+# | JAVA | no |
+# | SCRIPTS | yes |
+# | DATA | yes |
+# | HEADERS | yes |
+# | MANS | yes |
+# | TEXINFOS | no |
+#
+# Further, there is also $$(dirname), which could be anything; and is
+# detected at runtime by inspecting $$(.VARIABLES) to find every possible
+# matching value. See `_am.primary2dirs` for how this is done.
+#
+# Some inputs are "erased" after the pass they are used in. This means
+# that they are `undefine`ed.
+#
+$(value _am.pass0.doc)
+#
+$(value _am.pass1.doc)
+#
+$(value _am.pass2.doc)
+#
+$(value _am.pass3.doc)
+#
+$(value _am.pass4.doc)
+#
+$(value _am.pass5.doc)
+endef
+
+_am.primaries =
+_am.primaries += PROGRAMS
+#_am.primaries += LIBRARIES
+_am.primaries += LTLIBRARIES
+#_am.primaries += LISP
+#_am.primaries += PYTHON
+#_am.primaries += JAVA
+_am.primaries += SCRIPTS
+_am.primaries += DATA
+_am.primaries += HEADERS
+_am.primaries += MANS
+#_am.primaries += TEXINFOS
+
+# Used by the per_PROGRAM and per_LTLIBRARY passes
+_am.file2var = $(subst -,_,$(subst .,_,$1))
+_am.file2sources = $(addprefix $(srcdir)/,$(notdir $($(_am.file2var)_SOURCES)))
+_am.file2sources += $(addprefix $(outdir)/,$(notdir $(nodist_$(_am.file2var)_SOURCES)))
+_am.file2.o = $(patsubst $(srcdir)/%,$(outdir)/%,$(patsubst %.c,%.o ,$(filter %.c,$(_am.file2sources))))
+_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.pass0.doc
+# == Pass 0: man_MANS ==
+# Erased inputs:
+# - Directory variable: `man_MANS`
+# Outputs:
+# - Directory variable: `man$n_MANS` for $n in `{0..9} n l`
+#
+# Split man_MANS into man$n_MANS
+endef
+define _am.pass0
+man_MANS ?=
+_am.man_MANS := $(man_MANS)
+undefine man_MANS
+man0_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .0,$(suffix $(_am.tmp))),$(_am.tmp)))
+man1_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .1,$(suffix $(_am.tmp))),$(_am.tmp)))
+man2_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .2,$(suffix $(_am.tmp))),$(_am.tmp)))
+man3_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .3,$(suffix $(_am.tmp))),$(_am.tmp)))
+man4_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .4,$(suffix $(_am.tmp))),$(_am.tmp)))
+man5_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .5,$(suffix $(_am.tmp))),$(_am.tmp)))
+man6_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .6,$(suffix $(_am.tmp))),$(_am.tmp)))
+man7_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .7,$(suffix $(_am.tmp))),$(_am.tmp)))
+man8_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .8,$(suffix $(_am.tmp))),$(_am.tmp)))
+man9_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .9,$(suffix $(_am.tmp))),$(_am.tmp)))
+manl_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .l,$(suffix $(_am.tmp))),$(_am.tmp)))
+mann_MANS += $(foreach _am.tmp,$(_am.man_MANS),$(if $(findstring .n,$(suffix $(_am.tmp))),$(_am.tmp)))
+endef
+
+define _am.pass1.doc
+# == Pass 1: _am.per_primary ==
+# Inputs:
+# - Global variable : `am.INSTALL_$(primary)`
+# - Global variable : `am.sys2out_$(primary)`
+# - Global variable : `$(dirname)dir`
+# Erased inputs:
+# - Directory variable : `$(dirname)_$(primary)` [1] [2]
+# - Directory variable : `dist_$(dirname)_$(primary)` [1] [2]
+# - Directory variable : `nodist_$(dirname)_$(primary)` [1] [2]
+# - Directory variable : `noinst_$(primary)` [2]
+# - Directory variable : `check_$(primary)` [2]
+# Outputs:
+# - Directory variable : `am.sys_$(primary)`
+# - Directory variable : `am.out_$(primary)`
+# - Directory variable : `am.check_$(primary)`
+# - Target variable : `am.INSTALL`
+#
+# [1]: HACK: Each of these is first passed through `$(dir ...)`.
+#
+# [2]: HACK: For `am.out_*` each of these are turned into
+# $(DESTDIR)-relative paths (ie, as if for `am.sys_*`), then turned
+# back into $(outdir)-relative paths with `$(call
+# am.sys2out_$(primary),...)`.
+endef
+
+# Default values
+am.INSTALL_PROGRAMS ?= $(INSTALL_PROGRAM) $< $@
+am.INSTALL_SCRIPTS ?= $(INSTALL) $< $@
+am.INSTALL_LTLIBRARIES ?= $(INSTALL) $< $@
+am.INSTALL_DATA ?= $(INSTALL_DATA) $< $@
+am.INSTALL_HEADERS ?= $(INSTALL_DATA) $< $@
+am.INSTALL_MANS ?= $(INSTALL_DATA) $< $@
+$(eval $(foreach p,$(_am.primaries),am.sys2out_$p ?= $$(notdir $$1)$(at.nl)))
+
+# Utility functions
+_am.primary2dirs = $(filter $(patsubst %dir,%,$(filter %dir,$(.VARIABLES))),\
+ $(patsubst nodist_%,%,$(patsubst dist_%,%,$(patsubst %_$1,%,$(filter %_$1,$(.VARIABLES))))))
+
+_am.pass1 = $(eval $(foreach p,$(_am.primaries) ,$(call _am.per_primary,$p)$(at.nl)))
+define _am.per_primary
+# Initialize input variables
+$(foreach d,$(call _am.primary2dirs,$1),\
+ $d_$1 ?=$(at.nl)\
+ dist_$d_$1 ?=$(at.nl)\
+ nodist_$d_$1 ?=$(at.nl))
+noinst_$1 ?=
+check_$1 ?=
+
+# Directory variable outputs
+am.check_$1 := $$(check_$1)
+am.sys_$1 := $(foreach d,$(call _am.primary2dirs,$1),$$(addprefix $$($ddir)/,$$(notdir $$($d_$1) $$(dist_$d_$1) $$(nodist_$d_$1))))
+am.out_$1 := $$(call am.sys2out_$1,$(foreach d,$(call _am.primary2dirs,$1),$$(addprefix $$($ddir)/,$$(notdir $$($d_$1) $$(nodist_$d_$1)))) $$(noinst_$1))
+# ^^^ ^
+# notdir-'|| |
+# addprefix--'| |
+# foreach d---' |
+# am.sys2out------------------'
+
+# Erase appropriate inputs
+$(foreach d,$(call _am.primary2dirs,$1),undefine $d_$1$(at.nl)undefine dist_$d_$1$(at.nl)undefine nodist_$d_$1$(at.nl))
+undefine noinst_$1
+undefine check_$1
+
+# Target variable outputs
+$$(addprefix $$(DESTDIR),$$(am.sys_$1)): private am.INSTALL = $$(am.INSTALL_$1)
+endef
+
+define _am.pass2.doc
+# == Pass 2: _am.per_PROGRAM ==
+# Inputs:
+# - Directory variable : `am.out_PROGRAMS`
+# Erased inputs:
+# - Directory variable : `$(program)_SOURCES`
+# - Directory variable : `nodist_$(program)_SOURCES`
+# - Directory variable : `$(program)_CFLAGS`
+# - Directory variable : `$(program)_CPPFLAGS`
+# - Directory variable : `$(program)_LDFLAGS`
+# - Directory variable : `$(program)_LDADD`
+# Outputs:
+# - Directory variable : `am.CPPFLAGS`
+# - Directory variable : `am.CFLAGS`
+# - Target dependencies: `$(outdir)/$(program)`
+# - Target variable : `$(outdir)/$(program): am.LDFLAGS`
+# - Directory variable : `am.subdirs`
+#
+# TODO: I'm not in love with how it figures out `am.subdirs`.
+# TODO: I'm not in love with how it does the `install` dependencies.
+endef
+_am.pass2 = $(eval $(foreach f,$(am.out_PROGRAMS) ,$(call _am.per_PROGRAM,$f,$(call _am.file2var,$f))$(at.nl)))
+_am.var_PROGRAMS = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LDADD
+# $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 am.LDFLAGS := $$($2_LDFLAGS)
+$$(outdir)/$1: $$(_am.depends)
+$$(outdir)/install: $$(addsuffix install,$$(dir $$(filter %.la,$$(_am.depends))))
+am.subdirs := $$(sort $$(am.subdirs)\
+ $$(filter-out $$(abspath $$(srcdir)),\
+ $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends))))))
+am.CPPFLAGS := $$(am.CPPFLAGS)
+am.CFLAGS := $$(am.CFLAGS)
+$(foreach var,_am.depends $(call _am.var_PROGRAMS,$2),undefine $(var)$(at.nl))
+endef
+
+define _am.pass3.doc
+# == Pass 3: _am.per_LTLIBRARY ==
+# Inputs:
+# - Directory variable : `am.out_LTLIBRARIES`
+# Erased inputs:
+# - Directory variable : `$(library)_SOURCES`
+# - Directory variable : `nodist_$(library)_SOURCES`
+# - Directory variable : `$(library)_CFLAGS`
+# - Directory variable : `$(library)_CPPFLAGS`
+# - Directory variable : `$(library)_LDFLAGS`
+# - Directory variable : `$(library)_LIBADD`
+# Outputs:
+# - Directory variable : `am.CPPFLAGS`
+# - Directory variable : `am.CFLAGS`
+# - Target dependencies: `$(outdir)/$(library)`
+# - Target variable : `$(outdir)/$(library): am.LDFLAGS`
+# - Directory variable : `am.subdirs`
+#
+# TODO: I'm not in love with how it figures out `am.subdirs`.
+# TODO: I'm not in love with how it does the `install` dependencies.
+endef
+_am.pass3 = $(eval $(foreach f,$(am.out_LTLIBRARIES),$(call _am.per_LTLIBRARY,$f,$(call _am.file2var,$f))$(at.nl)))
+_am.var_LTLIBRARIES = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LIBADD
+# $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 am.LDFLAGS := $$($2_LDFLAGS)
+$$(outdir)/$1: $$(_am.depends)
+$$(outdir)/install: $$(addsuffix install,$$(dir $$(filter %.la,$$(_am.depends))))
+am.subdirs := $$(sort $$(am.subdirs)\
+ $$(filter-out $$(abspath $$(srcdir)),\
+ $$(abspath $$(dir $$(filter-out -l% /%,$$(_am.depends))))))
+am.CPPFLAGS := $$(am.CPPFLAGS)
+am.CFLAGS := $$(am.CFLAGS)
+$(foreach var,_am.depends $(call _am.var_LTLIBRARIES,$2),undefine $(var)$(at.nl))
+endef
+
+define _am.pass4.doc
+# == Pass 4: Install rules / _am.per_directory ==
+# Inputs:
+# - Directory variable : `am.sys_$(primary)`
+# Outputs:
+# - Target : `$(DESTDIR)/$($(dirname)dir)/%`
+#
+# Creates simple `install` rules. You will need to define your own rules if
+# `am.sys2out_$(primary)` changed the notdir part of the filename.
+endef
+
+# Utility functions
+_am.sys2dirs = $(sort $(patsubst %/,%,$(dir $(foreach p,$(_am.primaries),$(am.sys_$p)))))
+
+_am.pass4 = $(eval $(foreach d,$(_am.sys2dirs) ,$(call _am.per_directory,$d)$(at.nl)))
+define _am.per_directory
+$$(DESTDIR)$1/%: $$(outdir)/%
+ @$$(NORMAL_INSTALL)
+ $$(am.INSTALL)
+$$(DESTDIR)$1/%: $$(srcdir)/%
+ @$$(NORMAL_INSTALL)
+ $$(am.INSTALL)
+endef
+
+mod.am.depends += files
+define _am.pass5.doc
+# == Pass 5: export ==
+# Inputs:
+# - Directory variable : `am.subdirs`
+# - Directory variable : `am.sys_$(primary)`
+# - Directory variable : `am.out_$(primary)`
+# - Directory variable : `am.check_$(primary)`
+# Outputs:
+# - Directory variable : `at.subdirs`
+# - Directory variable : `files.sys.all`
+# - Directory variable : `files.out.all`
+# - Directory variable : `files.out.check`
+endef
+define _am.pass5
+at.subdirs += $(am.subdirs)
+files.sys.all += $(foreach p,$(_am.primaries),$(am.sys_$p))
+files.out.all += $(foreach p,$(_am.primaries),$(am.out_$p))
+files.out.check += $(foreach p,$(_am.primaries),$(am.check_$p))
+endef
diff --git a/build-aux/Makefile.once.tail/10-sd.mk b/build-aux/Makefile.once.tail/10-sd.mk
new file mode 100644
index 0000000000..66ff8d3a09
--- /dev/null
+++ b/build-aux/Makefile.once.tail/10-sd.mk
@@ -0,0 +1,112 @@
+# -*- 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/>.
+
+_sd.autogen_files = aclocal.m4 automake.mk.in config.h.in configure po/Makefile.in.in
+# `$*`/`%` had better be $(topsrcdir), but we can't enforce that
+$(addprefix %/,$(_sd.autogen_files)): %/configure.ac %/autogen.sh
+ cd $(topsrcdir) && ./autogen.sh
+
+config_files = config.mk automake.mk autoconf.mk gnustandards.mk po/Makefile.in
+config_headers = config.h
+config_commands = depfiles libtool po/stamp-it
+$(topoutdir)/config.status: $(topsrcdir)/configure
+ cd $(topoutdir) && ./config.status --recheck
+$(addprefix $(topoutdir)/,$(config_files)): $(topoutdir)/%: $(topoutdir)/config.status $(topsrcdir)/%.in
+ cd $(topoutdir) && ./config.status --file=$*
+$(addprefix $(topoutdir)/,$(config_headers)): $(topoutdir)/%: $(topoutdir)/%.stamp
+$(foreach f,$(config_headers),$(topoutdir)/$f.stamp): $(topoutdir)/%.stamp: $(topoutdir)/config.status $(topsrcdir)/%.in
+ cd $(topoutdir) && ./config.status --header=$*
+ test -f $(topoutdir)/$*
+ touch $@
+
+# Let's run all tests of the test suite, but under valgrind. Let's
+# exclude perl/python/shell scripts we have in there
+.PHONY: valgrind-tests
+valgrind-tests: $(TESTS)
+ $(AM_V_GEN)for f in $(filter-out %.pl %.py, $^); do \
+ if $(LIBTOOL) --mode=execute file $$f | grep -q shell; then \
+ echo -e "$${x}Skipping non-binary $$f"; else \
+ echo -e "$${x}Running $$f"; \
+ $(LIBTOOL) --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
+ x="\n\n"; \
+ done
+
+# exported-%: %
+# $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@
+
+# exported: $(addprefix exported-, $(lib_LTLIBRARIES))
+# $(AM_V_GEN)sort -u $^ > $@
+
+# .PHONY: check-api-docs
+# check-api-docs: exported man
+# $(AM_V_GEN)for symbol in `cat exported` ; do \
+# if test -f $(builddir)/man/$$symbol.html ; then \
+# echo " Symbol $$symbol() is documented." ; \
+# else \
+# echo "‣ Symbol $$symbol() lacks documentation." ; \
+# fi ; \
+# done
+
+OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
+ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
+
+undefined defined: $(ALL_OBJECTS)
+ $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \
+ $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \
+ done | cut -c 20- | cut -d @ -f 1 | sort -u > $@
+
+CLEANFILES += \
+ defined \
+ undefined
+
+.PHONY: check-api-unused
+check-api-unused: defined undefined exported
+ ( cat exported undefined ) | sort -u | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
+
+.PHONY: check-includes
+check-includes: $(top_srcdir)/tools/check-includes.pl
+ $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \
+ | xargs $(top_srcdir)/tools/check-includes.pl
+
+EXTRA_DIST += \
+ $(top_srcdir)/tools/check-includes.pl
+
+.PHONY: cppcheck
+cppcheck:
+ cppcheck --enable=all -q $(top_srcdir)
+
+# Used to extract compile flags for YCM.
+print-%:
+ @echo $($*)
+
+git-contrib:
+ @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | sed 's/ / /g' | awk '{ print $$0 "," }' | sort -u
+
+EXTRA_DIST += \
+ tools/gdb-sd_dump_hashmaps.py
+
+list-keys:
+ gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys
+
+add-key:
+ gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import -