summaryrefslogtreecommitdiff
path: root/build-aux/Makefile.once.head
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/Makefile.once.head')
-rw-r--r--build-aux/Makefile.once.head/00-write-ifchanged.mk1
-rw-r--r--build-aux/Makefile.once.head/10-dist.mk (renamed from build-aux/Makefile.once.head/00-dist.mk)10
-rw-r--r--build-aux/Makefile.once.head/10-files.mk (renamed from build-aux/Makefile.once.head/10-std.mk)26
-rw-r--r--build-aux/Makefile.once.head/10-gnuconf.mk (renamed from build-aux/Makefile.once.head/00-gnuconf.mk)56
-rw-r--r--build-aux/Makefile.once.head/10-lt.mk12
-rw-r--r--build-aux/Makefile.once.head/10-nested.mk18
-rw-r--r--build-aux/Makefile.once.head/10-write-ifchanged.mk3
-rw-r--r--build-aux/Makefile.once.head/20-sd.mk217
-rw-r--r--build-aux/Makefile.once.head/20-systemd.mk220
-rw-r--r--build-aux/Makefile.once.head/30-am.mk28
-rw-r--r--build-aux/Makefile.once.head/30-automake2autothing.mk11
-rw-r--r--build-aux/Makefile.once.head/zz-mod.mk24
12 files changed, 360 insertions, 266 deletions
diff --git a/build-aux/Makefile.once.head/00-write-ifchanged.mk b/build-aux/Makefile.once.head/00-write-ifchanged.mk
deleted file mode 100644
index 79ef1c419c..0000000000
--- a/build-aux/Makefile.once.head/00-write-ifchanged.mk
+++ /dev/null
@@ -1 +0,0 @@
-WRITE_IFCHANGED = $(topsrcdir)/build-aux/write-ifchanged
diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/10-dist.mk
index 4326cde72a..0e13ea2e28 100644
--- a/build-aux/Makefile.once.head/00-dist.mk
+++ b/build-aux/Makefile.once.head/10-dist.mk
@@ -13,6 +13,8 @@
# 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/>.
+mod.dist.description = Make distribution tarballs
+
# Developer configuration
dist.exts ?= .tar.gz
@@ -20,10 +22,10 @@ dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))
dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION))
ifeq ($(dist.pkgname),)
-$(error dist.pkgname must be set)
+$(error Autothing module: dist: dist.pkgname must be set)
endif
ifeq ($(dist.version),)
-$(error dist.version must be set)
+$(error Autothing module: dist: dist.version must be set)
endif
# User configuration
@@ -38,7 +40,3 @@ TAR ?= tar
GZIPFLAGS ?= $(GZIP_ENV)
GZIP_ENV ?= --best
-
-# Implementation
-
-at.phony += dist
diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-files.mk
index 3e058eca57..56e06acc34 100644
--- a/build-aux/Makefile.once.head/10-std.mk
+++ b/build-aux/Makefile.once.head/10-files.mk
@@ -13,27 +13,25 @@
# 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/>.
-# Declare the default target
-all: build
-.PHONY: all noop
+mod.files.description = Keeping track of groups of files
+mod.files.depends += nested
+
+files.groups ?= all
+files.default ?= all
+files.vcsclean ?= files.vcsclean
+files.generate ?= files.generate
+
+.DEFAULT_GOAL = $(files.default_group)
# Standard creative PHONY targets
-at.phony += build install installdirs
+nested.targets += $(foreach g,$(files.groups), $g install-$g install-$gdirs)
# Standard destructive PHONY targets
-at.phony += uninstall mostlyclean clean distclean maintainer-clean
-
-at.dirlocal += std.src_files
-at.dirlocal += std.gen_files
-at.dirlocal += std.cfg_files
-at.dirlocal += std.out_files
-at.dirlocal += std.sys_files
-at.dirlocal += std.clean_files
-at.dirlocal += std.slow_files
+nested.targets += uninstall mostlyclean clean distclean maintainer-clean
# User configuration
DESTDIR ?=
RM ?= rm -f
-RMDIR_P ?= rmdir -p
+RMDIR_P ?= rmdir -p --ignore-fail-on-non-empty
TRUE ?= true
diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/10-gnuconf.mk
index 83cb110c59..c07cfb5cf3 100644
--- a/build-aux/Makefile.once.head/00-gnuconf.mk
+++ b/build-aux/Makefile.once.head/10-gnuconf.mk
@@ -14,11 +14,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is based on §7.2 "Makefile Conventions" of the release of
-# the GNU Coding Standards dated April 13, 2016.
+# the GNU Coding Standards dated July 25, 2016.
+
+mod.gnuconf.description = GNU standard configuration variables
gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))
ifeq ($(gnuconf.pkgname),)
-$(error gnuconf.pkgname must be set)
+$(error Autothing module: gnuconf: gnuconf.pkgname must be set)
endif
# 7.2.2: Utilities in Makefiles
@@ -54,43 +56,69 @@ TOUCH ?= touch
TR ?= tr
TRUE ?= true
-# These must be user-configurable
+# 7.2.2: Utilities in Makefiles/7.2.3: Variables for Specifying Commands
+# ----------------------------------------------------------------------
+
+# Standard user-configurable programs.
+#
+# The list of programs here is specified in §7.2.2, but the associated FLAGS
+# variables are specified in §7.2.3. I found it cleaner to list them together.
AR ?= ar
ARFLAGS ?=
BISON ?= bison
BISONFLAGS ?=
CC ?= cc
-CCFLAGS ?= $(CFLAGS)
+CFLAGS ?= # CFLAGS instead of CCFLAGS
FLEX ?= flex
FLEXFLAGS ?=
INSTALL ?= install
-#INSTALLFLAGS ?=
+# There is no INSTALLFLAGS[0]
LD ?= ld
LDFLAGS ?=
-LDCONFIG ?= ldconfig #TODO
+LDCONFIG ?= ldconfig # TODO[1]
LDCONFIGFLAGS ?=
LEX ?= lex
-LEXFLAGS ?= $(LFLAGS)
+LFLAGS ?= # LFLAGS instead of LEXFLAGS
#MAKE
MAKEINFO ?= makeinfo
MAKEINFOFLAGS ?=
-RANLIB ?= ranlib #TODO
+RANLIB ?= ranlib # TODO[1]
RANLIBFLAGS ?=
TEXI2DVI ?= texi2dvi
TEXI2DVIFLAGS ?=
YACC ?= yacc
-YACCFLAGS ?= $(YFLAGS)
+YFLAGS ?= # YFLAGS instead of YACCFLAGS
-CFLAGS ?=
-LFLAGS ?=
-YFLAGS ?=
-
-LN_S ?= ln -s #TODO
+LN_S ?= ln -s # TODO[2]
CHGRP ?= chgrp
+CHGRPFLAGS ?=
CHMOD ?= chmod
+CHMODFLAGS ?=
CHOWN ?= chown
+CHOWNFLAGS ?=
MKNOD ?= mknod
+MKNODFLAGS ?=
+
+# [0]: There is no INSTALLFLAGS because it would be inconsistent with how the
+# standards otherwise recommend using $(INSTALL); with INSTALL_PROGRAM and
+# INSTALL_DATA; which are specified in a way precluding the use of
+# INSTALLFLAGS. To have the variable, but to ignore it in the common case
+# would be confusing.
+#
+# [1]: The RANLIB and LDCONFIG variables need some extra smarts; §7.2.2 says:
+#
+# > When you use ranlib or ldconfig, you should make sure nothing bad
+# > happens if the system does not have the program in question. Arrange
+# > to ignore an error from that command, and print a message before the
+# > command to tell the user that failure of this command does not mean a
+# > problem. (The Autoconf ‘AC_PROG_RANLIB’ macro can help with this.)
+#
+# [2]: The LN_S variable isn't standard, but we have it here as an (incomplete)
+# stub to help support this bit of §7.2.2:
+#
+# > If you use symbolic links, you should implement a fallback for
+# > systems that don’t have symbolic links.
# 7.2.3: Variables for Specifying Commands
# ----------------------------------------
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..c8410d4e38
--- /dev/null
+++ b/build-aux/Makefile.once.head/10-lt.mk
@@ -0,0 +1,12 @@
+mod.lt.description = Easy handling of libtool dependencies
+mod.lt.deps += files
+
+_lt.dups = $(sort $(foreach l,$1,$(if $(filter-out 1,$(words $(filter $l,$1))),$l)))
+_lt.patsubst-all = $(if $1,$(call _sd.patsubst-all,$(wordlist 2,$(words $1),$1),$2,$(patsubst $(firstword $1),$2,$3)),$3)
+_lt.unLIBPATTERNS = $(foreach _lt.tmp,$1,$(if $(filter $(.LIBPATTERNS),$(_lt.tmp)),$(call _lt.patsubst-all,$(.LIBPATTERNS),-l%,$(_lt.tmp)),$(_lt.tmp)))
+
+# The semantics for the de-dup bit are a bit weird. My head hurts thinking
+# about them. TODO: clarify/simplify/something
+lt.rpath = $(dir $(patsubst $(DESTDIR)%,%,$(filter %/$(@F),$(files.sys))))
+_lt.link_files = $(filter %.o %.lo %.la -l%,$(call _lt.unLIBPATTERNS$,$^))
+lt.link_files = $(filter-out $(call _lt.dups,$(_lt.link_files)),$(_lt.link_files))
diff --git a/build-aux/Makefile.once.head/10-nested.mk b/build-aux/Makefile.once.head/10-nested.mk
new file mode 100644
index 0000000000..af9fdf7d8a
--- /dev/null
+++ b/build-aux/Makefile.once.head/10-nested.mk
@@ -0,0 +1,18 @@
+# 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/>.
+
+mod.nested.description = Easy nested .PHONY targets
+
+nested.targets ?=
diff --git a/build-aux/Makefile.once.head/10-write-ifchanged.mk b/build-aux/Makefile.once.head/10-write-ifchanged.mk
new file mode 100644
index 0000000000..7917201159
--- /dev/null
+++ b/build-aux/Makefile.once.head/10-write-ifchanged.mk
@@ -0,0 +1,3 @@
+mod.write-ifchanged.description = build-aux/write-ifchanged helper script
+
+WRITE_IFCHANGED ?= $(topsrcdir)/build-aux/write-ifchanged
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..c8462f285c
--- /dev/null
+++ b/build-aux/Makefile.once.head/20-sd.mk
@@ -0,0 +1,217 @@
+# -*- 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 build rules
+mod.sd.depends += am
+
+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 = $(OUR_CFLAGS) $(am.CFLAGS) $(sd.CFLAGS) $(CFLAGS)
+sd.ALL_CPPFLAGS = $(OUR_CPPFLAGS) $(am.CPPFLAGS) $(sd.CPPFLAGS) $(CPPFLAGS)
+sd.ALL_LDFLAGS = $(OUR_LDFLAGS) $(am.LDFLAGS) $(sd.LDFLAGS) $(LDFLAGS)
+sd.ALL_LIBTOOLFLAGS = $(OUR_LIBTOOLFLAGS) $(am.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 $@
+
+am.INSTALL_PROGRAM = $(AM_V_PROG)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $< $@
+am.INSTALL_SCRIPT = $(AM_V_SCRIPT)$(INSTALL_SCRIPT) $< $@
+am.INSTALL_LTLIBRARY = $(AM_V_LIB)$(LIBTOOL) $(AM_V_lt) --tag=CC $(sd.ALL_LIBTOOLFLAGS) --mode=install $(INSTALL) $< $@
+am.INSTALL_DATA = $(AM_V_DATA)$(INSTALL_DATA) $< $@
+
+CC ?= c99
+CCLD ?= c99
+LIBTOOL ?= libtool
+
+V ?=
+
+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_XSLT ?= $(AM_V_XSLT_$(V))
+AM_V_XSLT_ ?= $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
+AM_V_XSLT_0 ?= @echo " XSLT " $@;
+AM_V_XSLT_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_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_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_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_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_at ?= $(AM_V_at_$(V))
+AM_V_at_ ?= $(AM_V_at_$(AM_DEFAULT_VERBOSITY))
+AM_V_at_0 ?= @
+AM_V_at_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.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-systemd.mk b/build-aux/Makefile.once.head/20-systemd.mk
deleted file mode 100644
index 04627a9497..0000000000
--- a/build-aux/Makefile.once.head/20-systemd.mk
+++ /dev/null
@@ -1,220 +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/>.
-
-TESTS ?=
-
-
-SHELL = bash -o pipefail
-
-OUR_CPPFLAGS += -MT $@ -MD -MP -MF $(@D)/$(DEPDIR)/$(basename $(@F)).P$(patsubst .%,%,$(suffix $(@F)))
-OUR_CPPFLAGS += -include $(topoutdir)/config.h
-OUR_CPPFLAGS += $(sort $(if $(<D),-I$(<D)) \
- $(if $(filter $(abspath $(topoutdir))/%,$(abspath $<)),-I$(call at.path,$(dir $(patsubst $(abspath $(topoutdir))/%,$(abspath $(topsrcdir))/%,$(abspath $<))))) \
- -I$(@D) )
-
-at.dirlocal += systemd.CFLAGS systemd.CPPFLAGS systemd.LDFLAGS systemd.LIBTOOLFLAGS
-ALL_CFLAGS = $(OUR_CFLAGS) $(am.CFLAGS/$(@D)) $(systemd.CFLAGS/$(@D)) $(CFLAGS)
-ALL_CPPFLAGS = $(OUR_CPPFLAGS) $(am.CPPFLAGS/$(@D)) $(systemd.CPPFLAGS/$(@D)) $(CPPFLAGS)
-ALL_LDFLAGS = $(OUR_LDFLAGS) $(am.LDFLAGS/$(@D)) $(systemd.LDFLAGS/$(@D)) $(LDFLAGS)
-ALL_LIBTOOLFLAGS = $(OUR_LIBTOOLFLAGS) $(am.LIBTOOLFLAGS/$(@D)) $(systemd.LIBTOOLFLAGS/$(@D)) $(LIBTOOLFLAGS)
-
-SYS_CFLAGS = $(OUR_CFLAGS) $(am.CFLAGS/$(<D)) $(systemd.CFLAGS/$(<D)) $(CFLAGS)
-SYS_CPPFLAGS = $(OUR_CPPFLAGS) $(am.CPPFLAGS/$(<D)) $(systemd.CPPFLAGS/$(<D)) $(CPPFLAGS)
-SYS_LDFLAGS = $(OUR_LDFLAGS) $(am.LDFLAGS/$(<D)) $(systemd.LDFLAGS/$(<D)) $(LDFLAGS)
-SYS_LIBTOOLFLAGS = $(OUR_LIBTOOLFLAGS) $(am.LIBTOOLFLAGS/$(<D)) $(systemd.LIBTOOLFLAGS/$(<D)) $(LIBTOOLFLAGS)
-
-COMPILE = $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS)
-LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(ALL_LIBTOOLFLAGS) --mode=compile $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS)
-LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(ALL_LIBTOOLFLAGS) --mode=link $(CCLD) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@
-
-.DELETE_ON_ERROR:
-.SECONDARY:
-
-V ?=
-
-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_XSLT = $(AM_V_XSLT_$(V))
-AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
-AM_V_XSLT_0 = @echo " XSLT " $@;
-AM_V_XSLT_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_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_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_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_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_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_at = $(AM_V_at_$(V))
-AM_V_at_ = $(AM_V_at_$(AM_DEFAULT_VERBOSITY))
-AM_V_at_0 = @
-AM_V_at_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 =
-
-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)|'
-
-SED_PROCESS = \
- $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
- $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
- < $< > $@
-
-# Stupid test that everything purported to be exported really is
-define generate-sym-test
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_at)printf '#include <stdio.h>\n' > $@
- $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@
- $(AM_V_at)printf 'void* functions[] = {\n' >> $@
- $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@
- $(AM_V_at)printf '};\nint main(void) {\n' >> $@
- $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@
- $(AM_V_at)printf 'return 0; }\n' >> $@
-endef
-
-at.dirlocal += systemd.sed_files
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..9049f2c88a
--- /dev/null
+++ b/build-aux/Makefile.once.head/30-am.mk
@@ -0,0 +1,28 @@
+mod.am.description = Support for Automake variables (systemd specific)
+mod.am.depends += gnuconf
+
+am.inst2noinst_DATA = $(notdir \
+ $(patsubst $(sysusersdir)/%.conf,%.sysusers,\
+ $(patsubst $(sysctldir)/%.conf,%.sysctl,\
+ $1)))
+am.var_PROGRAMS = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LDADD
+am.var_LTLIBRARIES = $1_SOURCES nodist_$1_SOURCES $1_CFLAGS $1_CPPFLAGS $1_LDFLAGS $1_LIBADD
+
+am.INSTALL_PROGRAM ?= $(INSTALL_PROGRAM) $< $@
+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)))
+
+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) , ))
diff --git a/build-aux/Makefile.once.head/30-automake2autothing.mk b/build-aux/Makefile.once.head/30-automake2autothing.mk
deleted file mode 100644
index ee21fba45a..0000000000
--- a/build-aux/Makefile.once.head/30-automake2autothing.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-am.bindirs = bin rootbin libexec rootlibexec systemgenerator udevlibexec
-at.dirlocal += am.CFLAGS am.CPPFLAGS am.LDFLAGS am.LIBTOOLFLAGS
-at.dirlocal += noinst_LTLIBRARIES lib_LTLIBRARIES
-at.dirlocal += $(addsuffix _PROGRAMS,noinst $(am.bindirs))
-at.dirlocal += pkgconfiglib_DATA
-automake_name = $(subst -,_,$(subst .,_,$1))
-automake_sources = $(addprefix $(outdir)/,$(notdir $($(automake_name)_SOURCES) $(nodist_$(automake_name)_SOURCES)))
-automake_lo = $(patsubst %.c,%.lo,$(filter %.c,$(automake_sources)))
-automake_o = $(patsubst %.c,%.o,$(filter %.c,$(automake_sources)))
-automake_lib = $(foreach l, $($(automake_name)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).DEPENDS) , $l ))
-automake_cpp = $(foreach l,$1 $($(automake_name)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).CPPFLAGS) , ))
diff --git a/build-aux/Makefile.once.head/zz-mod.mk b/build-aux/Makefile.once.head/zz-mod.mk
new file mode 100644
index 0000000000..3bf6398e13
--- /dev/null
+++ b/build-aux/Makefile.once.head/zz-mod.mk
@@ -0,0 +1,24 @@
+# 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/>.
+
+mod.mod.description = Print information about Autothing modules
+
+_mod.target = at-mod-info
+_mod.modules := $(sort $(patsubst %.mk,%,$(filter %.mk,$(subst -, ,$(notdir $(wildcard $(topsrcdir)/build-aux/Makefile.*/??-*.mk))))))
+_mod.quote = '$(subst ','\'',$1)'
+
+_mod.vars = $(filter $(addsuffix .%,$(_mod.modules)),$(.VARIABLES))
+_mod.once := $(_mod.vars)
+_mod.each :=