summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile48
-rw-r--r--autoconf.mk.in41
-rw-r--r--automake.mk.am0
-rw-r--r--build-aux/Makefile.README.txt164
-rw-r--r--build-aux/Makefile.each.head/00-dist.mk20
-rw-r--r--build-aux/Makefile.each.tail/10-std.mk46
-rw-r--r--build-aux/Makefile.each.tail/20-systemd.mk78
-rw-r--r--build-aux/Makefile.each.tail/30-automake2autothing.mk35
-rw-r--r--build-aux/Makefile.each.tail/30-directory-info.mk4
-rw-r--r--build-aux/Makefile.head.mk71
-rw-r--r--build-aux/Makefile.once.head/00-dist.mk44
-rw-r--r--build-aux/Makefile.once.head/00-gnuconf.mk160
-rw-r--r--build-aux/Makefile.once.head/00-write-ifchanged.mk1
-rw-r--r--build-aux/Makefile.once.head/10-std.mk39
-rw-r--r--build-aux/Makefile.once.head/20-systemd.mk64
-rw-r--r--build-aux/Makefile.once.head/30-automake2autothing.mk11
-rw-r--r--build-aux/Makefile.once.tail/00-dist.mk27
-rw-r--r--build-aux/Makefile.once.tail/20-systemd.mk19
-rw-r--r--build-aux/Makefile.tail.mk52
-rw-r--r--build-aux/no-builtin-variables.mk15
-rwxr-xr-xbuild-aux/write-ifchanged25
-rw-r--r--config.mk.in301
-rw-r--r--configure.ac29
-rw-r--r--gnustandards.mk.in138
-rw-r--r--src/Makefile65
-rw-r--r--src/busctl/busctl.c8
-rw-r--r--src/grp-boot/bootctl/Makefile1
-rw-r--r--src/grp-boot/systemd-boot/Makefile90
-rw-r--r--src/grp-coredump/coredumpctl/coredumpctl.c4
-rw-r--r--src/grp-coredump/systemd-coredump/Makefile3
-rw-r--r--src/grp-coredump/systemd-coredump/coredump.c2
-rw-r--r--src/grp-helperunits/systemd-quotacheck/Makefile2
-rw-r--r--src/grp-helperunits/systemd-random-seed/Makefile3
-rw-r--r--src/grp-helperunits/systemd-sleep/Makefile2
-rw-r--r--src/grp-journal/libjournal-core/journald-server.h2
-rw-r--r--src/grp-machine/Makefile1
-rw-r--r--src/grp-resolve/nss-resolve/nss-resolve.c2
-rw-r--r--src/grp-resolve/systemd-resolved/Makefile13
l---------src/grp-resolve/systemd-resolved/gcrypt-util.c1
l---------src/grp-resolve/systemd-resolved/gcrypt-util.h1
-rw-r--r--src/grp-resolve/systemd-resolved/resolve-tool.c2
-rw-r--r--src/grp-resolve/systemd-resolved/resolved-bus.c2
-rw-r--r--src/grp-resolve/systemd-resolved/resolved-dns-query.c2
-rw-r--r--src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c2
-rw-r--r--src/grp-resolve/systemd-resolved/resolved-manager.c1
-rw-r--r--src/grp-timedate/systemd-timedated/timedated.c4
-rw-r--r--src/grp-timedate/timedatectl/Makefile1
-rw-r--r--src/grp-timedate/timedatectl/timedatectl.c2
-rw-r--r--src/grp-udev/Makefile3
-rw-r--r--src/grp-udev/libudev-core/Makefile10
l---------src/grp-udev/libudev-core/logind-acl.c1
l---------src/grp-udev/libudev-core/logind-acl.h1
-rw-r--r--src/grp-udev/libudev-core/net/Makefile30
-rw-r--r--src/grp-udev/libudev-core/net/link-config.c2
l---------src/grp-udev/libudev-core/sd-login.c1
-rw-r--r--src/grp-udev/libudev-core/udev-builtin-hwdb.c2
-rw-r--r--src/grp-udev/libudev-core/udev-builtin-net_setup_link.c2
-rw-r--r--src/grp-udev/libudev-core/udev-event.c2
-rw-r--r--src/grp-udev/mtd_probe/Makefile2
-rw-r--r--src/grp-udev/systemd-udevd/udevd.c1
-rw-r--r--src/grp-udev/udevadm/Makefile2
-rw-r--r--src/grp-udev/udevadm/udevadm-hwdb.c4
-rw-r--r--src/libbasic/Makefile9
-rw-r--r--src/libcore/Makefile9
-rw-r--r--src/libcore/automount.c2
-rw-r--r--src/libcore/bus-policy.c4
-rw-r--r--src/libcore/bus-policy.h2
-rw-r--r--src/libcore/busname.c6
-rw-r--r--src/libcore/dbus-manager.c2
-rw-r--r--src/libcore/dbus-scope.c4
-rw-r--r--src/libcore/dbus-unit.c2
-rw-r--r--src/libcore/dbus.c6
-rw-r--r--src/libcore/failure-action.c2
-rw-r--r--src/libcore/load-fragment.c4
-rw-r--r--src/libcore/loopback-setup.c1
-rw-r--r--src/libcore/manager.c6
-rw-r--r--src/libcore/path.c2
-rw-r--r--src/libcore/service.c4
-rw-r--r--src/libcore/socket.c2
-rw-r--r--src/libcore/timer.c2
-rw-r--r--src/libcore/transaction.c4
-rw-r--r--src/libcore/unit.c2
-rw-r--r--src/libfirewall/Makefile2
-rw-r--r--src/libshared/Makefile18
-rw-r--r--src/libshared/bus-unit-util.c2
-rw-r--r--src/libshared/bus-util.c4
-rw-r--r--src/libshared/logs-show.c2
-rw-r--r--src/libsystemd-network/Makefile3
-rw-r--r--src/libsystemd/Makefile8
-rw-r--r--src/libsystemd/src/Makefile19
l---------src/libsystemd/src/sd-bus/Makefile1
l---------src/libsystemd/src/sd-daemon/Makefile1
l---------src/libsystemd/src/sd-device/Makefile1
l---------src/libsystemd/src/sd-event/Makefile1
l---------src/libsystemd/src/sd-hwdb/Makefile1
l---------src/libsystemd/src/sd-id128/Makefile1
-rw-r--r--src/libsystemd/src/sd-journal/Makefile15
l---------src/libsystemd/src/sd-journal/gcrypt-util.c1
l---------src/libsystemd/src/sd-journal/gcrypt-util.h1
l---------src/libsystemd/src/sd-login/Makefile1
l---------src/libsystemd/src/sd-netlink/Makefile1
-rw-r--r--src/libsystemd/src/sd-netlink/local-addresses.c1
l---------src/libsystemd/src/sd-network/Makefile1
l---------src/libsystemd/src/sd-path/Makefile1
l---------src/libsystemd/src/sd-resolve/Makefile1
l---------src/libsystemd/src/sd-utf8/Makefile1
-rw-r--r--src/libsystemd/src/subdir.mk7
-rw-r--r--src/libudev/src/Makefile8
-rw-r--r--src/libudev/src/libudev-device-private.c2
-rw-r--r--src/libudev/src/libudev-device.c4
-rw-r--r--src/libudev/src/libudev-enumerate.c4
-rw-r--r--src/libudev/src/libudev-hwdb.c2
-rw-r--r--src/nss-myhostname/Makefile2
-rw-r--r--src/nss-myhostname/nss-myhostname.c2
-rw-r--r--src/systemd-analyze/analyze-verify.c2
-rw-r--r--src/systemd-analyze/analyze.c2
-rw-r--r--src/systemd-cgls/cgls.c2
-rw-r--r--src/systemd-cgtop/cgtop.c2
-rw-r--r--src/systemd-cryptsetup/Makefile2
-rw-r--r--src/systemd-cryptsetup/cryptsetup.c2
-rw-r--r--src/systemd-dbus1-generator/Makefile3
-rw-r--r--src/systemd-dbus1-generator/dbus1-generator.c2
-rw-r--r--src/systemd-debug-generator/Makefile2
-rw-r--r--src/systemd-fsck/fsck.c6
l---------src/systemd-fstab-generator/mount-setup.c1
l---------src/systemd-fstab-generator/mount-setup.h1
-rw-r--r--src/systemd-getty-generator/Makefile2
-rw-r--r--src/systemd-gpt-auto-generator/Makefile2
-rw-r--r--src/systemd-hibernate-resume/Makefile2
-rw-r--r--src/systemd-hwdb/Makefile2
-rw-r--r--src/systemd-hwdb/hwdb.c4
-rw-r--r--src/systemd-initctl/initctl.c2
l---------src/systemd-machine-id-setup/machine-id-setup.c1
l---------src/systemd-machine-id-setup/machine-id-setup.h1
-rw-r--r--src/systemd-nspawn/Makefile2
l---------src/systemd-nspawn/loopback-setup.c1
l---------src/systemd-nspawn/loopback-setup.h1
l---------src/systemd-nspawn/machine-id-setup.c1
l---------src/systemd-nspawn/machine-id-setup.h1
l---------src/systemd-nspawn/mount-setup.c1
l---------src/systemd-nspawn/mount-setup.h1
-rw-r--r--src/systemd-nspawn/nspawn-expose-ports.c3
-rw-r--r--src/systemd-nspawn/nspawn-network.c1
-rw-r--r--src/systemd-nspawn/nspawn-register.c2
-rw-r--r--src/systemd-nspawn/nspawn.c1
-rw-r--r--src/systemd-remount-fs/Makefile3
l---------src/systemd-remount-fs/mount-setup.c1
l---------src/systemd-remount-fs/mount-setup.h1
-rw-r--r--src/systemd-run/run.c2
-rw-r--r--src/systemd-shutdown/Makefile3
l---------src/systemd-shutdown/killall.c1
l---------src/systemd-shutdown/killall.h1
l---------src/systemd-shutdown/mount-setup.c1
l---------src/systemd-shutdown/mount-setup.h1
-rw-r--r--src/systemd-stdio-bridge/stdio-bridge.c2
-rw-r--r--src/systemd-system-update-generator/Makefile2
-rw-r--r--src/systemd-timesyncd/Makefile2
-rw-r--r--src/systemd-timesyncd/timesyncd-manager.c2
-rw-r--r--src/systemd-timesyncd/timesyncd.c2
-rw-r--r--src/systemd-update-utmp/update-utmp.c2
161 files changed, 1769 insertions, 221 deletions
diff --git a/.gitignore b/.gitignore
index 37eb20c4b5..07d205f568 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,7 @@
/build-aux/*
!/build-aux/Makefile*
!/build-aux/write-ifchanged
+!/build-aux/no-builtin-variables.mk
/busctl
/cdrom_id
/collect
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000000..a15804417a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,48 @@
+# -*- 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 $(dir $(lastword $(MAKEFILE_LIST)))/config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+at.subdirs += src
+
+# intltoolize
+std.gen_files += m4/intltool.m4
+std.gen_files += po/Makefile.in.in
+# autoreconf
+std.gen_files += aclocal.m4
+std.gen_files += automake.mk.in
+std.gen_files += build-aux/compile
+std.gen_files += build-aux/config.guess
+std.gen_files += build-aux/config.sub
+std.gen_files += build-aux/install-sh
+std.gen_files += build-aux/ltmain.sh
+std.gen_files += build-aux/missing
+std.gen_files += m4/libtool.m4
+std.gen_files += m4/ltoptions.m4
+std.gen_files += m4/ltsugar.m4
+std.gen_files += m4/ltversion.m4
+std.gen_files += m4/lt~obsolete.m4
+std.gen_files += config.h.in
+std.gen_files += configure
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/autoconf.mk.in b/autoconf.mk.in
new file mode 100644
index 0000000000..031dab17d9
--- /dev/null
+++ b/autoconf.mk.in
@@ -0,0 +1,41 @@
+top_builddir = $(topoutdir)
+top_srcdir = $(topsrcdir)
+
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_URL = @PACKAGE_URL@
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FGREP = @FGREP@# Requires AC_PROG_FGREP
+GPERF = @GPERF@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBTOOL = @LIBTOOL@
+M4 = @M4@
+M4_DEFINES = @M4_DEFINES@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@# Requires AC_PROG_MKDIR_P
+MSGFMT = @MSGFMT@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJCOPY = @OBJCOPY@
+OBJDUMP = @OBJDUMP@
+STRINGS = @STRINGS@
+STRIP = @STRIP@
+XGETTEXT = @XGETTEXT@
+
+INSTALL_SCRIPT = @INSTALL_SCRIPT@# Requires AC_PROG_INSTALL
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
diff --git a/automake.mk.am b/automake.mk.am
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/automake.mk.am
diff --git a/build-aux/Makefile.README.txt b/build-aux/Makefile.README.txt
new file mode 100644
index 0000000000..e06ba523d4
--- /dev/null
+++ b/build-aux/Makefile.README.txt
@@ -0,0 +1,164 @@
+Luke's AutoMake
+===============
+
+Yo, this document is incomplete. It describes the magical
+automake.{head,tail}.mk Makefiles and how to use them, kinda.
+
+I wrote a "clone" of automake. I say clone, because it works
+differently. Yeah, I need a new name for it.
+
+High-level overview
+-------------------
+
+Now, what this does for you is:
+
+It makes it _easy_ to write non-recursive Makefiles--and ones that are
+similar to plain recursive Makefiles, at that! (search for the paper
+"Recursive Make Considered Harmful") As harmful as recursive make is,
+it's historically been difficult to to write non-recursive Makefiles.
+This makes it easy.
+
+It also makes it easy to follow the GNU standards for your makefiles:
+it takes care of this entire table of .PHONY targets for you:
+
+| this | and this | are aliases for this |
+|------+------------------+--------------------------------------------------------|
+| all | build | $(outdir)/build |
+| | install | $(outdir)/install |
+| | uninstall | $(outdir)/uninstall |
+| | mostlyclean | $(outdir)/mostlyclean |
+| | clean | $(outdir)/clean |
+| | distclean | $(outdir)/distclean |
+| | maintainer-clean | $(outdir)/maintainer-clean |
+| | check | $(outdir)/check (not implemented for you) |
+| | dist | $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz (not .PHONY) |
+
+(You are still responsible for implementing the `$(outdir)/check`
+target in each of your Makefiles.)
+
+What you have to do is:
+
+In each source directory, you write a `Makefile`, very similarly to if
+you were writing for plain GNU Make, with
+
+ topoutdir ?= ...
+ topsrcdir ?= ...
+ include $(topsrcdir)/build-aux/Makefile.head.mk
+
+ # your makefile
+
+ include $(topsrcdir)/build-aux/Makefile.tail.mk
+
+And in the top-level source directory, Write your own helper makefiles
+that get included:
+ - `common.once.head.mk`: before parsing any of your Makefiles
+ - `common.each.head.mk`: before parsing each of your Makefiles
+ - `common.each.tail.mk`: after parsing each of your Makefiles
+ - `common.each.tail.mk`: after parsing all of your Makefiles
+
+The `common.*.mk` makefiles are nice for including generic pattern
+rules and variables that aren't specific to a directory.
+
+You're probably thinking that this sounds too good to be true!
+Unfortunately, there are two major deviations from writing a plain
+recursive Makefile:
+
+ 1. all targets and prerequisites (including .PHONY targets!) need to
+ be prefixed with
+ `$(srcdir)`/`$(outdir)`/`$(topsrcdir)`/`$(topoutdir)`.
+ * sub-gotcha: this means that if a pattern rule has a
+ prerequisite that may be in srcdir or outdir, then it must be
+ specified twice, once for each case.
+ 2. if a prerequisite is in a directory "owned" by another Makefile,
+ you must filter the pathname through `am_path`:
+ `$(call am_path,YOUR_PATH)`. Further, that path must NOT contain
+ a `..` segment; if you need to refer to a sibling directory, do it
+ relative to `$(topoutdir)` or `$(topsrcdir)`.
+
+Telling automake about your program
+-----------------------------------
+
+You tell automake what to do for you by setting some variables. They
+are all prefixed with `am_`; this prefix may be changed by editing the
+`_am` variable at the top of `automake.head.mk`.
+
+The exception to this is the `am_path` variable, which is a macro that
+is used to make a list of filenames relative to the appropriate
+directory, because unlike normal GNU (Auto)Make, `$(outdir)` isn't
+nescessarily equal to `.`. See above.
+
+There are several commands that generate files; simply record the list
+of files that each command generates as the following variable
+variables:
+
+| Variable | Create Command | Delete Command | Description | Relative to |
+|--------------+----------------+-----------------------------+-----------------------------------+-------------|
+| am_src_files | emacs | rm -rf . | Files that the developer writes | srcdir |
+| am_gen_files | ??? | make maintainer-clean | Files the developer compiles | srcdir |
+| am_cfg_files | ./configure | make distclean | Users' compile-time configuration | outdir |
+| am_out_files | make all | make mostlyclean/make clean | Files the user compiles | outdir |
+| am_sys_files | make install | make uninstall | Files the user installs | DESTDIR |
+
+In addition, there are two more variables that control not how files
+are created, but how they are deleted:
+
+| Variable | Affected command | Description | Relative to |
+|----------------+------------------+------------------------------------------------+-------------|
+| am_clean_files | make clean | A list of things to `rm` in addition to the | outdir |
+| | | files in `$(am_out_files)`. (Example: `*.o`) | |
+|----------------+------------------+------------------------------------------------+-------------|
+| am_slow_files | make mostlyclean | A list of things that (as an exception) should | outdir |
+| | | _not_ be deleted. (otherwise, `mostlyclean` | |
+| | | is the same as `clean`) | |
+
+Finally, there are two variables that express the relationships
+between directories:
+
+| Variable | Description |
+|------------+---------------------------------------------------------|
+| am_subdirs | A list of other directories (containing Makefiles) that |
+| | may be considered "children" of this |
+| | directory/Makefile; building a phony target in this |
+| | directory should also build it in the subdirectory. |
+| | They are not necesarily actually subdirectories of this |
+| | directory in the filesystem. |
+|------------+---------------------------------------------------------|
+| am_depdirs | A list of other directories (containing Makefiles) that |
+| | contain or generate files that are dependencies of |
+| | targets in this directory. They are not necesarily |
+| | actually subdirectories of this directory in the |
+| | filesystem. Except for files that are dependencies of |
+| | files in this directory, things in the dependency |
+| | directory will not be built. |
+
+Tips, notes
+-----------
+
+I like to have the first (non-comment) line in a Makefile be:
+
+ include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
+
+(adjusting the number of `../` sequences as nescessary). Then, my
+(user-editable) `config.mk` is of the form:
+
+ ifeq ($(topsrcdir),)
+ topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+ topsrcdir := $(topoutdir)
+
+ # your configuration
+
+ endif
+
+If the package has a `./configure` script, then I have it modifiy
+topsrcdir as necessary, as well as modifying whatever other parts of
+the configuration. All of the configuration lives in `config.mk`;
+`./configure` doesn't modify any `Makefile`s, it just generates
+`config.mk`, and copies (or (sym?)link?) every `$(srcdir)/Makefile` to
+`$(outdir)/Makefile`.
+
+----
+Copyright (C) 2016 Luke Shumaker
+
+This documentation file is placed into the public domain. If that is
+not possible in your legal system, I grant you permission to use it in
+absolutely every way that I can legally grant to you.
diff --git a/build-aux/Makefile.each.head/00-dist.mk b/build-aux/Makefile.each.head/00-dist.mk
new file mode 100644
index 0000000000..a0943059ba
--- /dev/null
+++ b/build-aux/Makefile.each.head/00-dist.mk
@@ -0,0 +1,20 @@
+# 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/>.
+
+ifeq ($(outdir),$(topoutdir))
+std.clean_files += $(addprefix $(dist.pkgname)-*,$(dist.exts) .tar /)
+endif
+
+$(outdir)/dist: $(addprefix $(topoutdir)/$(dist.pkgname)-$(dist.version),$(dist.exts))
diff --git a/build-aux/Makefile.each.tail/10-std.mk b/build-aux/Makefile.each.tail/10-std.mk
new file mode 100644
index 0000000000..ca78f3cf8c
--- /dev/null
+++ b/build-aux/Makefile.each.tail/10-std.mk
@@ -0,0 +1,46 @@
+# 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
index 72dbec6714..1a65c000e2 100644
--- a/build-aux/Makefile.each.tail/20-systemd.mk
+++ b/build-aux/Makefile.each.tail/20-systemd.mk
@@ -20,30 +20,80 @@
#
# 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
-include $(topsrcdir)/build-aux/Makefile.head.mk
-%-from-name.gperf: %-list.txt
+-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 }' <$< >$@
-%-from-name.h: %-from-name.gperf
+$(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 <$< >$@
-$(outdir)/%: sysctl.d/%.in
+$(addprefix $(outdir)/,$(systemd.sed_files)): $(outdir)/%: $(srcdir)/%.in
$(SED_PROCESS)
-%.sh: %.sh.in
- $(SED_PROCESS)
- $(AM_V_GEN)chmod +x $@
+#$(outdir)/%.sh: $(srcdir)/%.sh.in
+# $(SED_PROCESS)
+# $(AM_V_GEN)chmod +x $@
-$(outdir)/%.c: src/%.gperf
- $(AM_V_at)$(MKDIR_P) $(dir $@)
+$(outdir)/%.c: $(srcdir)/%.gperf
+ $(AM_V_GPERF)$(GPERF) < $< > $@
+$(outdir)/%.c: $(outdir)/%.gperf
$(AM_V_GPERF)$(GPERF) < $< > $@
-$(outdir)/%: src/%.m4 $(top_builddir)/config.status
- $(AM_V_at)$(MKDIR_P) $(dir $@)
+$(outdir)/%: $(srcdir)/%.m4 $(top_builddir)/config.status
$(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
-
-include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/build-aux/Makefile.each.tail/30-automake2autothing.mk b/build-aux/Makefile.each.tail/30-automake2autothing.mk
new file mode 100644
index 0000000000..a74e247339
--- /dev/null
+++ b/build-aux/Makefile.each.tail/30-automake2autothing.mk
@@ -0,0 +1,35 @@
+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)) ))
+std.out_files += $(_programs)
+# TODO: noinst_PROGRAMS (test)
+
+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 += $(abspath $(sort $(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
new file mode 100644
index 0000000000..10ebc4c1de
--- /dev/null
+++ b/build-aux/Makefile.each.tail/30-directory-info.mk
@@ -0,0 +1,4 @@
+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),'$v' '$($v/$(@D))') | sort | column -s= -o= -t
+.PHONY: $(outdir)/module-info
diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk
new file mode 100644
index 0000000000..36c2c0a2e8
--- /dev/null
+++ b/build-aux/Makefile.head.mk
@@ -0,0 +1,71 @@
+# 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/>.
+
+# This bit only gets evaluated once, at the very beginning
+ifeq ($(origin _at.NO_ONCE),undefined)
+
+ifeq ($(topsrcdir),)
+$(error topsrcdir must be set before including Makefile.head.mk)
+endif
+ifeq ($(topoutdir),)
+$(error topoutdir must be set before including Makefile.head.mk)
+endif
+
+_at.noslash = $(patsubst %/.,%,$(patsubst %/,%,$1))
+# These are all $(call _at.func,parent,child)
+#at.relto = $(if $2,$(shell realpath -sm --relative-to='$1' $2))
+_at.is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/.)
+_at.relto_helper = $(if $(call _at.is_subdir,$1,$2),$(patsubst $1/%,%,$(addsuffix /.,$2)),$(addprefix ../,$(call _at.relto_helper,$(patsubst %/,%,$(dir $1)),$2)))
+_at.relto = $(call _at.noslash,$(call _at.relto_helper,$(call _at.noslash,$(abspath $1)),$(call _at.noslash,$(abspath $2))))
+at.relto = $(foreach p,$2,$(call _at.relto,$1,$p))
+# Note that _at.is_subdir says that a directory is a subdirectory of
+# itself.
+at.path = $(call at.relto,.,$1)
+
+_at.addprefix = $(if $(filter /%,$2),$2,$1/$2)
+at.addprefix = $(foreach f,$2, $(addsuffix $(if $(filter %/,$f),/),$(call at.path,$(call _at.addprefix,$1,$f)) ))
+
+define at.nl
+
+
+endef
+
+at.Makefile ?= Makefile
+
+_at.rest = $(wordlist 2,$(words $1),$1)
+_at.reverse = $(if $1,$(call _at.reverse,$(_at.rest))) $(firstword $1)
+
+at.dirlocal += at.subdirs
+at.dirlocal += at.depdirs
+
+_at.outdirs ?=
+_at.included_makefiles ?=
+
+include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk))
+
+endif # _at.NO_ONCE
+
+# This bit gets evaluated for each Makefile
+
+## Set outdir and srcdir (assumes that topoutdir and topsrcdir are
+## already set)
+outdir := $(call at.path,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST)))))
+srcdir := $(call at.path,$(topsrcdir)/$(call _at.relto,$(topoutdir),$(outdir)))
+
+_at.included_makefiles := $(_at.included_makefiles) $(call at.path,$(outdir)/$(at.Makefile))
+
+$(foreach v,$(at.dirlocal),$(eval $v=))
+
+include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.head/*.mk))
diff --git a/build-aux/Makefile.once.head/00-dist.mk b/build-aux/Makefile.once.head/00-dist.mk
new file mode 100644
index 0000000000..4326cde72a
--- /dev/null
+++ b/build-aux/Makefile.once.head/00-dist.mk
@@ -0,0 +1,44 @@
+# 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/>.
+
+# Developer configuration
+
+dist.exts ?= .tar.gz
+dist.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))
+dist.version ?= $(firstword $(PACKAGE_VERSION) $(VERSION))
+
+ifeq ($(dist.pkgname),)
+$(error dist.pkgname must be set)
+endif
+ifeq ($(dist.version),)
+$(error dist.version must be set)
+endif
+
+# User configuration
+
+CP ?= cp
+GZIP ?= gzip
+MKDIR ?= mkdir
+MKDIR_P ?= mkdir -p
+MV ?= mv
+RM ?= rm -f
+TAR ?= tar
+
+GZIPFLAGS ?= $(GZIP_ENV)
+GZIP_ENV ?= --best
+
+# Implementation
+
+at.phony += dist
diff --git a/build-aux/Makefile.once.head/00-gnuconf.mk b/build-aux/Makefile.once.head/00-gnuconf.mk
new file mode 100644
index 0000000000..83cb110c59
--- /dev/null
+++ b/build-aux/Makefile.once.head/00-gnuconf.mk
@@ -0,0 +1,160 @@
+# 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/>.
+
+# This file is based on §7.2 "Makefile Conventions" of the release of
+# the GNU Coding Standards dated April 13, 2016.
+
+gnuconf.pkgname ?= $(firstword $(PACKAGE_TARNAME) $(PACKAGE) $(PACKAGE_NAME))
+ifeq ($(gnuconf.pkgname),)
+$(error gnuconf.pkgname must be set)
+endif
+
+# 7.2.2: Utilities in Makefiles
+# -----------------------------
+
+# It's ok to hard-code these commands in rules, but who wants to
+# memorize the list of what's ok?
+AWK ?= awk
+CAT ?= cat
+CMP ?= cmp
+CP ?= cp
+DIFF ?= diff
+ECHO ?= echo
+EGREP ?= egrep
+EXPR ?= expr
+FALSE ?= false
+GREP ?= grep
+INSTALL_INFO ?= install-info
+LN ?= ln
+LS ?= ls
+MKDIR ?= mkdir
+MV ?= mv
+PRINTF ?= printf
+PWD ?= pwd
+RM ?= rm
+RMDIR ?= rmdir
+SED ?= sed
+SLEEP ?= sleep
+SORT ?= sort
+TAR ?= tar
+TEST ?= test
+TOUCH ?= touch
+TR ?= tr
+TRUE ?= true
+
+# These must be user-configurable
+AR ?= ar
+ARFLAGS ?=
+BISON ?= bison
+BISONFLAGS ?=
+CC ?= cc
+CCFLAGS ?= $(CFLAGS)
+FLEX ?= flex
+FLEXFLAGS ?=
+INSTALL ?= install
+#INSTALLFLAGS ?=
+LD ?= ld
+LDFLAGS ?=
+LDCONFIG ?= ldconfig #TODO
+LDCONFIGFLAGS ?=
+LEX ?= lex
+LEXFLAGS ?= $(LFLAGS)
+#MAKE
+MAKEINFO ?= makeinfo
+MAKEINFOFLAGS ?=
+RANLIB ?= ranlib #TODO
+RANLIBFLAGS ?=
+TEXI2DVI ?= texi2dvi
+TEXI2DVIFLAGS ?=
+YACC ?= yacc
+YACCFLAGS ?= $(YFLAGS)
+
+CFLAGS ?=
+LFLAGS ?=
+YFLAGS ?=
+
+LN_S ?= ln -s #TODO
+
+CHGRP ?= chgrp
+CHMOD ?= chmod
+CHOWN ?= chown
+MKNOD ?= mknod
+
+# 7.2.3: Variables for Specifying Commands
+# ----------------------------------------
+
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= ${INSTALL} -m 644
+
+# 7.2.5: Variables for Installation Directories
+# ---------------------------------------------
+
+# Root for the installation
+prefix ?= /usr/local
+exec_prefix ?= $(prefix)
+# Executable programs
+bindir ?= $(exec_prefix)/bin
+sbindir ?= $(exec_prefix)/sbin
+libexecdir ?= $(exec_prefix)/libexec
+# Data files
+datarootdir ?= $(prefix)/share
+datadir ?= $(datarootdir)
+sysconfdir ?= $(prefix)/etc
+sharedstatedir ?= $(prefix)/com
+localstatedir ?= $(prefix)/var
+runstatedir ?= $(localstatedir)/run
+# Specific types of files
+includedir ?= $(prefix)/include
+oldincludedir ?= /usr/include
+docdir ?= $(datarootdir)/doc/$(gnuconf.pkgname)
+infodir ?= $(datarootdir)/info
+htmldir ?= $(docdir)
+dvidir ?= $(docdir)
+pdfdir ?= $(docdir)
+psdir ?= $(docdir)
+libdir ?= $(exec_prefix)/lib
+lispdir ?= $(datarootdir)/emacs/site-lisp
+localedir ?= $(datarootdir)/locale
+
+mandir ?= $(datarootdir)/man
+man1dir ?= $(mandir)/man1
+man2dir ?= $(mandir)/man2
+man3dir ?= $(mandir)/man3
+man4dir ?= $(mandir)/man4
+man5dir ?= $(mandir)/man5
+man6dir ?= $(mandir)/man6
+man7dir ?= $(mandir)/man7
+man8dir ?= $(mandir)/man8
+
+manext ?= .1
+man1ext ?= .1
+man2ext ?= .2
+man3ext ?= .3
+man4ext ?= .4
+man5ext ?= .5
+man6ext ?= .6
+man7ext ?= .7
+man8ext ?= .8
+
+# 7.2.7: Install Command Categories
+# ---------------------------------
+
+PRE_INSTALL ?=
+POST_INSTALL ?=
+NORMAL_INSTALL ?=
+
+PRE_UNINSTALL ?=
+POST_UNINSTALL ?=
+NORMAL_UNINSTALL ?=
diff --git a/build-aux/Makefile.once.head/00-write-ifchanged.mk b/build-aux/Makefile.once.head/00-write-ifchanged.mk
new file mode 100644
index 0000000000..79ef1c419c
--- /dev/null
+++ b/build-aux/Makefile.once.head/00-write-ifchanged.mk
@@ -0,0 +1 @@
+WRITE_IFCHANGED = $(topsrcdir)/build-aux/write-ifchanged
diff --git a/build-aux/Makefile.once.head/10-std.mk b/build-aux/Makefile.once.head/10-std.mk
new file mode 100644
index 0000000000..3e058eca57
--- /dev/null
+++ b/build-aux/Makefile.once.head/10-std.mk
@@ -0,0 +1,39 @@
+# 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/>.
+
+# Declare the default target
+all: build
+.PHONY: all noop
+
+# Standard creative PHONY targets
+at.phony += build install installdirs
+# 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
+
+# User configuration
+
+DESTDIR ?=
+
+RM ?= rm -f
+RMDIR_P ?= rmdir -p
+TRUE ?= true
diff --git a/build-aux/Makefile.once.head/20-systemd.mk b/build-aux/Makefile.once.head/20-systemd.mk
index 3f55d88234..04627a9497 100644
--- a/build-aux/Makefile.once.head/20-systemd.mk
+++ b/build-aux/Makefile.once.head/20-systemd.mk
@@ -20,26 +20,35 @@
#
# 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
-include $(topsrcdir)/build-aux/Makefile.head.mk
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-AM_MAKEFLAGS = --no-print-directory
-AUTOMAKE_OPTIONS = color-tests parallel-tests
+TESTS ?=
+
-GCC_COLORS ?= 'ooh, shiny!'
-export GCC_COLORS
+SHELL = bash -o pipefail
-SUBDIRS = . po
+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) )
-# remove targets if the command fails
-.DELETE_ON_ERROR:
+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)
-# keep intermediate files
-.SECONDARY:
+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 $@
-# Keep the test-suite.log
-.PRECIOUS: $(TEST_SUITE_LOG) Makefile
+.DELETE_ON_ERROR:
+.SECONDARY:
V ?=
@@ -78,6 +87,16 @@ 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
@@ -88,6 +107,21 @@ 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 = @
@@ -183,4 +217,4 @@ define generate-sym-test
$(AM_V_at)printf 'return 0; }\n' >> $@
endef
-include $(topsrcdir)/build-aux/Makefile.tail.mk
+at.dirlocal += systemd.sed_files
diff --git a/build-aux/Makefile.once.head/30-automake2autothing.mk b/build-aux/Makefile.once.head/30-automake2autothing.mk
new file mode 100644
index 0000000000..529cc97326
--- /dev/null
+++ b/build-aux/Makefile.once.head/30-automake2autothing.mk
@@ -0,0 +1,11 @@
+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,$(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,$($(automake_name)_$2),$(if $(filter lib%.la,$l), $($(l:.la=).CPPFLAGS) , ))
diff --git a/build-aux/Makefile.once.tail/00-dist.mk b/build-aux/Makefile.once.tail/00-dist.mk
new file mode 100644
index 0000000000..b8b7733319
--- /dev/null
+++ b/build-aux/Makefile.once.tail/00-dist.mk
@@ -0,0 +1,27 @@
+# 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/>.
+
+_dist.copyfile = $(MKDIR_P) $(dir $2) && $(CP) -T $1 $2
+_dist.addfile = $(call _dist.copyfile,$3,$2/$(call at.relto,$1,$3))
+$(topoutdir)/$(dist.pkgname)-$(dist.version): $(foreach v,$(filter std.src_files/% std.gen_files/%,$(.VARIABLES)),$($v))
+ $(RM) -r $@ $(@D)/tmp.$(@F)
+ $(MKDIR) $(@D)/tmp.$(@F)
+ $(foreach f,$^,$(call _dist.addfile,$(topsrcdir),$(@D)/tmp.$(@F),$f)$(at.nl))
+ $(MV) $(@D)/tmp.$(@F) $@ || $(RM) -r $(@D)/tmp.$(@F)
+
+$(topoutdir)/$(dist.pkgname)-$(dist.version).tar: $(topoutdir)/$(dist.pkgname)-$(dist.version)
+ $(TAR) cf $@ -C $(<D) $(<F)
+$(topoutdir)/$(dist.pkgname)-$(dist.version).tar.gz: $(topoutdir)/$(dist.pkgname)-$(dist.version).tar
+ $(GZIP) $(GZIPFLAGS) < $< > $@
diff --git a/build-aux/Makefile.once.tail/20-systemd.mk b/build-aux/Makefile.once.tail/20-systemd.mk
index 7455244e3c..5aa2703256 100644
--- a/build-aux/Makefile.once.tail/20-systemd.mk
+++ b/build-aux/Makefile.once.tail/20-systemd.mk
@@ -20,8 +20,22 @@
#
# 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
-include $(topsrcdir)/build-aux/Makefile.head.mk
+
+$(topsrcdir)/configure: $(topsrcdir)/configure.ac
+ 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
@@ -94,4 +108,3 @@ 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 -
-include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/build-aux/Makefile.tail.mk b/build-aux/Makefile.tail.mk
new file mode 100644
index 0000000000..a8b3d8938f
--- /dev/null
+++ b/build-aux/Makefile.tail.mk
@@ -0,0 +1,52 @@
+# 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/>.
+
+# This bit gets evaluated for each Makefile processed
+
+include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.each.tail/*.mk)))
+
+# Move all of the dirlocal variables to their namespaced version
+$(foreach v,$(at.dirlocal),$(eval $v/$(outdir) := $$($v)))
+$(foreach v,$(at.dirlocal),$(eval undefine $v))
+
+# Adjust subdirs and depdirs to be relative to $(outdir)
+at.subdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.subdirs/$(outdir)))))
+at.depdirs/$(outdir) := $(sort $(patsubst %/,%,$(call at.addprefix,$(outdir)/,$(at.depdirs/$(outdir)))))
+
+# Remember that this is a directory that we've visited
+_at.outdirs := $(_at.outdirs) $(outdir)
+
+# Generic phony target declarations:
+# mark them phony
+.PHONY: $(addprefix $(outdir)/,$(at.phony))
+# have them depend on subdirs
+$(foreach t,$(at.phony),$(eval $(outdir)/$t: $(addsuffix /$t,$(at.subdirs/$(outdir)))))
+
+# Include Makefiles from other directories
+$(foreach _at.NO_ONCE,y,\
+ $(foreach makefile,$(call at.path,$(addsuffix /$(at.Makefile),$(at.subdirs/$(outdir)) $(at.depdirs/$(outdir)))),\
+ $(eval include $(filter-out $(_at.included_makefiles),$(makefile)))))
+
+# This bit only gets evaluated once, after all of the other Makefiles are read
+ifeq ($(origin _at.NO_ONCE),undefined)
+
+outdir = /bogus
+srcdir = /bogus
+
+$(foreach v,$(at.dirlocal),$(eval $v=))
+
+include $(call _at.reverse,$(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.tail/*.mk)))
+
+endif # _at.NO_ONCE
diff --git a/build-aux/no-builtin-variables.mk b/build-aux/no-builtin-variables.mk
new file mode 100644
index 0000000000..c3aef5874f
--- /dev/null
+++ b/build-aux/no-builtin-variables.mk
@@ -0,0 +1,15 @@
+MAKEFLAGS += --no-builtin-variables
+
+# This version is more correct, but is slower:
+# $(foreach v,$(shell bash -c 'comm -23 <(env -i $(MAKE) -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort) <(env -i $(MAKE) -R -f - <<<"\$$(info \$$(.VARIABLES))all:"|sed "s/ /\n/g"|sort)'),
+# $(if $(filter default,$(origin $v)),$(eval undefine $v)))
+
+_default_variables = $(foreach v,$(.VARIABLES),$(if $(filter default,$(origin $v)),$v))
+$(foreach v,$(filter-out .% MAKE% SUFFIXES,$(_default_variables))\
+ $(filter .LIBPATTERNS MAKEINFO,$(_default_variables)),\
+ $(eval undefine $v))
+undefine _default_variables
+
+# Because Make uses .LIBPATTERNS internally, it should always be
+# defined in case --warn-undefined-variables
+.LIBPATTERNS ?=
diff --git a/build-aux/write-ifchanged b/build-aux/write-ifchanged
new file mode 100755
index 0000000000..185ceb0039
--- /dev/null
+++ b/build-aux/write-ifchanged
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Copyright (C) 2015 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/>.
+
+outfile=$1
+tmpfile="$(dirname "$outfile")/.tmp${outfile##*/}"
+
+cat > "$tmpfile" || exit $?
+if cmp -s "$tmpfile" "$outfile"; then
+ rm -f "$tmpfile" || :
+else
+ mv -f "$tmpfile" "$outfile"
+fi
diff --git a/config.mk.in b/config.mk.in
index de6b9dad89..f6e99c9c36 100644
--- a/config.mk.in
+++ b/config.mk.in
@@ -20,8 +20,33 @@
#
# 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
-include $(topsrcdir)/build-aux/Makefile.head.mk
+
+ifeq ($(origin topsrcdir),undefined)
+topoutdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
+topsrcdir := $(topoutdir)/@top_srcdir@
+
+MAKEFLAGS += --warn-undefined-variables
+include $(topsrcdir)/build-aux/no-builtin-variables.mk
+.LIBPATTERNS = lib%.so lib%.a
+
+include $(topoutdir)/gnustandards.mk
+include $(topoutdir)/autoconf.mk
+
+CCLD = $(CC)
+
+OUR_CPPFLAGS = @OUR_CPPFLAGS@
+OUR_CFLAGS = @OUR_CFLAGS@
+OUR_LDFLAGS = @OUR_LDFLAGS@
+OUR_LIBTOOLFLAGS =
+
+AM_CPPFLAGS =
+AM_CFLAGS =
+AM_LDFLAGS =
+AM_LIBTOOLFLAGS =
+
+EFI_CPPFLAGS =
+EFI_CFLAGS =
+EFI_LDFLAGS =
# Dirs of external packages
dbuspolicydir=@dbuspolicydir@
@@ -73,5 +98,275 @@ bootlibdir = $(prefix)/lib/systemd/boot/efi
rootprefix=@rootprefix@
rootbindir=$(rootprefix)/bin
rootlibexecdir=$(rootprefix)/lib/systemd
+rootlibdir=@rootlibdir@
+
+# Libraries we provide
+libbasic.CPPFLAGS = -I$(topsrcdir)/src/libbasic -I$(topoutdir)/src/libbasic
+libbasic.DEPENDS = $(topoutdir)/src/libbasic/libbasic.la
+libcore.CPPFLAGS = -I$(topsrcdir)/src/libcore $(libshared.CPPFLAGS)
+libcore.DEPENDS = $(topoutdir)/src/libcore/libcore.la
+libfirewall.CPPFLAGS = -I$(topsrcdir)/src/libfirewall -I$(topoutdir)/src/libfirewall
+libfirewall.DEPENDS = $(topoutdir)/src/libfirewall/libfirewall.la
+libshared.CPPFLAGS = -I$(topsrcdir)/src/libshared -I$(topoutdir)/src/libshared $(libsystemd-internal.CPPFLAGS) -I$(topsrcdir)/src/libudev/src
+libshared.DEPENDS = $(topoutdir)/src/libshared/libshared.la
+libsystemd-internal.CPPFLAGS = -I$(topsrcdir)/src/libsystemd/src -I$(topoutdir)/src/libsystemd/src $(libsystemd.CPPFLAGS) $(libbasic.CPPFLAGS)
+libsystemd-internal.DEPENDS = $(topoutdir)/src/libsystemd/src/libsystemd-internal.la
+libsystemd-network.CPPFLAGS = -I$(topsrcdir)/src/libsystemd-network -I$(topsrcdir)/src/libudev/src $(libsystemd.CPPFLAGS)
+libsystemd-network.DEPENDS = $(topoutdir)/src/libsystemd-network/libsystemd-network.la
+libsystemd.CPPFLAGS = -I$(topsrcdir)/src/libsystemd/include
+libsystemd.DEPENDS = $(topoutdir)/src/libsystemd/libsystemd.la
+libudev.CPPFLAGS = -I$(topsrcdir)/src/libudev/include
+libudev.DEPENDS = $(topoutdir)/src/libudev/src/libudev.la
+libudev-internal.CPPFLAGS = $(libudev.CPPFLAGS)
+libudev-internal.DEPENDS = $(topoutdir)/src/libudev/src/libudev-internal.la
+# -core libs
+#libbus-proxy-core.CPPFLAGS =
+#libbus-proxy-core.DEPENDS =
+#libjournal-core.CPPFLAGS =
+#libjournal-core.DEPENDS =
+#liblogind-core.CPPFLAGS =
+#liblogind-core.DEPENDS =
+#libmachine-core.CPPFLAGS =
+#libmachine-core.DEPENDS =
+#libnetworkd-core.CPPFLAGS =
+#libnetworkd-core.DEPENDS =
+libudev-core.CPPFLAGS = -I$(topoutdir)/src/grp-udev/libudev-core $(libsystemd-network.CPPFLAGS) $(libshared.CPPFLAGS)
+libudev-core.DEPENDS = $(topoutdir)/src/grp-udev/libudev-core/libudev-core.la
+# NSS modules
+#libnss_myhostname.CPPFLAGS =
+#libnss_myhostname.DEPENDS =
+#libnss_mymachines.CPPFLAGS =
+#libnss_mymachines.DEPENDS =
+#libnss_resolve.CPPFLAGS =
+#libnss_resolve.DEPENDS =
+
+# Libraries we use
+HAVE_ACL = @HAVE_ACL_TRUE@1
+ ACL_CFLAGS = #XXX
+ ACL_LIBS = @ACL_LIBS@
+HAVE_APPARMOR = @HAVE_APPARMOR_TRUE@1
+ APPARMOR_CFLAGS = @APPARMOR_CFLAGS@
+ APPARMOR_LIBS = @APPARMOR_LIBS@
+HAVE_AUDIT = @HAVE_AUDIT_TRUE@1
+ AUDIT_CFLAGS = #XXX
+ AUDIT_LIBS = @AUDIT_LIBS@
+HAVE_BLKID = @HAVE_BLKID_TRUE@1
+ BLKID_CFLAGS = @BLKID_CFLAGS@
+ BLKID_LIBS = @BLKID_LIBS@
+HAVE_BZIP2 = @HAVE_BZIP2_TRUE@1
+ BZIP2_CFLAGS = #XXX
+ BZIP2_LIBS = -lbz2 #XXX
+HAVE_CAP = 1 #XXX
+ CAP_CFLAGS = #XXX
+ CAP_LIBS = @CAP_LIBS@
+HAVE_DBUS = @HAVE_DBUS_TRUE@1
+ DBUS_CFLAGS = @DBUS_CFLAGS@
+ DBUS_LIBS = @DBUS_LIBS@
+HAVE_ELFUTILS = @HAVE_ELFUTILS_TRUE@1
+ ELFUTILS_CFLAGS = #XXX
+ ELFUTILS_LIBS = @ELFUTILS_LIBS@
+HAVE_GCRYPT = @HAVE_GCRYPT_TRUE@1
+ GCRYPT_CFLAGS = @GCRYPT_CFLAGS@
+ GCRYPT_LIBS = @GCRYPT_LIBS@
+HAVE_GNUTLS = @HAVE_GNUTLS_TRUE@1
+ GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+ GNUTLS_LIBS = @GNUTLS_LIBS@
+HAVE_GPG_ERROR = 1 #XXX
+ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@
+ GPG_ERROR_LIBS = @GPG_ERROR_LIBS@
+HAVE_GPG_ERROR_MT = 1 #XXX
+ GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@
+ GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@
+HAVE_KMOD = @HAVE_KMOD_TRUE@1
+ KMOD_CFLAGS = @KMOD_CFLAGS@
+ KMOD_LIBS = @KMOD_LIBS@
+HAVE_LIBCRYPTSETUP = @HAVE_LIBCRYPTSETUP_TRUE@1
+ LIBCRYPTSETUP_CFLAGS = @LIBCRYPTSETUP_CFLAGS@
+ LIBCRYPTSETUP_LIBS = @LIBCRYPTSETUP_LIBS@
+HAVE_LIBCURL = @HAVE_LIBCURL_TRUE@1
+ LIBCURL_CFLAGS = @LIBCURL_CFLAGS@
+ LIBCURL_LIBS = @LIBCURL_LIBS@
+HAVE_LIBGCRYPT = 1 #XXX
+ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+HAVE_LIBIDN = @HAVE_LIBIDN_TRUE@1
+ LIBIDN_CFLAGS = @LIBIDN_CFLAGS@
+ LIBIDN_LIBS = @LIBIDN_LIBS@
+HAVE_LIBIPTC = @HAVE_LIBIPTC_TRUE@1
+ LIBIPTC_CFLAGS = @LIBIPTC_CFLAGS@
+ LIBIPTC_LIBS = @LIBIPTC_LIBS@
+HAVE_LZ4 = @HAVE_LZ4_TRUE@1
+ LZ4_CFLAGS = @LZ4_CFLAGS@
+ LZ4_LIBS = @LZ4_LIBS@
+HAVE_MICROHTTPD = @HAVE_MICROHTTPD_TRUE@1
+ MICROHTTPD_CFLAGS = @MICROHTTPD_CFLAGS@
+ MICROHTTPD_LIBS = @MICROHTTPD_LIBS@
+HAVE_MOUNT = 1 #XXX
+ MOUNT_CFLAGS = @MOUNT_CFLAGS@
+ MOUNT_LIBS = @MOUNT_LIBS@
+HAVE_PAM = @HAVE_PAM_TRUE@1
+ PAM_CFLAGS = #XXX
+ PAM_LIBS = @PAM_LIBS@
+HAVE_QRENCODE = @HAVE_QRENCODE_TRUE@1
+ QRENCODE_CFLAGS = @QRENCODE_CFLAGS@
+ QRENCODE_LIBS = @QRENCODE_LIBS@
+HAVE_SECCOMP = @HAVE_SECCOMP_TRUE@1
+ SECCOMP_CFLAGS = @SECCOMP_CFLAGS@
+ SECCOMP_LIBS = @SECCOMP_LIBS@
+HAVE_SELINUX = @HAVE_SELINUX_TRUE@1
+ SELINUX_CFLAGS = @SELINUX_CFLAGS@
+ SELINUX_LIBS = @SELINUX_LIBS@
+HAVE_XKBCOMMON = @HAVE_XKBCOMMON_TRUE@1
+ XKBCOMMON_CFLAGS = @XKBCOMMON_CFLAGS@
+ XKBCOMMON_LIBS = @XKBCOMMON_LIBS@
+HAVE_XZ = @HAVE_XZ_TRUE@1
+ XZ_CFLAGS = @XZ_CFLAGS@
+ XZ_LIBS = @XZ_LIBS@
+HAVE_ZLIB = @HAVE_ZLIB_TRUE@1
+ ZLIB_CFLAGS = @ZLIB_CFLAGS@
+ ZLIB_LIBS = @ZLIB_LIBS@
+
+# Other stuff
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+
+ARCH_AARCH64 = @ARCH_AARCH64_TRUE@1
+ARCH_IA32 = @ARCH_IA32_TRUE@1
+ARCH_X86_64 = @ARCH_X86_64_TRUE@1
+
+DEFAULT_DNSSEC_MODE = @DEFAULT_DNSSEC_MODE@
+KILL_USER_PROCESSES = @KILL_USER_PROCESSES@
+
+ENABLE_BACKLIGHT = @ENABLE_BACKLIGHT_TRUE@1
+ENABLE_BASH_COMPLETION = @ENABLE_BASH_COMPLETION_TRUE@1
+ENABLE_BINFMT = @ENABLE_BINFMT_TRUE@1
+ENABLE_BOOTCHART = @ENABLE_BOOTCHART_TRUE@1
+ENABLE_COMPAT_LIBS = @ENABLE_COMPAT_LIBS_TRUE@1
+ENABLE_COREDUMP = @ENABLE_COREDUMP_TRUE@1
+ENABLE_COVERAGE = @ENABLE_COVERAGE_TRUE@1
+ENABLE_EFI = @ENABLE_EFI_TRUE@1
+ENABLE_FIRSTBOOT = @ENABLE_FIRSTBOOT_TRUE@1
+ENABLE_HIBERNATE = @ENABLE_HIBERNATE_TRUE@1
+ENABLE_HOSTNAMED = @ENABLE_HOSTNAMED_TRUE@1
+ENABLE_HWDB = @ENABLE_HWDB_TRUE@1
+ENABLE_IMPORTD = @ENABLE_IMPORTD_TRUE@1
+ENABLE_LDCONFIG = @ENABLE_LDCONFIG_TRUE@1
+ENABLE_LOCALED = @ENABLE_LOCALED_TRUE@1
+ENABLE_LOGIND = @ENABLE_LOGIND_TRUE@1
+ENABLE_MACHINED = @ENABLE_MACHINED_TRUE@1
+ENABLE_MANPAGES = @ENABLE_MANPAGES_TRUE@1
+ENABLE_NETWORKD = @ENABLE_NETWORKD_TRUE@1
+ENABLE_POLKIT = @ENABLE_POLKIT_TRUE@1
+ENABLE_QUOTACHECK = @ENABLE_QUOTACHECK_TRUE@1
+ENABLE_RANDOMSEED = @ENABLE_RANDOMSEED_TRUE@1
+ENABLE_RESOLVED = @ENABLE_RESOLVED_TRUE@1
+ENABLE_RFKILL = @ENABLE_RFKILL_TRUE@1
+ENABLE_SPLIT_USR = @ENABLE_SPLIT_USR_TRUE@1
+ENABLE_SYSUSERS = @ENABLE_SYSUSERS_TRUE@1
+ENABLE_TESTS = @ENABLE_TESTS_TRUE@1
+ENABLE_TIMEDATED = @ENABLE_TIMEDATED_TRUE@1
+ENABLE_TIMESYNCD = @ENABLE_TIMESYNCD_TRUE@1
+ENABLE_TMPFILES = @ENABLE_TMPFILES_TRUE@1
+ENABLE_VCONSOLE = @ENABLE_VCONSOLE_TRUE@1
+ENABLE_ZSH_COMPLETION = @ENABLE_ZSH_COMPLETION_TRUE@1
+
+HAVE_COMPRESSION = @HAVE_COMPRESSION_TRUE@1
+HAVE_GNUEFI = @HAVE_GNUEFI_TRUE@1
+HAVE_MYHOSTNAME = @HAVE_MYHOSTNAME_TRUE@1
+HAVE_PYTHON = @HAVE_PYTHON_TRUE@1
+HAVE_REMOTE = @HAVE_REMOTE_TRUE@1
+HAVE_SMACK = @HAVE_SMACK_TRUE@1
+HAVE_SYSV_COMPAT = @HAVE_SYSV_COMPAT_TRUE@1
+HAVE_UTMP = @HAVE_UTMP_TRUE@1
+
+LIBTOOLFLAGS =
+
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgpyexecdir = @pkgpyexecdir@
+pkgpythondir = @pkgpythondir@
+
+INSTALL = install -D
+
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+GMSGFMT = @GMSGFMT@
+KBD_LOADKEYS = @KBD_LOADKEYS@
+KBD_SETFONT = @KBD_SETFONT@
+KEXEC = @KEXEC@
+KILL = @KILL@
+KMOD = @KMOD@
+LD = @LD@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+PKG_CONFIG = @PKG_CONFIG@
+PYTHON = @PYTHON@
+QEMU = @QEMU@
+QUOTACHECK = @QUOTACHECK@
+QUOTAON = @QUOTAON@
+SETCAP = @SETCAP@
+SULOGIN = @SULOGIN@
+SUSHELL = @SUSHELL@
+UMOUNT_PATH = @UMOUNT_PATH@
+XSLTPROC = @XSLTPROC@
+MOUNT_PATH = @MOUNT_PATH@
+
+AMTAR = @AMTAR@
+CCDEPMODE = @CCDEPMODE@
+CERTIFICATEROOT = @CERTIFICATEROOT@
+DEBUGTTY = @DEBUGTTY@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DNS_SERVERS = @DNS_SERVERS@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+EFI_ARCH = @EFI_ARCH@
+EFI_CC = @EFI_CC@
+EFI_INC_DIR = @EFI_INC_DIR@
+EFI_LDS_DIR = @EFI_LDS_DIR@
+EFI_LIB_DIR = @EFI_LIB_DIR@
+EFI_MACHINE_TYPE_NAME = @EFI_MACHINE_TYPE_NAME@
+EXEEXT = @EXEEXT@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
+MAINT = @MAINT@
+NMEDIT = @NMEDIT@
+NTP_SERVERS = @NTP_SERVERS@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+
+# FIXME: hardcoded
+PATH_SEPARATOR = :
+PKG_CONFIG_LIBDIR =
+PKG_CONFIG_PATH = /home/luke/.prefix/lib/pkgconfig
+PYTHON_EXEC_PREFIX = ${exec_prefix}
+PYTHON_PLATFORM = linux
+PYTHON_PREFIX = ${prefix}
+PYTHON_VERSION = 3.5
+QEMU_BIOS =
+RC_LOCAL_SCRIPT_PATH_START = /etc/rc.local
+RC_LOCAL_SCRIPT_PATH_STOP = /usr/sbin/halt.local
+SET_MAKE =
+SYSTEM_GID_MAX = 999
+SYSTEM_SYSVINIT_PATH =
+SYSTEM_SYSVRCND_PATH =
+SYSTEM_UID_MAX = 999
+TELINIT = /lib/sysvinit/telinit
+TTY_GID = 5
+USE_NLS = yes
+
+build = x86_64-unknown-linux-gnu
+build_alias =
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = unknown
-include $(topsrcdir)/build-aux/Makefile.tail.mk
+endif
diff --git a/configure.ac b/configure.ac
index 329861a291..f08d1e991e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@ AC_INIT([systemd],
[systemd],
[http://www.freedesktop.org/wiki/Software/systemd])
-AC_CONFIG_SRCDIR([src/core/main.c])
+AC_CONFIG_SRCDIR([src/grp-system/systemd/main.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
@@ -86,11 +86,16 @@ GETTEXT_PACKAGE=systemd
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [systemd])
+AC_PROG_AWK
+AC_PROG_GREP
+AC_PROG_EGREP
+AC_PROG_FGREP
+AC_PROG_INSTALL
AC_PROG_MKDIR_P
+AC_PROG_LEX
AC_PROG_LN_S
AC_PROG_SED
-AC_PROG_GREP
-AC_PROG_AWK
+AC_PROG_YACC
AC_PATH_PROG([M4], [m4])
@@ -1564,11 +1569,24 @@ AC_SUBST([rootprefix], [$with_rootprefix])
AC_SUBST([rootlibdir], [$with_rootlibdir])
AC_CONFIG_FILES([
- Makefile
+ config.mk
+ automake.mk
+ autoconf.mk
+ gnustandards.mk
po/Makefile.in
])
-AC_OUTPUT
+AC_OUTPUT([], [], [
+if test "$srcdir" != .; then
+ {
+ find "$srcdir" -name Makefile -printf '%P\n'
+ find "$srcdir" -name subdir.mk -printf '%P\n'
+ } | while read -r filename; do
+ mkdir -p "\$(dirname "\$filename")"
+ ln -srfT "$srcdir/\$filename" "\$filename"
+ done
+fi
+])
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION
@@ -1647,6 +1665,7 @@ AC_MSG_RESULT([
tests: ${enable_tests}
prefix: ${prefix}
+ exec_prefix: ${exec_prefix}
rootprefix: ${with_rootprefix}
sysconf dir: ${sysconfdir}
datarootdir: ${datarootdir}
diff --git a/gnustandards.mk.in b/gnustandards.mk.in
new file mode 100644
index 0000000000..9c0dced485
--- /dev/null
+++ b/gnustandards.mk.in
@@ -0,0 +1,138 @@
+# 7.2.2: Utilities in Makefiles
+# -----------------------------
+
+# It's ok to hard-code these commands in rules, but who wants to
+# memorize the list of what's ok?
+AWK = @AWK@# Requires AC_PROG_AWK
+CAT = cat
+CMP = cmp
+CP = cp
+DIFF = diff
+ECHO = echo
+EGREP = @EGREP@# Requires AC_PROG_EGREP
+EXPR = expr
+FALSE = false
+GREP = @GREP@# Requires AC_PROG_GREP
+INSTALL_INFO = install-info
+LN = ln
+LS = ls
+MKDIR = mkdir
+MV = mv
+PRINTF = printf
+PWD = pwd
+RM = rm -f
+RMDIR = rmdir
+SED = sed
+SLEEP = sleep
+SORT = sort
+TAR = tar
+TEST = test
+TOUCH = touch
+TR = tr
+TRUE = true
+
+# These must be user-configurable
+AR = @AR@
+ARFLAGS =
+BISON = bison
+BISONFLAGS =
+CC = @CC@
+CCFLAGS = $(CFLAGS)
+FLEX = flex
+FLEXFLAGS =
+INSTALL = @INSTALL@# Requires AC_PROG_INSTALL
+#INSTALLFLAGS =
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LDCONFIG = ldconfig
+LDCONFIGFLAGS =
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEXFLAGS = $(LFLAGS)
+#MAKE
+MAKEINFO = @MAKEINFO@
+MAKEINFOFLAGS =
+RANLIB = @RANLIB@
+RANLIBFLAGS =
+TEXI2DVI = texi2dvi
+TEXI2DVIFLAGS =
+YACC = @YACC@
+YACCFLAGS = $(YFLAGS)
+
+CFLAGS = @CFLAGS@
+LFLAGS =
+YFLAGS = @YFLAGS@
+
+LN_S = @LN_S@
+
+CHGRP = chgrp
+CHMOD = chmod
+CHOWN = chown
+MKNOD = mknod
+
+# 7.2.3 Variables for Specifying Commands
+# ---------------------------------------
+
+INSTALL_PROGRAM = @INSTALL_PROGRAM@# Requires AC_PROG_INSTALL
+INSTALL_DATA = @INSTALL_DATA@# Requires AC_PROG_INSTALL
+
+# 7.2.5 Variables for Installation Directories
+# --------------------------------------------
+
+# Root for the installation
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+# Executable programs
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+# Data files
+datarootdir = @datarootdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+runstatedir = $(localstatedir)/run# Requires Autoconf 2.70+
+# Specific types of files
+includedir = @includedir@
+oldincludedir = @oldincludedir@
+docdir = @docdir@
+infodir = @infodir@
+htmldir = @htmldir@
+dvidir = @dvidir@
+pdfdir = @pdfdir@
+psdir = @psdir@
+libdir = @libdir@
+lispdir = $(datarootdir)/emacs/site-lisp# Requires manual configure.ac support
+localedir = @localedir@
+
+mandir = @mandir@
+man1dir = $(mandir)/man1
+man2dir = $(mandir)/man2
+man3dir = $(mandir)/man3
+man4dir = $(mandir)/man4
+man5dir = $(mandir)/man5
+man6dir = $(mandir)/man6
+man7dir = $(mandir)/man7
+man8dir = $(mandir)/man8
+
+manext = .1
+man1ext = .1
+man2ext = .2
+man3ext = .3
+man4ext = .4
+man5ext = .5
+man6ext = .6
+man7ext = .7
+man8ext = .8
+
+# 7.2.7: Install Command Categories
+# ---------------------------------
+
+PRE_INSTALL =
+POST_INSTALL =
+NORMAL_INSTALL =
+
+PRE_UNINSTALL =
+POST_UNINSTALL =
+NORMAL_UNINSTALL =
diff --git a/src/Makefile b/src/Makefile
index b84e6076a0..5da6a48833 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -23,5 +23,70 @@
include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
+at.subdirs += busctl
+at.subdirs += grp-boot
+at.subdirs += grp-coredump
+#at.subdirs += grp-hostname
+#at.subdirs += grp-import
+#at.subdirs += grp-journal
+#at.subdirs += grp-journal-remote
+#at.subdirs += grp-locale
+#at.subdirs += grp-login
+#at.subdirs += grp-machine
+#at.subdirs += grp-network
+at.subdirs += grp-resolve
+#at.subdirs += grp-system
+at.subdirs += grp-timedate
+at.subdirs += grp-udev
+at.subdirs += kernel-install
+at.subdirs += libbasic
+at.subdirs += libcore
+at.subdirs += libfirewall
+at.subdirs += libshared
+at.subdirs += libsystemd
+at.subdirs += libsystemd-network
+at.subdirs += libudev
+at.subdirs += nss-myhostname
+at.subdirs += systemd-activate
+at.subdirs += systemd-ac-power
+at.subdirs += systemd-analyze
+at.subdirs += systemd-ask-password
+at.subdirs += systemd-cgls
+at.subdirs += systemd-cgroups-agent
+at.subdirs += systemd-cgtop
+at.subdirs += systemd-cryptsetup
+at.subdirs += systemd-dbus1-generator
+at.subdirs += systemd-debug-generator
+at.subdirs += systemd-delta
+at.subdirs += systemd-escape
+at.subdirs += systemd-firstboot
+at.subdirs += systemd-fsck
+at.subdirs += systemd-fstab-generator
+at.subdirs += systemd-getty-generator
+at.subdirs += systemd-gpt-auto-generator
+at.subdirs += systemd-hibernate-resume
+at.subdirs += systemd-hwdb
+at.subdirs += systemd-initctl
+at.subdirs += systemd-machine-id-setup
+at.subdirs += systemd-modules-load
+at.subdirs += systemd-notify
+at.subdirs += systemd-nspawn
+at.subdirs += systemd-path
+at.subdirs += systemd-rc-local-generator
+at.subdirs += systemd-remount-fs
+at.subdirs += systemd-reply-password
+at.subdirs += systemd-run
+at.subdirs += systemd-shutdown
+at.subdirs += systemd-socket-proxyd
+at.subdirs += systemd-stdio-bridge
+at.subdirs += systemd-sysctl
+at.subdirs += systemd-sysusers
+at.subdirs += systemd-system-update-generator
+at.subdirs += systemd-sysv-generator
+at.subdirs += systemd-timesyncd
+at.subdirs += systemd-tmpfiles
+at.subdirs += systemd-tty-ask-password-agent
+at.subdirs += systemd-update-done
+at.subdirs += systemd-update-utmp
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index 0281409edf..dd49f2482e 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -22,10 +22,10 @@
#include <systemd/sd-bus.h>
#include "alloc-util.h"
-#include "bus-dump.h"
-#include "bus-internal.h"
-#include "bus-signature.h"
-#include "bus-type.h"
+#include "sd-bus/bus-dump.h"
+#include "sd-bus/bus-internal.h"
+#include "sd-bus/bus-signature.h"
+#include "sd-bus/bus-type.h"
#include "bus-util.h"
#include "busctl-introspect.h"
#include "escape.h"
diff --git a/src/grp-boot/bootctl/Makefile b/src/grp-boot/bootctl/Makefile
index 84253d2387..a983e32a9f 100644
--- a/src/grp-boot/bootctl/Makefile
+++ b/src/grp-boot/bootctl/Makefile
@@ -51,4 +51,5 @@ dist_zshcompletion_data += \
shell-completion/zsh/_bootctl
endif # HAVE_BLKID
endif # ENABLE_EFI
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-boot/systemd-boot/Makefile b/src/grp-boot/systemd-boot/Makefile
index 5b53fdc7e4..2a56560c2c 100644
--- a/src/grp-boot/systemd-boot/Makefile
+++ b/src/grp-boot/systemd-boot/Makefile
@@ -25,6 +25,7 @@ include $(topsrcdir)/build-aux/Makefile.head.mk
ifneq ($(ENABLE_EFI),)
ifneq ($(HAVE_GNUEFI),)
+# ------------------------------------------------------------------------------
efi_cppflags = \
$(EFI_CPPFLAGS) \
-I$(top_builddir) -include config.h \
@@ -81,9 +82,18 @@ EFI_FORMAT = -O binary
else
EFI_FORMAT = --target=efi-app-$(EFI_ARCH)
endif # ARCH_AARCH64
-endif # HAVE_GNUEFI
-endif # ENABLE_EFI
+$(outdir)/%.o: $(srcdir)/%.c
+ $(AM_V_EFI_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
+
+$(outdir)/%.so:
+ @if test $(words $^) = 0; then echo 'Cannot link EFI library with no dependencies: $@' >&2; exit 1; fi
+ $(AM_V_EFI_CCLD)$(LD) $(efi_ldflags) $^ -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name)
+ $(AM_V_at)! { nm -D -u $@ | grep ' U '; }
+
+# These next 2 are the same rule
+$(outdir)/%$(EFI_MACHINE_TYPE_NAME).efi : $(outdir)/%.so; $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@
+$(outdir)/%$(EFI_MACHINE_TYPE_NAME).efi.stub: $(outdir)/%.so; $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@
# ------------------------------------------------------------------------------
systemd_boot_headers = \
src/boot/efi/util.h \
@@ -102,33 +112,10 @@ systemd_boot_sources = \
src/boot/efi/measure.c \
src/boot/efi/boot.c
-EXTRA_DIST += $(systemd_boot_sources) $(systemd_boot_headers)
-
-systemd_boot_objects = $(addprefix $(top_builddir)/,$(systemd_boot_sources:.c=.o))
-systemd_boot_solib = $(top_builddir)/src/boot/efi/systemd_boot.so
systemd_boot = systemd-boot$(EFI_MACHINE_TYPE_NAME).efi
-
-ifneq ($(ENABLE_EFI),)
-ifneq ($(HAVE_GNUEFI),)
-bootlib_DATA = $(systemd_boot)
-
-$(outdir)/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(top_srcdir)/,$(systemd_boot_headers))
- @$(MKDIR_P) $(top_builddir)/src/boot/efi/
- $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
-
-$(systemd_boot_solib): $(systemd_boot_objects)
- $(AM_V_CCLD)$(LD) $(efi_ldflags) $(systemd_boot_objects) \
- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
- nm -D -u $@ | grep ' U ' && exit 1 || :
-
-$(systemd_boot): $(systemd_boot_solib)
- $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
- -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@
-endif # HAVE_GNUEFI
-endif # ENABLE_EFI
-
-CLEANFILES += $(systemd_boot_objects) $(systemd_boot_solib) $(systemd_boot)
-
+std.out_files += $(systemd_boot)
+std.sys_files += $(bootlibdir)/$(systemd_boot)
+$(outdir)/systemd-boot.so: $(addprefix $(outdir)/,$(notdir $(systemd_boot_sources:.c=.o)))
# ------------------------------------------------------------------------------
stub_headers = \
src/boot/efi/util.h \
@@ -149,46 +136,19 @@ stub_sources = \
src/boot/efi/measure.c \
src/boot/efi/stub.c
-EXTRA_DIST += \
- $(stub_sources) \
- $(stub_headers) \
- test/splash.bmp
-
-stub_objects = $(addprefix $(top_builddir)/,$(stub_sources:.c=.o))
-stub_solib = $(top_builddir)/src/boot/efi/stub.so
stub = linux$(EFI_MACHINE_TYPE_NAME).efi.stub
-
-ifneq ($(ENABLE_EFI),)
-ifneq ($(HAVE_GNUEFI),)
-bootlib_DATA += $(stub)
-
-$(outdir)/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(top_srcdir)/,$(stub_headers))
- @$(MKDIR_P) $(top_builddir)/src/boot/efi/
- $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
-
-$(stub_solib): $(stub_objects)
- $(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \
- -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
- nm -D -u $@ | grep ' U ' && exit 1 || :
-
-$(stub): $(stub_solib)
- $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
- -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@
-endif # HAVE_GNUEFI
-endif # ENABLE_EFI
-
-CLEANFILES += $(stub_objects) $(stub_solib) $(stub)
-
-
+std.out_files += $(stub)
+std.sys_files += $(bootlibdir)/$(stub)
+$(outdir)/linux.so: $(addprefix $(outdir)/,$(notdir $(stub_sources:.c=.o)))
# ------------------------------------------------------------------------------
-CLEANFILES += test-efi-disk.img
-
-test-efi-disk.img: $(systemd_boot) $(stub) test/test-efi-create-disk.sh
- $(AM_V_GEN)test/test-efi-create-disk.sh
+$(outdir)/test-efi-disk.img: $(outdir)/$(systemd_boot) $(outdir)/$(stub) $(srcdir)/test-efi-create-disk.sh
+ $(AM_V_GEN)$(@D)/test-efi-create-disk.sh
-test-efi: test-efi-disk.img
+test-efi: $(outdir)/test-efi-disk.img
$(QEMU) -machine accel=kvm -m 1024 -bios $(QEMU_BIOS) -snapshot test-efi-disk.img
-EXTRA_DIST += test/test-efi-create-disk.sh
-
+std.clean_files += test-efi-disk.img
+# ------------------------------------------------------------------------------
+endif # HAVE_GNUEFI
+endif # ENABLE_EFI
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-coredump/coredumpctl/coredumpctl.c b/src/grp-coredump/coredumpctl/coredumpctl.c
index dc95da3613..d5bad73378 100644
--- a/src/grp-coredump/coredumpctl/coredumpctl.c
+++ b/src/grp-coredump/coredumpctl/coredumpctl.c
@@ -27,10 +27,10 @@
#include <systemd/sd-journal.h>
#include "alloc-util.h"
-#include "compress.h"
+#include "sd-journal/compress.h"
#include "fd-util.h"
#include "fileio.h"
-#include "journal-internal.h"
+#include "sd-journal/journal-internal.h"
#include "log.h"
#include "macro.h"
#include "pager.h"
diff --git a/src/grp-coredump/systemd-coredump/Makefile b/src/grp-coredump/systemd-coredump/Makefile
index bc71db120e..f36ccaf6cc 100644
--- a/src/grp-coredump/systemd-coredump/Makefile
+++ b/src/grp-coredump/systemd-coredump/Makefile
@@ -78,4 +78,7 @@ EXTRA_DIST += \
sysctl.d/50-coredump.conf.in \
units/systemd-coredump@.service.in
+systemd.CPPFLAGS += -I$(topsrcdir)/src/grp-journal/libjournal-core
+systemd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-coredump/systemd-coredump/coredump.c b/src/grp-coredump/systemd-coredump/coredump.c
index bf0e0a038b..c4690930b4 100644
--- a/src/grp-coredump/systemd-coredump/coredump.c
+++ b/src/grp-coredump/systemd-coredump/coredump.c
@@ -36,7 +36,7 @@
#include "alloc-util.h"
#include "capability-util.h"
#include "cgroup-util.h"
-#include "compress.h"
+#include "sd-journal/compress.h"
#include "conf-parser.h"
#include "copy.h"
#include "coredump-vacuum.h"
diff --git a/src/grp-helperunits/systemd-quotacheck/Makefile b/src/grp-helperunits/systemd-quotacheck/Makefile
index 4220946f39..979ae07c9e 100644
--- a/src/grp-helperunits/systemd-quotacheck/Makefile
+++ b/src/grp-helperunits/systemd-quotacheck/Makefile
@@ -43,4 +43,6 @@ EXTRA_DIST += \
nodist_systemunit_DATA += \
units/quotaon.service
+systemd.CPPFLAGS += -DQUOTACHECK=\"$(QUOTACHECK)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-helperunits/systemd-random-seed/Makefile b/src/grp-helperunits/systemd-random-seed/Makefile
index 56d1af7431..65ae60828b 100644
--- a/src/grp-helperunits/systemd-random-seed/Makefile
+++ b/src/grp-helperunits/systemd-random-seed/Makefile
@@ -44,4 +44,7 @@ endif # ENABLE_RANDOMSEED
EXTRA_DIST += \
units/systemd-random-seed.service.in
+systemd.CPPFLAGS += -DRANDOM_SEED_DIR=\"$(localstatedir)/lib/systemd/\"
+systemd.CPPFLAGS += -DRANDOM_SEED=\"$(localstatedir)/lib/systemd/random-seed\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-helperunits/systemd-sleep/Makefile b/src/grp-helperunits/systemd-sleep/Makefile
index 3c9106638f..9ac849f817 100644
--- a/src/grp-helperunits/systemd-sleep/Makefile
+++ b/src/grp-helperunits/systemd-sleep/Makefile
@@ -30,4 +30,6 @@ systemd_sleep_SOURCES = \
systemd_sleep_LDADD = \
libshared.la
+systemd.CPPFLAGS += -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-journal/libjournal-core/journald-server.h b/src/grp-journal/libjournal-core/journald-server.h
index bebb056aa7..65f8c1fc6c 100644
--- a/src/grp-journal/libjournal-core/journald-server.h
+++ b/src/grp-journal/libjournal-core/journald-server.h
@@ -27,7 +27,7 @@
typedef struct Server Server;
#include "hashmap.h"
-#include "journal-file.h"
+#include "sd-journal/journal-file.h"
#include "journald-rate-limit.h"
#include "journald-stream.h"
#include "list.h"
diff --git a/src/grp-machine/Makefile b/src/grp-machine/Makefile
index 7412341233..59142f78bd 100644
--- a/src/grp-machine/Makefile
+++ b/src/grp-machine/Makefile
@@ -24,6 +24,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
at.subdirs += machinectl systemd-machined
+at.subdirs += libmachine-core
at.subdirs += nss-mymachines
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-resolve/nss-resolve/nss-resolve.c b/src/grp-resolve/nss-resolve/nss-resolve.c
index 4c2101d856..d2b501f153 100644
--- a/src/grp-resolve/nss-resolve/nss-resolve.c
+++ b/src/grp-resolve/nss-resolve/nss-resolve.c
@@ -26,7 +26,7 @@
#include <systemd/sd-bus.h>
-#include "bus-common-errors.h"
+#include "sd-bus/bus-common-errors.h"
#include "in-addr-util.h"
#include "macro.h"
#include "nss-util.h"
diff --git a/src/grp-resolve/systemd-resolved/Makefile b/src/grp-resolve/systemd-resolved/Makefile
index e18b1b3d90..33b53fedef 100644
--- a/src/grp-resolve/systemd-resolved/Makefile
+++ b/src/grp-resolve/systemd-resolved/Makefile
@@ -24,16 +24,13 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-$(outdir)/dns_type-list.txt: src/resolve/dns-type.h
- $(AM_V_at)$(MKDIR_P) $(dir $@)
+$(outdir)/dns_type-list.txt: $(srcdir)/dns-type.h
$(AM_V_GEN)$(SED) -n -r 's/.* DNS_TYPE_(\w+).*/\1/p' <$< >$@
-$(outdir)/dns_type-to-name.h: src/resolve/dns_type-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
+$(outdir)/dns_type-to-name.h: $(outdir)/dns_type-list.txt
$(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *dns_type_to_string(int type) {\n\tswitch(type) {" } {printf " case DNS_TYPE_%s: return ", $$1; sub(/_/, "-"); printf "\"%s\";\n", $$1 } END{ print " default: return NULL;\n\t}\n}\n" }' <$< >$@
-$(outdir)/dns_type-from-name.gperf: src/resolve/dns_type-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
+$(outdir)/dns_type-from-name.gperf: $(outdir)/dns_type-list.txt
$(AM_V_GEN)$(AWK) 'BEGIN{ print "struct dns_type_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { s=$$1; sub(/_/, "-", s); printf "%s, ", $$s; printf "DNS_TYPE_%s\n", $$1 }' <$< >$@
ifneq ($(ENABLE_RESOLVED),)
@@ -224,4 +221,8 @@ EXTRA_DIST += \
units/systemd-resolved.service.m4.in \
src/resolve/resolved.conf.in
+
+$(outdir)/dns-type.o: $(outdir)/dns_type-from-name.h $(outdir)/dns_type-to-name.h
+systemd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-resolve/systemd-resolved/gcrypt-util.c b/src/grp-resolve/systemd-resolved/gcrypt-util.c
new file mode 120000
index 0000000000..79dc82a466
--- /dev/null
+++ b/src/grp-resolve/systemd-resolved/gcrypt-util.c
@@ -0,0 +1 @@
+../../libshared/gcrypt-util.c \ No newline at end of file
diff --git a/src/grp-resolve/systemd-resolved/gcrypt-util.h b/src/grp-resolve/systemd-resolved/gcrypt-util.h
new file mode 120000
index 0000000000..6da58160eb
--- /dev/null
+++ b/src/grp-resolve/systemd-resolved/gcrypt-util.h
@@ -0,0 +1 @@
+../../libshared/gcrypt-util.h \ No newline at end of file
diff --git a/src/grp-resolve/systemd-resolved/resolve-tool.c b/src/grp-resolve/systemd-resolved/resolve-tool.c
index fbf7b0e4f6..65ad9d29db 100644
--- a/src/grp-resolve/systemd-resolved/resolve-tool.c
+++ b/src/grp-resolve/systemd-resolved/resolve-tool.c
@@ -24,7 +24,7 @@
#include "af-list.h"
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "escape.h"
#include "in-addr-util.h"
diff --git a/src/grp-resolve/systemd-resolved/resolved-bus.c b/src/grp-resolve/systemd-resolved/resolved-bus.c
index 33f7c61557..5f2c70eedf 100644
--- a/src/grp-resolve/systemd-resolved/resolved-bus.c
+++ b/src/grp-resolve/systemd-resolved/resolved-bus.c
@@ -18,7 +18,7 @@
***/
#include "alloc-util.h"
-#include "bus-common-errors.h"
+#include "sd-bus/bus-common-errors.h"
#include "bus-util.h"
#include "dns-domain.h"
#include "resolved-bus.h"
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-query.c b/src/grp-resolve/systemd-resolved/resolved-dns-query.c
index ea04e58d61..20dcab78ff 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-query.c
+++ b/src/grp-resolve/systemd-resolved/resolved-dns-query.c
@@ -21,7 +21,7 @@
#include "dns-domain.h"
#include "dns-type.h"
#include "hostname-util.h"
-#include "local-addresses.h"
+#include "sd-netlink/local-addresses.h"
#include "resolved-dns-query.h"
#include "resolved-dns-synthesize.h"
#include "resolved-etc-hosts.h"
diff --git a/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c b/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c
index e3003411f7..5989f049ff 100644
--- a/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c
+++ b/src/grp-resolve/systemd-resolved/resolved-dns-synthesize.c
@@ -19,7 +19,7 @@
#include "alloc-util.h"
#include "hostname-util.h"
-#include "local-addresses.h"
+#include "sd-netlink/local-addresses.h"
#include "resolved-dns-synthesize.h"
int dns_synthesize_ifindex(int ifindex) {
diff --git a/src/grp-resolve/systemd-resolved/resolved-manager.c b/src/grp-resolve/systemd-resolved/resolved-manager.c
index 7166b94d71..c447ff63af 100644
--- a/src/grp-resolve/systemd-resolved/resolved-manager.c
+++ b/src/grp-resolve/systemd-resolved/resolved-manager.c
@@ -28,7 +28,6 @@
#include "fileio-label.h"
#include "hostname-util.h"
#include "io-util.h"
-#include "netlink-util.h"
#include "network-internal.h"
#include "ordered-set.h"
#include "parse-util.h"
diff --git a/src/grp-timedate/systemd-timedated/timedated.c b/src/grp-timedate/systemd-timedated/timedated.c
index 51a13fcf49..b61fce1eb8 100644
--- a/src/grp-timedate/systemd-timedated/timedated.c
+++ b/src/grp-timedate/systemd-timedated/timedated.c
@@ -26,8 +26,8 @@
#include <systemd/sd-messages.h>
#include "alloc-util.h"
-#include "bus-common-errors.h"
-#include "bus-error.h"
+#include "sd-bus/bus-common-errors.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "clock-util.h"
#include "def.h"
diff --git a/src/grp-timedate/timedatectl/Makefile b/src/grp-timedate/timedatectl/Makefile
index c1be945443..4394bf892b 100644
--- a/src/grp-timedate/timedatectl/Makefile
+++ b/src/grp-timedate/timedatectl/Makefile
@@ -39,4 +39,5 @@ dist_bashcompletion_data += \
dist_zshcompletion_data += \
shell-completion/zsh/_timedatectl
endif # ENABLE_TIMEDATED
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-timedate/timedatectl/timedatectl.c b/src/grp-timedate/timedatectl/timedatectl.c
index 1fd542fb49..cea6093d97 100644
--- a/src/grp-timedate/timedatectl/timedatectl.c
+++ b/src/grp-timedate/timedatectl/timedatectl.c
@@ -25,7 +25,7 @@
#include <systemd/sd-bus.h>
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "pager.h"
#include "parse-util.h"
diff --git a/src/grp-udev/Makefile b/src/grp-udev/Makefile
index cc85f0317f..f6c3b1ceb4 100644
--- a/src/grp-udev/Makefile
+++ b/src/grp-udev/Makefile
@@ -69,4 +69,7 @@ SYSINIT_TARGET_WANTS += \
systemd-udevd.service \
systemd-udev-trigger.service
+at.subdirs += systemd-udevd udevadm
+at.subdirs += ata_id cdrom_id collect mtd_probe scsi_id v4l_id
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-udev/libudev-core/Makefile b/src/grp-udev/libudev-core/Makefile
index e95d53120a..d47fbe3257 100644
--- a/src/grp-udev/libudev-core/Makefile
+++ b/src/grp-udev/libudev-core/Makefile
@@ -38,7 +38,7 @@ $(outdir)/keyboard-keys-from-name.h: $(outdir)/keyboard-keys-from-name.gperf
gperf_txt_sources += \
src/udev/keyboard-keys-list.txt
-libudev_core_la_SOURCES = \
+_libudev_core_la_SOURCES = \
src/udev/udev.h \
src/udev/udev-event.c \
src/udev/udev-watch.c \
@@ -59,7 +59,7 @@ libudev_core_la_SOURCES = \
src/udev/net/ethtool-util.h \
src/udev/net/ethtool-util.c
-nodist_libudev_core_la_SOURCES = \
+_nodist_libudev_core_la_SOURCES = \
src/udev/keyboard-keys-from-name.h \
src/udev/net/link-config-gperf.c
@@ -98,4 +98,10 @@ libudev_core_la_SOURCES += \
src/systemd/sd-login.h
endif # HAVE_ACL
+libudev-core.la.SOURCES = $(patsubst src/udev/%,%,$(filter %.c,$(_libudev_core_la_SOURCES) $(_nodist_libudev_core_la_SOURCES)))
+libudev-core.la.DEPENDS = $(addprefix $(outdir)/,$(libudev-core.la.SOURCES:.c=.lo))
+at.subdirs += net
+$(outdir)/udev-builtin-keyboard.lo: $(outdir)/keyboard-keys-from-name.h
+systemd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-udev/libudev-core/logind-acl.c b/src/grp-udev/libudev-core/logind-acl.c
new file mode 120000
index 0000000000..9dd626440f
--- /dev/null
+++ b/src/grp-udev/libudev-core/logind-acl.c
@@ -0,0 +1 @@
+../../grp-login/liblogind-core/logind-acl.c \ No newline at end of file
diff --git a/src/grp-udev/libudev-core/logind-acl.h b/src/grp-udev/libudev-core/logind-acl.h
new file mode 120000
index 0000000000..60f96cbe0a
--- /dev/null
+++ b/src/grp-udev/libudev-core/logind-acl.h
@@ -0,0 +1 @@
+../../grp-login/liblogind-core/logind-acl.h \ No newline at end of file
diff --git a/src/grp-udev/libudev-core/net/Makefile b/src/grp-udev/libudev-core/net/Makefile
new file mode 100644
index 0000000000..153afd5089
--- /dev/null
+++ b/src/grp-udev/libudev-core/net/Makefile
@@ -0,0 +1,30 @@
+# -*- 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+systemd.CPPFLAGS += $(libshared.CPPFLAGS)
+systemd.CPPFLAGS += $(libsystemd-network.CPPFLAGS)
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-udev/libudev-core/net/link-config.c b/src/grp-udev/libudev-core/net/link-config.c
index 350cd24e9c..4582c8b90d 100644
--- a/src/grp-udev/libudev-core/net/link-config.c
+++ b/src/grp-udev/libudev-core/net/link-config.c
@@ -30,7 +30,7 @@
#include "link-config.h"
#include "log.h"
#include "missing.h"
-#include "netlink-util.h"
+#include "sd-netlink/netlink-util.h"
#include "network-internal.h"
#include "parse-util.h"
#include "path-util.h"
diff --git a/src/grp-udev/libudev-core/sd-login.c b/src/grp-udev/libudev-core/sd-login.c
new file mode 120000
index 0000000000..913dcedc6a
--- /dev/null
+++ b/src/grp-udev/libudev-core/sd-login.c
@@ -0,0 +1 @@
+../../libsystemd/src/sd-login/sd-login.c \ No newline at end of file
diff --git a/src/grp-udev/libudev-core/udev-builtin-hwdb.c b/src/grp-udev/libudev-core/udev-builtin-hwdb.c
index b96f39ba20..64790c31bb 100644
--- a/src/grp-udev/libudev-core/udev-builtin-hwdb.c
+++ b/src/grp-udev/libudev-core/udev-builtin-hwdb.c
@@ -25,7 +25,7 @@
#include <systemd/sd-hwdb.h>
#include "alloc-util.h"
-#include "hwdb-util.h"
+#include "sd-hwdb/hwdb-util.h"
#include "string-util.h"
#include "udev-util.h"
#include "udev.h"
diff --git a/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c b/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c
index 8e47775135..62689d4be9 100644
--- a/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c
+++ b/src/grp-udev/libudev-core/udev-builtin-net_setup_link.c
@@ -18,7 +18,7 @@
***/
#include "alloc-util.h"
-#include "link-config.h"
+#include "net/link-config.h"
#include "log.h"
#include "udev.h"
diff --git a/src/grp-udev/libudev-core/udev-event.c b/src/grp-udev/libudev-core/udev-event.c
index 8d601c9c2c..2b79d24d31 100644
--- a/src/grp-udev/libudev-core/udev-event.c
+++ b/src/grp-udev/libudev-core/udev-event.c
@@ -33,7 +33,7 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "formats-util.h"
-#include "netlink-util.h"
+#include "sd-netlink/netlink-util.h"
#include "process-util.h"
#include "signal-util.h"
#include "string-util.h"
diff --git a/src/grp-udev/mtd_probe/Makefile b/src/grp-udev/mtd_probe/Makefile
index d7392a8a3b..50703dddda 100644
--- a/src/grp-udev/mtd_probe/Makefile
+++ b/src/grp-udev/mtd_probe/Makefile
@@ -34,4 +34,6 @@ dist_udevrules_DATA += \
udevlibexec_PROGRAMS += \
mtd_probe
+mtd_probe_LDADD += libbasic.la
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-udev/systemd-udevd/udevd.c b/src/grp-udev/systemd-udevd/udevd.c
index 89006e6e3a..089a7eb591 100644
--- a/src/grp-udev/systemd-udevd/udevd.c
+++ b/src/grp-udev/systemd-udevd/udevd.c
@@ -53,7 +53,6 @@
#include "fs-util.h"
#include "hashmap.h"
#include "io-util.h"
-#include "netlink-util.h"
#include "parse-util.h"
#include "proc-cmdline.h"
#include "process-util.h"
diff --git a/src/grp-udev/udevadm/Makefile b/src/grp-udev/udevadm/Makefile
index ba3b466935..ef173b234b 100644
--- a/src/grp-udev/udevadm/Makefile
+++ b/src/grp-udev/udevadm/Makefile
@@ -42,4 +42,6 @@ udevadm_SOURCES = \
udevadm_LDADD = \
libudev-core.la
+systemd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/grp-udev/udevadm/udevadm-hwdb.c b/src/grp-udev/udevadm/udevadm-hwdb.c
index 948ad0f5a5..d727ed22a8 100644
--- a/src/grp-udev/udevadm/udevadm-hwdb.c
+++ b/src/grp-udev/udevadm/udevadm-hwdb.c
@@ -26,8 +26,8 @@
#include "conf-files.h"
#include "fileio.h"
#include "fs-util.h"
-#include "hwdb-internal.h"
-#include "hwdb-util.h"
+#include "sd-hwdb/hwdb-internal.h"
+#include "sd-hwdb/hwdb-util.h"
#include "strbuf.h"
#include "string-util.h"
#include "udev.h"
diff --git a/src/libbasic/Makefile b/src/libbasic/Makefile
index 9f8d4ec995..ded8e4de8b 100644
--- a/src/libbasic/Makefile
+++ b/src/libbasic/Makefile
@@ -264,8 +264,8 @@ $(outdir)/arphrd-from-name.gperf: $(outdir)/arphrd-list.txt
$(AM_V_GEN)$(AWK) 'BEGIN{ print "struct arphrd_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, ARPHRD_%s\n", $$1, $$1 }' <$< >$@
-$(outdir)/cap-list.txt:
- $(AM_V_GEN)$(CPP) $(ALL_CPPFLAGS) -dM -include linux/capability.h -include missing.h - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@
+$(outdir)/cap-list.txt: $(srcdir)/missing.h
+ $(AM_V_GEN)$(CPP) $(ALL_CPPFLAGS) -dM -include linux/capability.h -include $< - </dev/null | $(AWK) '/^#define[ \t]+CAP_[A-Z_]+[ \t]+/ { print $$2; }' | grep -v CAP_LAST_CAP >$@
$(outdir)/cap-to-name.h: $(outdir)/cap-list.txt
$(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@
@@ -276,4 +276,9 @@ $(outdir)/cap-from-name.gperf: $(outdir)/cap-list.txt
$(outdir)/cap-from-name.h: $(outdir)/cap-from-name.gperf
$(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@
+$(outdir)/af-list.lo: $(outdir)/af-from-name.h $(outdir)/af-to-name.h
+$(outdir)/arphrd-list.lo: $(outdir)/arphrd-from-name.h $(outdir)/arphrd-to-name.h
+$(outdir)/cap-list.lo: $(outdir)/cap-from-name.h $(outdir)/cap-to-name.h
+$(outdir)/errno-list.lo: $(outdir)/errno-from-name.h $(outdir)/errno-to-name.h
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libcore/Makefile b/src/libcore/Makefile
index f40a115042..23032ea6f7 100644
--- a/src/libcore/Makefile
+++ b/src/libcore/Makefile
@@ -163,8 +163,13 @@ libcore_la_LIBADD = \
$(APPARMOR_LIBS) \
$(MOUNT_LIBS)
-$(outdir)/load-fragment-gperf-nulstr.c: src/core/load-fragment-gperf.gperf
- $(AM_V_at)$(MKDIR_P) $(dir $@)
+$(outdir)/load-fragment-gperf-nulstr.c: $(outdir)/load-fragment-gperf.gperf
$(AM_V_GEN)$(AWK) 'BEGIN{ keywords=0 ; FS="," ; print "extern const char load_fragment_gperf_nulstr[];" ; print "const char load_fragment_gperf_nulstr[] ="} ; keyword==1 { print "\"" $$1 "\\0\"" } ; /%%/ { keyword=1} ; END { print ";" }' < $< > $@
+systemd.CPPFLAGS += -I$(topsrcdir)/src/libudev/src
+systemd.CPPFLAGS += -DMOUNT_PATH=\"$(MOUNT_PATH)\"
+systemd.CPPFLAGS += -DUMOUNT_PATH=\"$(UMOUNT_PATH)\"
+systemd.CPPFLAGS += -DSYSTEMD_CGROUP_AGENT_PATH=\"$(libexecdir)/systemd-cgroups-agent\"
+systemd.CPPFLAGS += -DSYSTEMD_BINARY_PATH=\"$(libexecdir)/systemd\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libcore/automount.c b/src/libcore/automount.c
index f06d837e30..fdd23327e2 100644
--- a/src/libcore/automount.c
+++ b/src/libcore/automount.c
@@ -30,7 +30,7 @@
#include "alloc-util.h"
#include "async.h"
#include "automount.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "dbus-automount.h"
#include "fd-util.h"
diff --git a/src/libcore/bus-policy.c b/src/libcore/bus-policy.c
index 4907c268e8..4976908b90 100644
--- a/src/libcore/bus-policy.c
+++ b/src/libcore/bus-policy.c
@@ -20,9 +20,9 @@
#include <stdlib.h>
#include "alloc-util.h"
-#include "bus-kernel.h"
+#include "sd-bus/bus-kernel.h"
#include "bus-policy.h"
-#include "kdbus.h"
+#include "sd-bus/kdbus.h"
#include "string-table.h"
#include "user-util.h"
#include "util.h"
diff --git a/src/libcore/bus-policy.h b/src/libcore/bus-policy.h
index 5b2c4d5953..2b3b382826 100644
--- a/src/libcore/bus-policy.h
+++ b/src/libcore/bus-policy.h
@@ -19,7 +19,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "kdbus.h"
+#include "sd-bus/kdbus.h"
#include "list.h"
#include "macro.h"
diff --git a/src/libcore/busname.c b/src/libcore/busname.c
index f03a95c24e..206f76787a 100644
--- a/src/libcore/busname.c
+++ b/src/libcore/busname.c
@@ -20,15 +20,15 @@
#include <sys/mman.h>
#include "alloc-util.h"
-#include "bus-internal.h"
-#include "bus-kernel.h"
+#include "sd-bus/bus-internal.h"
+#include "sd-bus/bus-kernel.h"
#include "bus-policy.h"
#include "bus-util.h"
#include "busname.h"
#include "dbus-busname.h"
#include "fd-util.h"
#include "formats-util.h"
-#include "kdbus.h"
+#include "sd-bus/kdbus.h"
#include "parse-util.h"
#include "process-util.h"
#include "service.h"
diff --git a/src/libcore/dbus-manager.c b/src/libcore/dbus-manager.c
index 86722e1162..4d2f425692 100644
--- a/src/libcore/dbus-manager.c
+++ b/src/libcore/dbus-manager.c
@@ -24,7 +24,7 @@
#include "alloc-util.h"
#include "architecture.h"
#include "build.h"
-#include "bus-common-errors.h"
+#include "sd-bus/bus-common-errors.h"
#include "clock-util.h"
#include "dbus-execute.h"
#include "dbus-job.h"
diff --git a/src/libcore/dbus-scope.c b/src/libcore/dbus-scope.c
index 34ee9a8fa9..b5a3072544 100644
--- a/src/libcore/dbus-scope.c
+++ b/src/libcore/dbus-scope.c
@@ -18,8 +18,8 @@
***/
#include "alloc-util.h"
-#include "bus-common-errors.h"
-#include "bus-internal.h"
+#include "sd-bus/bus-common-errors.h"
+#include "sd-bus/bus-internal.h"
#include "bus-util.h"
#include "dbus-cgroup.h"
#include "dbus-kill.h"
diff --git a/src/libcore/dbus-unit.c b/src/libcore/dbus-unit.c
index dcd8db0898..8d5b1bad85 100644
--- a/src/libcore/dbus-unit.c
+++ b/src/libcore/dbus-unit.c
@@ -20,7 +20,7 @@
#include <systemd/sd-bus.h>
#include "alloc-util.h"
-#include "bus-common-errors.h"
+#include "sd-bus/bus-common-errors.h"
#include "cgroup-util.h"
#include "dbus-unit.h"
#include "dbus.h"
diff --git a/src/libcore/dbus.c b/src/libcore/dbus.c
index 1b217da303..987b7fe5f1 100644
--- a/src/libcore/dbus.c
+++ b/src/libcore/dbus.c
@@ -24,9 +24,9 @@
#include <systemd/sd-bus.h>
#include "alloc-util.h"
-#include "bus-common-errors.h"
-#include "bus-error.h"
-#include "bus-internal.h"
+#include "sd-bus/bus-common-errors.h"
+#include "sd-bus/bus-error.h"
+#include "sd-bus/bus-internal.h"
#include "bus-util.h"
#include "dbus-cgroup.h"
#include "dbus-execute.h"
diff --git a/src/libcore/failure-action.c b/src/libcore/failure-action.c
index ddae46190f..b40c8b0dbc 100644
--- a/src/libcore/failure-action.c
+++ b/src/libcore/failure-action.c
@@ -21,7 +21,7 @@
#include <sys/reboot.h>
#include <linux/reboot.h>
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "failure-action.h"
#include "special.h"
diff --git a/src/libcore/load-fragment.c b/src/libcore/load-fragment.c
index 86b4fb071b..d793f12563 100644
--- a/src/libcore/load-fragment.c
+++ b/src/libcore/load-fragment.c
@@ -32,8 +32,8 @@
#include "af-list.h"
#include "alloc-util.h"
-#include "bus-error.h"
-#include "bus-internal.h"
+#include "sd-bus/bus-error.h"
+#include "sd-bus/bus-internal.h"
#include "bus-util.h"
#include "cap-list.h"
#include "capability-util.h"
diff --git a/src/libcore/loopback-setup.c b/src/libcore/loopback-setup.c
index d56bbfa6fc..1a8ec6166e 100644
--- a/src/libcore/loopback-setup.c
+++ b/src/libcore/loopback-setup.c
@@ -24,7 +24,6 @@
#include "loopback-setup.h"
#include "missing.h"
-#include "netlink-util.h"
static int start_loopback(sd_netlink *rtnl) {
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
diff --git a/src/libcore/manager.c b/src/libcore/manager.c
index 831fdbaabf..1b8d61fc70 100644
--- a/src/libcore/manager.c
+++ b/src/libcore/manager.c
@@ -41,9 +41,9 @@
#include "alloc-util.h"
#include "audit-fd.h"
#include "boot-timestamps.h"
-#include "bus-common-errors.h"
-#include "bus-error.h"
-#include "bus-kernel.h"
+#include "sd-bus/bus-common-errors.h"
+#include "sd-bus/bus-error.h"
+#include "sd-bus/bus-kernel.h"
#include "bus-util.h"
#include "dbus-job.h"
#include "dbus-manager.h"
diff --git a/src/libcore/path.c b/src/libcore/path.c
index 0dd0d375d8..968bd5057e 100644
--- a/src/libcore/path.c
+++ b/src/libcore/path.c
@@ -22,7 +22,7 @@
#include <sys/inotify.h>
#include <unistd.h>
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "dbus-path.h"
#include "fd-util.h"
diff --git a/src/libcore/service.c b/src/libcore/service.c
index 7ebabca5d6..f585743a32 100644
--- a/src/libcore/service.c
+++ b/src/libcore/service.c
@@ -23,8 +23,8 @@
#include "alloc-util.h"
#include "async.h"
-#include "bus-error.h"
-#include "bus-kernel.h"
+#include "sd-bus/bus-error.h"
+#include "sd-bus/bus-kernel.h"
#include "bus-util.h"
#include "dbus-service.h"
#include "def.h"
diff --git a/src/libcore/socket.c b/src/libcore/socket.c
index f6204d04bf..fd4ea5f9a9 100644
--- a/src/libcore/socket.c
+++ b/src/libcore/socket.c
@@ -29,7 +29,7 @@
#include <linux/sctp.h>
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "copy.h"
#include "dbus-socket.h"
diff --git a/src/libcore/timer.c b/src/libcore/timer.c
index 3206296f09..cf7249af09 100644
--- a/src/libcore/timer.c
+++ b/src/libcore/timer.c
@@ -20,7 +20,7 @@
#include <errno.h>
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "dbus-timer.h"
#include "fs-util.h"
diff --git a/src/libcore/transaction.c b/src/libcore/transaction.c
index e06a48a2f1..5233f89204 100644
--- a/src/libcore/transaction.c
+++ b/src/libcore/transaction.c
@@ -21,8 +21,8 @@
#include <unistd.h>
#include "alloc-util.h"
-#include "bus-common-errors.h"
-#include "bus-error.h"
+#include "sd-bus/bus-common-errors.h"
+#include "sd-bus/bus-error.h"
#include "terminal-util.h"
#include "transaction.h"
#include "dbus-unit.h"
diff --git a/src/libcore/unit.c b/src/libcore/unit.c
index 8bd39f87f9..416c1ec7e9 100644
--- a/src/libcore/unit.c
+++ b/src/libcore/unit.c
@@ -27,7 +27,7 @@
#include <systemd/sd-messages.h>
#include "alloc-util.h"
-#include "bus-common-errors.h"
+#include "sd-bus/bus-common-errors.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "dbus-unit.h"
diff --git a/src/libfirewall/Makefile b/src/libfirewall/Makefile
index ced0f7e476..ebc567cc55 100644
--- a/src/libfirewall/Makefile
+++ b/src/libfirewall/Makefile
@@ -39,4 +39,6 @@ libfirewall_la_LIBADD = \
$(LIBIPTC_LIBS)
endif # HAVE_LIBIPTC
+systemd.CPPFLAGS += $(libbasic.CPPFLAGS)
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libshared/Makefile b/src/libshared/Makefile
index 1d5dbd394d..66000b782c 100644
--- a/src/libshared/Makefile
+++ b/src/libshared/Makefile
@@ -134,10 +134,26 @@ libshared_la_CFLAGS = \
libshared_la_LIBADD = \
libsystemd-internal.la \
- libsystemd-journal-internal.la \
libudev-internal.la \
$(ACL_LIBS) \
$(LIBIDN_LIBS) \
$(SECCOMP_LIBS)
+systemd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
+systemd.CPPFLAGS += -DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\"
+systemd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\"
+systemd.CPPFLAGS += -DSYSTEM_SYSVINIT_PATH=\"$(SYSTEM_SYSVINIT_PATH)\"
+systemd.CPPFLAGS += -DSYSTEM_SYSVRCND_PATH=\"$(SYSTEM_SYSVRCND_PATH)\"
+systemd.CPPFLAGS += -DUSER_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/user\"
+systemd.CPPFLAGS += -DUSER_DATA_UNIT_PATH=\"$(userunitdir)\"
+
+systemd.CPPFLAGS += -DSYSTEMD_FSCK_PATH=\"$(libexecdir)/systemd-fsck\"
+
+systemd.CPPFLAGS += -DSYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH=\"$(bindir)/systemd-tty-ask-password-agent\"
+
+systemd.CPPFLAGS += -DSYSTEM_GENERATOR_PATH=\"$(systemgeneratordir)\"
+systemd.CPPFLAGS += -DUSER_GENERATOR_PATH=\"$(usergeneratordir)\"
+
+systemd.CPPFLAGS += -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libshared/bus-unit-util.c b/src/libshared/bus-unit-util.c
index f68c4a41ac..dcd045eddd 100644
--- a/src/libshared/bus-unit-util.c
+++ b/src/libshared/bus-unit-util.c
@@ -18,7 +18,7 @@
***/
#include "alloc-util.h"
-#include "bus-internal.h"
+#include "sd-bus/bus-internal.h"
#include "bus-unit-util.h"
#include "bus-util.h"
#include "cgroup-util.h"
diff --git a/src/libshared/bus-util.c b/src/libshared/bus-util.c
index 62b5585e84..62c77a565a 100644
--- a/src/libshared/bus-util.c
+++ b/src/libshared/bus-util.c
@@ -35,9 +35,9 @@
#include <systemd/sd-id128.h>
#include "alloc-util.h"
-#include "bus-internal.h"
+#include "sd-bus/bus-internal.h"
#include "bus-label.h"
-#include "bus-message.h"
+#include "sd-bus/bus-message.h"
#include "bus-util.h"
#include "def.h"
#include "escape.h"
diff --git a/src/libshared/logs-show.c b/src/libshared/logs-show.c
index 294fa3bede..97d0d2ffe4 100644
--- a/src/libshared/logs-show.c
+++ b/src/libshared/logs-show.c
@@ -37,7 +37,7 @@
#include "hashmap.h"
#include "hostname-util.h"
#include "io-util.h"
-#include "journal-internal.h"
+#include "sd-journal/journal-internal.h"
#include "log.h"
#include "logs-show.h"
#include "macro.h"
diff --git a/src/libsystemd-network/Makefile b/src/libsystemd-network/Makefile
index 6b16906c17..b3fc7d0640 100644
--- a/src/libsystemd-network/Makefile
+++ b/src/libsystemd-network/Makefile
@@ -170,4 +170,7 @@ tests += \
test-dhcp6-client \
test-lldp
+systemd.CPPFLAGS += $(libshared.CPPFLAGS)
+systemd.CPPFLAGS += -I$(topsrcdir)/src/libudev/src
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/Makefile b/src/libsystemd/Makefile
index 2c6505918b..a193f4592d 100644
--- a/src/libsystemd/Makefile
+++ b/src/libsystemd/Makefile
@@ -32,11 +32,11 @@ EXTRA_DIST += \
src/libsystemd/sd-bus/DIFFERENCES \
src/libsystemd/sd-bus/GVARIANT-SERIALIZATION
-libsystemd_la_SOURCES = \
+_libsystemd_la_SOURCES = \
$(libsystemd_internal_la_SOURCES) \
$(libsystemd_journal_internal_la_SOURCES)
-nodist_libsystemd_la_SOURCES = \
+_nodist_libsystemd_la_SOURCES = \
$(nodist_libsystemd_internal_la_SOURCES)
libsystemd_la_CFLAGS = \
@@ -107,4 +107,8 @@ nodist_test_libsystemd_sym_SOURCES = \
test_libsystemd_sym_LDADD = \
libsystemd.la
+$(outdir)/libsystemd.la: $(srcdir)/libsystemd.sym
+at.subdirs += src
+systemd.sed_files += libsystemd.pc
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/src/Makefile b/src/libsystemd/src/Makefile
index dceadf81da..5ebeb9d7fa 100644
--- a/src/libsystemd/src/Makefile
+++ b/src/libsystemd/src/Makefile
@@ -23,7 +23,7 @@
include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-libsystemd_internal_la_SOURCES = \
+_libsystemd_internal_la_SOURCES = \
src/systemd/sd-bus.h \
src/systemd/sd-bus-protocol.h \
src/systemd/sd-bus-vtable.h \
@@ -255,7 +255,7 @@ pkginclude_HEADERS += \
src/systemd/sd-messages.h \
src/systemd/_sd-common.h
-libsystemd_journal_internal_la_SOURCES = \
+_libsystemd_journal_internal_la_SOURCES = \
src/journal/sd-journal.c \
src/systemd/sd-journal.h \
src/systemd/_sd-common.h \
@@ -309,7 +309,7 @@ libsystemd_journal_internal_la_LIBADD += \
endif # HAVE_LZ4
ifneq ($(HAVE_GCRYPT),)
-libsystemd_journal_internal_la_SOURCES += \
+_libsystemd_journal_internal_la_SOURCES += \
src/journal/journal-authenticate.c \
src/journal/journal-authenticate.h \
src/journal/fsprg.c \
@@ -324,6 +324,17 @@ libsystemd_journal_internal_la_CFLAGS += \
-Wno-pointer-arith
endif # HAVE_GCRYPT
-noinst_LTLIBRARIES += \
+_noinst_LTLIBRARIES += \
libsystemd-journal-internal.la
+
+libsystemd_internal_la_CFLAGS += $(libsystemd_journal_internal_la_CFLAGS)
+libsystemd_internal_la_LIBADD += $(libsystemd_journal_internal_la_LIBADD)
+libsystemd_internal_la_LDADD += $(libsystemd_journal_internal_la_LDADD)
+
+libsystemd-internal.la.SOURCES =
+libsystemd-internal.la.SOURCES += $(patsubst src/libsystemd/%,%,$(filter %.c,$(_libsystemd_internal_la_SOURCES)))
+libsystemd-internal.la.SOURCES += $(addprefix sd-journal/,$(notdir $(filter %.c,$(_libsystemd_journal_internal_la_SOURCES))))
+libsystemd-internal.la.DEPENDS = $(addprefix $(outdir)/,$(libsystemd-internal.la.SOURCES:.c=.lo))
+at.subdirs += $(sort $(dir $(libsystemd-internal.la.SOURCES)))
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/src/sd-bus/Makefile b/src/libsystemd/src/sd-bus/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-bus/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-daemon/Makefile b/src/libsystemd/src/sd-daemon/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-daemon/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-device/Makefile b/src/libsystemd/src/sd-device/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-device/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-event/Makefile b/src/libsystemd/src/sd-event/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-event/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-hwdb/Makefile b/src/libsystemd/src/sd-hwdb/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-hwdb/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-id128/Makefile b/src/libsystemd/src/sd-id128/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-id128/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-journal/Makefile b/src/libsystemd/src/sd-journal/Makefile
index 5b1b4af5ba..7f1caf0836 100644
--- a/src/libsystemd/src/sd-journal/Makefile
+++ b/src/libsystemd/src/sd-journal/Makefile
@@ -20,20 +20,23 @@
#
# 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
-audit_list_includes = -include linux/audit.h -include missing.h
+audit_list_includes = -include linux/audit.h -include $(topsrcdir)/src/libbasic/missing.h
ifneq ($(HAVE_AUDIT),)
audit_list_includes += -include libaudit.h
endif # HAVE_AUDIT
-$(outdir)/audit_type-list.txt:
- $(AM_V_at)$(MKDIR_P) $(dir $@)
- $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM $(audit_list_includes) - </dev/null | grep -vE 'AUDIT_.*(FIRST|LAST)_' | $(SED) -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | sort -k2 >$@
+$(outdir)/audit_type-list.txt: $(call at.path,$(topsrcdir)/src/libbasic/missing.h)
+ $(AM_V_GEN)$(CPP) $(ALL_CPPFLAGS) -dM $(audit_list_includes) - </dev/null | grep -vE 'AUDIT_.*(FIRST|LAST)_' | $(SED) -r -n 's/^#define\s+AUDIT_(\w+)\s+([0-9]{4})\s*$$/\1\t\2/p' | sort -k2 >$@
-$(outdir)/audit_type-to-name.h: src/journal/audit_type-list.txt
- $(AM_V_at)$(MKDIR_P) $(dir $@)
+$(outdir)/audit_type-to-name.h: $(outdir)/audit_type-list.txt
$(AM_V_GEN)$(AWK) 'BEGIN{ print "const char *audit_type_to_string(int type) {\n\tswitch(type) {" } {printf " case AUDIT_%s: return \"%s\";\n", $$1, $$1 } END{ print " default: return NULL;\n\t}\n}\n" }' <$< >$@
+systemd.CPPFLAGS += $(libbasic.CPPFLAGS)
+systemd.CPPFLAGS += -DCATALOG_DATABASE=\"$(catalogstatedir)/database\"
+$(outdir)/audit-type.lo: $(outdir)/audit_type-to-name.h
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libsystemd/src/sd-journal/gcrypt-util.c b/src/libsystemd/src/sd-journal/gcrypt-util.c
new file mode 120000
index 0000000000..2bd8bde8da
--- /dev/null
+++ b/src/libsystemd/src/sd-journal/gcrypt-util.c
@@ -0,0 +1 @@
+../../../libshared/gcrypt-util.c \ No newline at end of file
diff --git a/src/libsystemd/src/sd-journal/gcrypt-util.h b/src/libsystemd/src/sd-journal/gcrypt-util.h
new file mode 120000
index 0000000000..6de2527ac8
--- /dev/null
+++ b/src/libsystemd/src/sd-journal/gcrypt-util.h
@@ -0,0 +1 @@
+../../../libshared/gcrypt-util.h \ No newline at end of file
diff --git a/src/libsystemd/src/sd-login/Makefile b/src/libsystemd/src/sd-login/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-login/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-netlink/Makefile b/src/libsystemd/src/sd-netlink/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-netlink/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-netlink/local-addresses.c b/src/libsystemd/src/sd-netlink/local-addresses.c
index 1abce75b01..5cceddd03c 100644
--- a/src/libsystemd/src/sd-netlink/local-addresses.c
+++ b/src/libsystemd/src/sd-netlink/local-addresses.c
@@ -23,7 +23,6 @@
#include "alloc-util.h"
#include "local-addresses.h"
#include "macro.h"
-#include "netlink-util.h"
static int address_compare(const void *_a, const void *_b) {
const struct local_address *a = _a, *b = _b;
diff --git a/src/libsystemd/src/sd-network/Makefile b/src/libsystemd/src/sd-network/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-network/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-path/Makefile b/src/libsystemd/src/sd-path/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-path/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-resolve/Makefile b/src/libsystemd/src/sd-resolve/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-resolve/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/sd-utf8/Makefile b/src/libsystemd/src/sd-utf8/Makefile
new file mode 120000
index 0000000000..71a1159ce0
--- /dev/null
+++ b/src/libsystemd/src/sd-utf8/Makefile
@@ -0,0 +1 @@
+../subdir.mk \ No newline at end of file
diff --git a/src/libsystemd/src/subdir.mk b/src/libsystemd/src/subdir.mk
index 35def00fdc..752ffa6aed 100644
--- a/src/libsystemd/src/subdir.mk
+++ b/src/libsystemd/src/subdir.mk
@@ -20,10 +20,15 @@
#
# 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 $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
+
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../../../config.mk
include $(topsrcdir)/build-aux/Makefile.head.mk
+systemd.CPPFLAGS += $(libsystemd.CPPFLAGS)
+systemd.CPPFLAGS += $(libbasic.CPPFLAGS)
+systemd.CPPFLAGS += $(libshared.CPPFLAGS)
systemd.CPPFLAGS += -DLIBDIR=\"$(libdir)\"
systemd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\"
+systemd.CPPFLAGS += -DROOTLIBDIR=\"$(rootlibdir)\"
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libudev/src/Makefile b/src/libudev/src/Makefile
index ed606315e1..77fc1fe6aa 100644
--- a/src/libudev/src/Makefile
+++ b/src/libudev/src/Makefile
@@ -67,9 +67,9 @@ noinst_LTLIBRARIES += \
libudev_internal_la_SOURCES =\
$(libudev_la_SOURCES)
-test-libudev-sym.c: \
- src/libudev/libudev.sym \
- src/udev/udev.h
+$(outdir)/test-libudev-sym.c: \
+ $(srcdir)/libudev.sym \
+ $(srcdir)/udev.h
$(generate-sym-test)
nodist_test_libudev_sym_SOURCES = \
@@ -80,4 +80,6 @@ test_libudev_sym_CFLAGS = \
test_libudev_sym_LDADD = \
libudev.la
+systemd.sed_files += libudev.pc
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/libudev/src/libudev-device-private.c b/src/libudev/src/libudev-device-private.c
index 2aae0726c1..bd18d60c1e 100644
--- a/src/libudev/src/libudev-device-private.c
+++ b/src/libudev/src/libudev-device-private.c
@@ -20,7 +20,7 @@
#include "libudev.h"
-#include "device-private.h"
+#include "sd-device/device-private.h"
#include "libudev-device-internal.h"
#include "libudev-private.h"
diff --git a/src/libudev/src/libudev-device.c b/src/libudev/src/libudev-device.c
index 6536f4cfbb..6bf2e87189 100644
--- a/src/libudev/src/libudev-device.c
+++ b/src/libudev/src/libudev-device.c
@@ -38,8 +38,8 @@
#include <systemd/sd-device.h>
#include "alloc-util.h"
-#include "device-private.h"
-#include "device-util.h"
+#include "sd-device/device-private.h"
+#include "sd-device/device-util.h"
#include "libudev-device-internal.h"
#include "libudev-private.h"
#include "parse-util.h"
diff --git a/src/libudev/src/libudev-enumerate.c b/src/libudev/src/libudev-enumerate.c
index 9910cea957..ad6b3a9778 100644
--- a/src/libudev/src/libudev-enumerate.c
+++ b/src/libudev/src/libudev-enumerate.c
@@ -32,8 +32,8 @@
#include <systemd/sd-device.h>
#include "alloc-util.h"
-#include "device-enumerator-private.h"
-#include "device-util.h"
+#include "sd-device/device-enumerator-private.h"
+#include "sd-device/device-util.h"
#include "libudev-device-internal.h"
/**
diff --git a/src/libudev/src/libudev-hwdb.c b/src/libudev/src/libudev-hwdb.c
index 8c4b488086..d671484156 100644
--- a/src/libudev/src/libudev-hwdb.c
+++ b/src/libudev/src/libudev-hwdb.c
@@ -20,7 +20,7 @@
#include <systemd/sd-hwdb.h>
#include "alloc-util.h"
-#include "hwdb-util.h"
+#include "sd-hwdb/hwdb-util.h"
#include "libudev-private.h"
/**
diff --git a/src/nss-myhostname/Makefile b/src/nss-myhostname/Makefile
index b5f6ff62aa..201dbde20a 100644
--- a/src/nss-myhostname/Makefile
+++ b/src/nss-myhostname/Makefile
@@ -44,4 +44,6 @@ lib_LTLIBRARIES += \
libnss_myhostname.la
endif # HAVE_MYHOSTNAME
+libnss_myhostname_la_LIBADD += libshared.la # oops, because I moved local-addresses.{c,h} into libshared
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c
index 2b83d127b7..00322c8353 100644
--- a/src/nss-myhostname/nss-myhostname.c
+++ b/src/nss-myhostname/nss-myhostname.c
@@ -26,7 +26,7 @@
#include "alloc-util.h"
#include "hostname-util.h"
-#include "local-addresses.h"
+#include "sd-netlink/local-addresses.h"
#include "macro.h"
#include "nss-util.h"
#include "signal-util.h"
diff --git a/src/systemd-analyze/analyze-verify.c b/src/systemd-analyze/analyze-verify.c
index 5fd3ee49eb..5616947f9b 100644
--- a/src/systemd-analyze/analyze-verify.c
+++ b/src/systemd-analyze/analyze-verify.c
@@ -21,7 +21,7 @@
#include "alloc-util.h"
#include "analyze-verify.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "log.h"
#include "manager.h"
diff --git a/src/systemd-analyze/analyze.c b/src/systemd-analyze/analyze.c
index 0e1eee16ec..c3d36c04c7 100644
--- a/src/systemd-analyze/analyze.c
+++ b/src/systemd-analyze/analyze.c
@@ -27,7 +27,7 @@
#include "alloc-util.h"
#include "analyze-verify.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-unit-util.h"
#include "bus-util.h"
#include "glob-util.h"
diff --git a/src/systemd-cgls/cgls.c b/src/systemd-cgls/cgls.c
index ed2846ee57..640383cbb6 100644
--- a/src/systemd-cgls/cgls.c
+++ b/src/systemd-cgls/cgls.c
@@ -26,7 +26,7 @@
#include <systemd/sd-bus.h>
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "cgroup-show.h"
#include "cgroup-util.h"
diff --git a/src/systemd-cgtop/cgtop.c b/src/systemd-cgtop/cgtop.c
index 6cbea86070..65497a1275 100644
--- a/src/systemd-cgtop/cgtop.c
+++ b/src/systemd-cgtop/cgtop.c
@@ -29,7 +29,7 @@
#include <systemd/sd-bus.h>
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "fd-util.h"
diff --git a/src/systemd-cryptsetup/Makefile b/src/systemd-cryptsetup/Makefile
index 73a46bf6da..116ffbc664 100644
--- a/src/systemd-cryptsetup/Makefile
+++ b/src/systemd-cryptsetup/Makefile
@@ -56,4 +56,6 @@ SYSINIT_TARGET_WANTS += \
endif # HAVE_LIBCRYPTSETUP
+systemd.CPPFLAGS += -DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-cryptsetup/cryptsetup.c b/src/systemd-cryptsetup/cryptsetup.c
index 8024f80e36..cb889965f3 100644
--- a/src/systemd-cryptsetup/cryptsetup.c
+++ b/src/systemd-cryptsetup/cryptsetup.c
@@ -27,7 +27,7 @@
#include "alloc-util.h"
#include "ask-password-api.h"
-#include "device-util.h"
+#include "sd-device/device-util.h"
#include "escape.h"
#include "fileio.h"
#include "log.h"
diff --git a/src/systemd-dbus1-generator/Makefile b/src/systemd-dbus1-generator/Makefile
index 1d7f0d1a81..a817b954e5 100644
--- a/src/systemd-dbus1-generator/Makefile
+++ b/src/systemd-dbus1-generator/Makefile
@@ -46,4 +46,7 @@ dist_xinitrc_SCRIPTS = \
INSTALL_EXEC_HOOKS += dbus1-generator-install-hook
UNINSTALL_EXEC_HOOKS += dbus1-generator-uninstall-hook
+systemd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\"
+systemd.CPPFLAGS += -DUSER_DATA_UNIT_PATH=\"$(userunitdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-dbus1-generator/dbus1-generator.c b/src/systemd-dbus1-generator/dbus1-generator.c
index 717cb9558e..1fd6ee4f39 100644
--- a/src/systemd-dbus1-generator/dbus1-generator.c
+++ b/src/systemd-dbus1-generator/dbus1-generator.c
@@ -18,7 +18,7 @@
***/
#include "alloc-util.h"
-#include "bus-internal.h"
+#include "sd-bus/bus-internal.h"
#include "bus-util.h"
#include "cgroup-util.h"
#include "conf-parser.h"
diff --git a/src/systemd-debug-generator/Makefile b/src/systemd-debug-generator/Makefile
index bba46c2905..6d087d7f37 100644
--- a/src/systemd-debug-generator/Makefile
+++ b/src/systemd-debug-generator/Makefile
@@ -31,4 +31,6 @@ systemd_debug_generator_SOURCES = \
systemd_debug_generator_LDADD = \
libshared.la
+systemd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-fsck/fsck.c b/src/systemd-fsck/fsck.c
index d7f0829ffc..be5551f124 100644
--- a/src/systemd-fsck/fsck.c
+++ b/src/systemd-fsck/fsck.c
@@ -31,10 +31,10 @@
#include <systemd/sd-device.h>
#include "alloc-util.h"
-#include "bus-common-errors.h"
-#include "bus-error.h"
+#include "sd-bus/bus-common-errors.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
-#include "device-util.h"
+#include "sd-device/device-util.h"
#include "fd-util.h"
#include "fs-util.h"
#include "parse-util.h"
diff --git a/src/systemd-fstab-generator/mount-setup.c b/src/systemd-fstab-generator/mount-setup.c
new file mode 120000
index 0000000000..a4ab487157
--- /dev/null
+++ b/src/systemd-fstab-generator/mount-setup.c
@@ -0,0 +1 @@
+../libcore/mount-setup.c \ No newline at end of file
diff --git a/src/systemd-fstab-generator/mount-setup.h b/src/systemd-fstab-generator/mount-setup.h
new file mode 120000
index 0000000000..1f984851f8
--- /dev/null
+++ b/src/systemd-fstab-generator/mount-setup.h
@@ -0,0 +1 @@
+../libcore/mount-setup.h \ No newline at end of file
diff --git a/src/systemd-getty-generator/Makefile b/src/systemd-getty-generator/Makefile
index 14f7d02a86..cfca8e1e1f 100644
--- a/src/systemd-getty-generator/Makefile
+++ b/src/systemd-getty-generator/Makefile
@@ -30,4 +30,6 @@ systemd_getty_generator_SOURCES = \
systemd_getty_generator_LDADD = \
libshared.la
+systemd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-gpt-auto-generator/Makefile b/src/systemd-gpt-auto-generator/Makefile
index 177db8da7c..070d62ba83 100644
--- a/src/systemd-gpt-auto-generator/Makefile
+++ b/src/systemd-gpt-auto-generator/Makefile
@@ -40,4 +40,6 @@ systemd_gpt_auto_generator_CFLAGS = \
$(BLKID_CFLAGS)
endif # HAVE_BLKID
+systemd.CPPFLAGS += -DSYSTEMD_CRYPTSETUP_PATH=\"$(rootlibexecdir)/systemd-cryptsetup\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-hibernate-resume/Makefile b/src/systemd-hibernate-resume/Makefile
index 386f372f78..5a8a0b4ad1 100644
--- a/src/systemd-hibernate-resume/Makefile
+++ b/src/systemd-hibernate-resume/Makefile
@@ -57,4 +57,6 @@ EXTRA_DIST += \
units/systemd-hibernate-resume@.service.in \
units/systemd-hybrid-sleep.service.in
+systemd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-hwdb/Makefile b/src/systemd-hwdb/Makefile
index ce10c46e99..bf14199ffe 100644
--- a/src/systemd-hwdb/Makefile
+++ b/src/systemd-hwdb/Makefile
@@ -73,4 +73,6 @@ EXTRA_DIST += \
hwdb/ids-update.pl \
hwdb/sdio.ids
+systemd.CPPFLAGS += -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-hwdb/hwdb.c b/src/systemd-hwdb/hwdb.c
index 1160dacdf1..e29172a26a 100644
--- a/src/systemd-hwdb/hwdb.c
+++ b/src/systemd-hwdb/hwdb.c
@@ -27,8 +27,8 @@
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
-#include "hwdb-internal.h"
-#include "hwdb-util.h"
+#include "sd-hwdb/hwdb-internal.h"
+#include "sd-hwdb/hwdb-util.h"
#include "mkdir.h"
#include "strbuf.h"
#include "string-util.h"
diff --git a/src/systemd-initctl/initctl.c b/src/systemd-initctl/initctl.c
index 05285e3846..01423d5701 100644
--- a/src/systemd-initctl/initctl.c
+++ b/src/systemd-initctl/initctl.c
@@ -27,7 +27,7 @@
#include <systemd/sd-daemon.h>
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "def.h"
#include "fd-util.h"
diff --git a/src/systemd-machine-id-setup/machine-id-setup.c b/src/systemd-machine-id-setup/machine-id-setup.c
new file mode 120000
index 0000000000..2f0f2d8cf1
--- /dev/null
+++ b/src/systemd-machine-id-setup/machine-id-setup.c
@@ -0,0 +1 @@
+../libcore/machine-id-setup.c \ No newline at end of file
diff --git a/src/systemd-machine-id-setup/machine-id-setup.h b/src/systemd-machine-id-setup/machine-id-setup.h
new file mode 120000
index 0000000000..6b34cb74f4
--- /dev/null
+++ b/src/systemd-machine-id-setup/machine-id-setup.h
@@ -0,0 +1 @@
+../libcore/machine-id-setup.h \ No newline at end of file
diff --git a/src/systemd-nspawn/Makefile b/src/systemd-nspawn/Makefile
index d6f928ebd6..8ea5967add 100644
--- a/src/systemd-nspawn/Makefile
+++ b/src/systemd-nspawn/Makefile
@@ -82,4 +82,6 @@ test_patch_uid_LDADD = \
manual_tests += \
test-patch-uid
+systemd.CPPFLAGS += -I$(topsrcdir)/src/libudev/src
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-nspawn/loopback-setup.c b/src/systemd-nspawn/loopback-setup.c
new file mode 120000
index 0000000000..1078ace0bf
--- /dev/null
+++ b/src/systemd-nspawn/loopback-setup.c
@@ -0,0 +1 @@
+../libcore/loopback-setup.c \ No newline at end of file
diff --git a/src/systemd-nspawn/loopback-setup.h b/src/systemd-nspawn/loopback-setup.h
new file mode 120000
index 0000000000..18fc7663a2
--- /dev/null
+++ b/src/systemd-nspawn/loopback-setup.h
@@ -0,0 +1 @@
+../libcore/loopback-setup.h \ No newline at end of file
diff --git a/src/systemd-nspawn/machine-id-setup.c b/src/systemd-nspawn/machine-id-setup.c
new file mode 120000
index 0000000000..2f0f2d8cf1
--- /dev/null
+++ b/src/systemd-nspawn/machine-id-setup.c
@@ -0,0 +1 @@
+../libcore/machine-id-setup.c \ No newline at end of file
diff --git a/src/systemd-nspawn/machine-id-setup.h b/src/systemd-nspawn/machine-id-setup.h
new file mode 120000
index 0000000000..6b34cb74f4
--- /dev/null
+++ b/src/systemd-nspawn/machine-id-setup.h
@@ -0,0 +1 @@
+../libcore/machine-id-setup.h \ No newline at end of file
diff --git a/src/systemd-nspawn/mount-setup.c b/src/systemd-nspawn/mount-setup.c
new file mode 120000
index 0000000000..a4ab487157
--- /dev/null
+++ b/src/systemd-nspawn/mount-setup.c
@@ -0,0 +1 @@
+../libcore/mount-setup.c \ No newline at end of file
diff --git a/src/systemd-nspawn/mount-setup.h b/src/systemd-nspawn/mount-setup.h
new file mode 120000
index 0000000000..1f984851f8
--- /dev/null
+++ b/src/systemd-nspawn/mount-setup.h
@@ -0,0 +1 @@
+../libcore/mount-setup.h \ No newline at end of file
diff --git a/src/systemd-nspawn/nspawn-expose-ports.c b/src/systemd-nspawn/nspawn-expose-ports.c
index 8122a14f7b..56afe930ac 100644
--- a/src/systemd-nspawn/nspawn-expose-ports.c
+++ b/src/systemd-nspawn/nspawn-expose-ports.c
@@ -23,8 +23,7 @@
#include "fd-util.h"
#include "firewall-util.h"
#include "in-addr-util.h"
-#include "local-addresses.h"
-#include "netlink-util.h"
+#include "sd-netlink/local-addresses.h"
#include "nspawn-expose-ports.h"
#include "parse-util.h"
#include "socket-util.h"
diff --git a/src/systemd-nspawn/nspawn-network.c b/src/systemd-nspawn/nspawn-network.c
index 7052fb5804..917827eac1 100644
--- a/src/systemd-nspawn/nspawn-network.c
+++ b/src/systemd-nspawn/nspawn-network.c
@@ -27,7 +27,6 @@
#include "alloc-util.h"
#include "ether-addr-util.h"
#include "lockfile-util.h"
-#include "netlink-util.h"
#include "nspawn-network.h"
#include "siphash24.h"
#include "socket-util.h"
diff --git a/src/systemd-nspawn/nspawn-register.c b/src/systemd-nspawn/nspawn-register.c
index adef200cb5..02359ca773 100644
--- a/src/systemd-nspawn/nspawn-register.c
+++ b/src/systemd-nspawn/nspawn-register.c
@@ -19,7 +19,7 @@
#include <systemd/sd-bus.h>
-#include "bus-error.h"
+#include "sd-bus/bus-error.h" /* for bus_error_message */
#include "bus-unit-util.h"
#include "bus-util.h"
#include "nspawn-register.h"
diff --git a/src/systemd-nspawn/nspawn.c b/src/systemd-nspawn/nspawn.c
index bdf054e5c6..6390197646 100644
--- a/src/systemd-nspawn/nspawn.c
+++ b/src/systemd-nspawn/nspawn.c
@@ -72,7 +72,6 @@
#include "missing.h"
#include "mkdir.h"
#include "mount-util.h"
-#include "netlink-util.h"
#include "nspawn-cgroup.h"
#include "nspawn-expose-ports.h"
#include "nspawn-mount.h"
diff --git a/src/systemd-remount-fs/Makefile b/src/systemd-remount-fs/Makefile
index 49b10a879a..29d110625a 100644
--- a/src/systemd-remount-fs/Makefile
+++ b/src/systemd-remount-fs/Makefile
@@ -32,4 +32,7 @@ systemd_remount_fs_SOURCES = \
systemd_remount_fs_LDADD = \
libshared.la
+systemd.CPPFLAGS += -DMOUNT_PATH=\"$(MOUNT_PATH)\"
+systemd.CPPFLAGS += -DUMOUNT_PATH=\"$(UMOUNT_PATH)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-remount-fs/mount-setup.c b/src/systemd-remount-fs/mount-setup.c
new file mode 120000
index 0000000000..a4ab487157
--- /dev/null
+++ b/src/systemd-remount-fs/mount-setup.c
@@ -0,0 +1 @@
+../libcore/mount-setup.c \ No newline at end of file
diff --git a/src/systemd-remount-fs/mount-setup.h b/src/systemd-remount-fs/mount-setup.h
new file mode 120000
index 0000000000..1f984851f8
--- /dev/null
+++ b/src/systemd-remount-fs/mount-setup.h
@@ -0,0 +1 @@
+../libcore/mount-setup.h \ No newline at end of file
diff --git a/src/systemd-run/run.c b/src/systemd-run/run.c
index 29b5131f70..94cc865672 100644
--- a/src/systemd-run/run.c
+++ b/src/systemd-run/run.c
@@ -24,7 +24,7 @@
#include <systemd/sd-event.h>
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-unit-util.h"
#include "bus-util.h"
#include "calendarspec.h"
diff --git a/src/systemd-shutdown/Makefile b/src/systemd-shutdown/Makefile
index 72047133ce..1017422b75 100644
--- a/src/systemd-shutdown/Makefile
+++ b/src/systemd-shutdown/Makefile
@@ -36,4 +36,7 @@ systemd_shutdown_SOURCES = \
systemd_shutdown_LDADD = \
libshared.la
+systemd.CPPFLAGS += -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\"
+systemd.CPPFLAGS += -DKEXEC=\"$(KEXEC)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-shutdown/killall.c b/src/systemd-shutdown/killall.c
new file mode 120000
index 0000000000..5ddb36306b
--- /dev/null
+++ b/src/systemd-shutdown/killall.c
@@ -0,0 +1 @@
+../libcore/killall.c \ No newline at end of file
diff --git a/src/systemd-shutdown/killall.h b/src/systemd-shutdown/killall.h
new file mode 120000
index 0000000000..60b334fe91
--- /dev/null
+++ b/src/systemd-shutdown/killall.h
@@ -0,0 +1 @@
+../libcore/killall.h \ No newline at end of file
diff --git a/src/systemd-shutdown/mount-setup.c b/src/systemd-shutdown/mount-setup.c
new file mode 120000
index 0000000000..a4ab487157
--- /dev/null
+++ b/src/systemd-shutdown/mount-setup.c
@@ -0,0 +1 @@
+../libcore/mount-setup.c \ No newline at end of file
diff --git a/src/systemd-shutdown/mount-setup.h b/src/systemd-shutdown/mount-setup.h
new file mode 120000
index 0000000000..1f984851f8
--- /dev/null
+++ b/src/systemd-shutdown/mount-setup.h
@@ -0,0 +1 @@
+../libcore/mount-setup.h \ No newline at end of file
diff --git a/src/systemd-stdio-bridge/stdio-bridge.c b/src/systemd-stdio-bridge/stdio-bridge.c
index dce959cae3..d2e75c0679 100644
--- a/src/systemd-stdio-bridge/stdio-bridge.c
+++ b/src/systemd-stdio-bridge/stdio-bridge.c
@@ -27,7 +27,7 @@
#include <systemd/sd-bus.h>
#include <systemd/sd-daemon.h>
-#include "bus-internal.h"
+#include "sd-bus/bus-internal.h"
#include "bus-util.h"
#include "build.h"
#include "log.h"
diff --git a/src/systemd-system-update-generator/Makefile b/src/systemd-system-update-generator/Makefile
index fd44aef359..535f072fa8 100644
--- a/src/systemd-system-update-generator/Makefile
+++ b/src/systemd-system-update-generator/Makefile
@@ -30,4 +30,6 @@ systemd_system_update_generator_SOURCES = \
systemd_system_update_generator_LDADD = \
libshared.la
+systemd.CPPFLAGS += -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-timesyncd/Makefile b/src/systemd-timesyncd/Makefile
index c9289846c4..50333d0380 100644
--- a/src/systemd-timesyncd/Makefile
+++ b/src/systemd-timesyncd/Makefile
@@ -61,4 +61,6 @@ EXTRA_DIST += \
units/systemd-timesyncd.service.in \
src/timesync/timesyncd.conf.in
+systemd.CPPFLAGS += -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\"
+
include $(topsrcdir)/build-aux/Makefile.tail.mk
diff --git a/src/systemd-timesyncd/timesyncd-manager.c b/src/systemd-timesyncd/timesyncd-manager.c
index 6a4b52af69..e1626ac19b 100644
--- a/src/systemd-timesyncd/timesyncd-manager.c
+++ b/src/systemd-timesyncd/timesyncd-manager.c
@@ -37,7 +37,7 @@
#include "list.h"
#include "log.h"
#include "missing.h"
-#include "network-util.h"
+#include "sd-network/network-util.h"
#include "ratelimit.h"
#include "socket-util.h"
#include "sparse-endian.h"
diff --git a/src/systemd-timesyncd/timesyncd.c b/src/systemd-timesyncd/timesyncd.c
index 9e538a82f2..023372fef0 100644
--- a/src/systemd-timesyncd/timesyncd.c
+++ b/src/systemd-timesyncd/timesyncd.c
@@ -24,7 +24,7 @@
#include "clock-util.h"
#include "fd-util.h"
#include "fs-util.h"
-#include "network-util.h"
+#include "sd-network/network-util.h"
#include "signal-util.h"
#include "timesyncd-conf.h"
#include "timesyncd-manager.h"
diff --git a/src/systemd-update-utmp/update-utmp.c b/src/systemd-update-utmp/update-utmp.c
index fedcaef91c..2ccdfd7e9d 100644
--- a/src/systemd-update-utmp/update-utmp.c
+++ b/src/systemd-update-utmp/update-utmp.c
@@ -28,7 +28,7 @@
#include <systemd/sd-bus.h>
#include "alloc-util.h"
-#include "bus-error.h"
+#include "sd-bus/bus-error.h"
#include "bus-util.h"
#include "formats-util.h"
#include "log.h"