chiark / gitweb /
sd-login: read list of uids of sessions from UIDS not ACTIVE_SESSIONS
[elogind.git] / Makefile.am
index d56edec2ea79f092c58a2d8027e8aae48065dfab..f41296b13eeb95f8f95c31e050e7ff9d7b64bd87 100644 (file)
@@ -38,29 +38,36 @@ SUBDIRS = . po
 # Keep the test-suite.log
 .PRECIOUS: $(TEST_SUITE_LOG) Makefile
 
-LIBELOGIND_CURRENT=6
-LIBELOGIND_REVISION=0
-LIBELOGIND_AGE=6
+LIBELOGIND_CURRENT=18
+LIBELOGIND_REVISION=3
+LIBELOGIND_AGE=18
 
 # Dirs of external packages
 dbuspolicydir=@dbuspolicydir@
-dbussessionservicedir=@dbussessionservicedir@
 dbussystemservicedir=@dbussystemservicedir@
 pamlibdir=@pamlibdir@
 pamconfdir=@pamconfdir@
+pkgconfigdatadir=$(datadir)/pkgconfig
 pkgconfiglibdir=$(libdir)/pkgconfig
 polkitpolicydir=$(datadir)/polkit-1/actions
+polkitrulesdir=$(datadir)/polkit-1/rules.d
+polkitpkladir=$(localstatedir)/lib/polkit-1/localauthority/10-vendor.d
 bashcompletiondir=@bashcompletiondir@
 zshcompletiondir=@zshcompletiondir@
-varlogdir=$(localstatedir)/log
-elogindstatedir=$(localstatedir)/lib/elogind
+
+CGROUP_CONTROLLER=@cgroup_controller@
+PKTTYAGENT=$(bindir)/pkttyagent
 
 # Our own, non-special dirs
 pkgsysconfdir=$(sysconfdir)/elogind
-pkgincludedir=$(includedir)/elogind
-udevrulesdir=$(rootprefix)/lib/udev/rules.d
-factory_etcdir = $(prefix)/share/factory/etc
-factory_pamdir = $(prefix)/share/factory/etc/pam.d
+pkgincludedir=$(includedir)/elogind/systemd
+udevrulesdir=@udevrulesdir@
+udevbindir=@udevbindir@
+udevlibexecdir=$(udevbindir)
+udevhomedir=$(udevlibexecdir)
+systemshutdowndir=$(rootlibexecdir)/system-shutdown
+systemsleepdir=$(rootlibexecdir)/system-sleep
+factory_pamdir = $(datadir)/factory/etc/pam.d
 
 # And these are the special ones for /
 rootprefix=@rootprefix@
@@ -71,38 +78,49 @@ EXTRA_DIST =
 BUILT_SOURCES =
 INSTALL_EXEC_HOOKS =
 UNINSTALL_EXEC_HOOKS =
-INSTALL_DATA_HOOKS =
-UNINSTALL_DATA_HOOKS =
 DISTCLEAN_LOCAL_HOOKS =
 CLEAN_LOCAL_HOOKS =
 pkginclude_HEADERS =
 noinst_LTLIBRARIES =
 lib_LTLIBRARIES =
-include_HEADERS =
 noinst_DATA =
 pkgconfiglib_DATA =
-polkitpolicy_in_in_files =
 polkitpolicy_in_files =
 polkitpolicy_files =
+polkitrules_files =
+polkitpkla_files =
+dist_udevrules_DATA =
+nodist_udevrules_DATA =
 dist_pkgsysconf_DATA =
 nodist_pkgsysconf_DATA =
-dist_pkgdata_DATA =
 dist_dbuspolicy_DATA =
 dist_dbussystemservice_DATA =
 check_PROGRAMS =
 check_DATA =
+dist_rootlibexec_DATA =
+rootlib_LTLIBRARIES =
 tests=
 manual_tests =
-TEST_EXTENSIONS = .py
-PY_LOG_COMPILER = $(PYTHON)
+TEST_DATA_FILES =
 if ENABLE_TESTS
-noinst_PROGRAMS = $(manual_tests) $(tests)
+noinst_PROGRAMS = $(manual_tests) $(tests) $(unsafe_tests)
 TESTS = $(tests)
+if ENABLE_UNSAFE_TESTS
+TESTS += \
+       $(unsafe_tests)
+endif
 else
 noinst_PROGRAMS =
 TESTS =
 endif
 
+if ENABLE_BASH_COMPLETION
+dist_bashcompletion_DATA = $(dist_bashcompletion_data)
+endif
+if ENABLE_ZSH_COMPLETION
+dist_zshcompletion_DATA = $(dist_zshcompletion_data)
+endif
+
 in_files = $(filter %.in,$(EXTRA_DIST))
 in_in_files = $(filter %.in.in, $(in_files))
 m4_files = $(filter %.m4,$(EXTRA_DIST) $(in_files:.m4.in=.m4))
@@ -113,138 +131,55 @@ CLEANFILES = $(BUILT_SOURCES) \
        $(m4_files:.m4=)
 
 .PHONY: $(INSTALL_EXEC_HOOKS) $(UNINSTALL_EXEC_HOOKS) \
-       $(INSTALL_DATA_HOOKS) $(UNINSTALL_DATA_HOOKS) \
        $(DISTCLEAN_LOCAL_HOOKS) $(CLEAN_LOCAL_HOOKS)
 
-# FIXME a different pkttyagent path...
-
 AM_CPPFLAGS = \
        -include $(top_builddir)/config.h \
        -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
-       -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" \
-       -DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \
-       -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" \
-       -DUSER_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/user\" \
-       -DUSER_DATA_UNIT_PATH=\"$(userunitdir)\" \
-       -DROOTPREFIX=\"$(rootprefix)\" \
-       -DPOLKIT_AGENT_BINARY_PATH=\"$(bindir)/pkttyagent\" \
+       -DSYSTEMD_CGROUP_CONTROLLER=\"_$(CGROUP_CONTROLLER)\" \
+       -DSYSTEMD_CGROUP_CONTROLLER_LEGACY=\"name=$(CGROUP_CONTROLLER)\" \
+       -DSYSTEMD_CGROUP_CONTROLLER_HYBRID=\"name=$(CGROUP_CONTROLLER)\" \
+       -DSYSTEMD_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
+       -DSYSTEMD_BINARY_PATH=\"$(rootlibexecdir)/elogind\" \
+       -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
+       -DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
+       -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
+       -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" \
+       -DHALT=\"$(HALT)\" \
+       -DREBOOT=\"$(REBOOT)\" \
        -DKEXEC=\"$(KEXEC)\" \
        -DLIBDIR=\"$(libdir)\" \
        -DROOTLIBDIR=\"$(rootlibdir)\" \
        -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
        -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
        -I $(top_srcdir)/src \
-       -I $(top_builddir)/src/shared \
+       -I $(top_builddir)/src/basic \
+       -I $(top_srcdir)/src/basic \
+       -I $(top_srcdir)/src/core \
        -I $(top_srcdir)/src/shared \
+       -I $(top_builddir)/src/shared \
        -I $(top_srcdir)/src/login \
        -I $(top_srcdir)/src/systemd \
        -I $(top_srcdir)/src/libelogind/sd-bus \
        -I $(top_srcdir)/src/libelogind/sd-event \
-       -I $(top_srcdir)/src/libelogind/sd-device \
-       $(UDEV_CFLAGS) \
+       -I $(top_srcdir)/src/libelogind/sd-login \
+       -I $(top_srcdir)/src/libelogind/sd-id128 \
+       -I $(top_srcdir)/src/update-utmp \
+       -I $(top_srcdir)/src/sleep \
+       -DABS_SRC_DIR=\"$(abs_top_srcdir)\" \
+       -DABS_BUILD_DIR=\"$(abs_top_builddir)\" \
        $(OUR_CPPFLAGS)
 
 AM_CFLAGS = $(OUR_CFLAGS)
 AM_LDFLAGS = $(OUR_LDFLAGS)
 
 # ------------------------------------------------------------------------------
-define move-to-rootlibdir
-       if test "$(libdir)" != "$(rootlibdir)"; then \
-               $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
-               so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \
-               rm -f $(DESTDIR)$(libdir)/$$libname && \
-               $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
-               mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \
-       fi
-endef
-
-INSTALL_DIRS =
-
-SHUTDOWN_TARGET_WANTS =
-LOCAL_FS_TARGET_WANTS =
-MULTI_USER_TARGET_WANTS =
-GRAPHICAL_TARGET_WANTS =
-RESCUE_TARGET_WANTS =
-SYSINIT_TARGET_WANTS =
-SOCKETS_TARGET_WANTS =
-BUSNAMES_TARGET_WANTS =
-TIMERS_TARGET_WANTS =
-USER_SOCKETS_TARGET_WANTS =
-USER_DEFAULT_TARGET_WANTS =
-USER_BUSNAMES_TARGET_WANTS =
-
-SYSTEM_UNIT_ALIASES =
-USER_UNIT_ALIASES =
-GENERAL_ALIASES =
-
-install-target-wants-hook:
-       what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(RESCUE_TARGET_WANTS)" && wants=rescue.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(SLICES_TARGET_WANTS)" && wants=slices.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(USER_SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(userunitdir) && $(add-wants)
-       what="$(USER_DEFAULT_TARGET_WANTS)" && wants=default.target && dir=$(userunitdir) && $(add-wants)
-
-install-busnames-target-wants-hook:
-       what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(systemunitdir) && $(add-wants)
-       what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
-
-define add-wants
-       [ -z "$$what" ] || ( \
-         dir=$(DESTDIR)$$dir/$$wants.wants && \
-         $(MKDIR_P) -m 0755 $$dir && \
-         cd $$dir && \
-         rm -f $$what && \
-         for i in $$what; do $(LN_S) ../$$i . || exit $$? ; done )
-endef
-
-install-directories-hook:
-       $(MKDIR_P) $(addprefix $(DESTDIR),$(INSTALL_DIRS))
-
-install-aliases-hook:
-       set -- $(SYSTEM_UNIT_ALIASES) && \
-               dir=$(systemunitdir) && $(install-aliases)
-       set -- $(USER_UNIT_ALIASES) && \
-               dir=$(userunitdir) && $(install-relative-aliases)
-       set -- $(GENERAL_ALIASES) && \
-               dir= && $(install-relative-aliases)
-
-define install-aliases
-       while [ -n "$$1" ]; do \
-               $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
-               rm -f $(DESTDIR)$$dir/$$2 && \
-               $(LN_S) $$1 $(DESTDIR)$$dir/$$2 && \
-               shift 2 || exit $$?; \
-       done
-endef
-
-define install-relative-aliases
-       while [ -n "$$1" ]; do \
-               $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
-               rm -f $(DESTDIR)$$dir/$$2 && \
-               $(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
-               shift 2 || exit $$?; \
-       done
-endef
-
 install-touch-usr-hook:
        touch -c $(DESTDIR)/$(prefix)
 
 INSTALL_EXEC_HOOKS += \
-       install-target-wants-hook \
-       install-directories-hook \
-       install-aliases-hook \
        install-touch-usr-hook
 
-if ENABLE_KDBUS
-INSTALL_EXEC_HOOKS += \
-       install-busnames-target-wants-hook
-endif
 
 # ------------------------------------------------------------------------------
 AM_V_M4 = $(AM_V_M4_$(V))
@@ -269,20 +204,17 @@ AM_V_RM_0 = @echo "  RM      " $@;
 
 # ------------------------------------------------------------------------------
 rootbin_PROGRAMS =
-bin_PROGRAMS =
-rootlibexec_PROGRAMS =
-dist_bashcompletion_DATA =
-dist_zshcompletion_DATA =
+rootlibexec_PROGRAMS = \
+       elogind \
+       elogind-cgroups-agent
+
+pkglibexec_PROGRAMS =
 
 dist_doc_DATA = \
        README \
        NEWS \
        LICENSE.LGPL2.1 \
-       LICENSE.GPL2 \
-       LICENSE.MIT \
-       src/libelogind/sd-bus/PORTING-DBUS1 \
-       src/libelogind/sd-bus/DIFFERENCES \
-       src/libelogind/sd-bus/GVARIANT-SERIALIZATION
+       LICENSE.GPL2
 
 @INTLTOOL_POLICY_RULE@
 
@@ -310,243 +242,295 @@ man_MANS = \
 
 noinst_DATA += \
        $(HTML_FILES) \
-       $(HTML_ALIAS)
+       $(HTML_ALIAS) \
+       docs/html/man
+endif
 
 CLEANFILES += \
        $(man_MANS) \
        $(HTML_FILES) \
-       $(HTML_ALIAS)
+       $(HTML_ALIAS) \
+       docs/html/man
 
 docs/html/man:
        $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_LN)$(LN_S) -f ../../man $@
 
+man/index.html: man/elogind.index.html
+       $(AM_V_LN)$(LN_S) -f elogind.index.html $@
+
+if HAVE_PYTHON
 noinst_DATA += \
-       docs/html/man
+       man/index.html
+endif
 
 CLEANFILES += \
-       docs/html/man
+       man/index.html
+
+XML_GLOB            := $(wildcard $(top_srcdir)/man/*.xml)
+DIRECTIVE_FILE      := man/elogind.directives.xml
+INDEX_XML_FILE      := man/elogind.index.xml
+NON_INDEX_XML_FILES := $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_FILES))
+ALL_XML_FILES       := $(INDEX_XML_FILE) $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_GLOB))
+SOURCE_XML_FILES    := ${patsubst %,$(top_srcdir)/%,$(filter-out $(DIRECTIVE_FILE),$(NON_INDEX_XML_FILES))}
+
+# This target should only be run manually. It recreates Makefile-man.am
+# file in the source directory based on all man/*.xml files. Run it after
+# adding, removing, or changing the conditional in a man page.
+update-man-list: $(top_srcdir)/tools/make-man-rules.py $(ALL_XML_FILES) man/custom-entities.ent
+       $(AM_V_GEN)$(PYTHON) $< $(ALL_XML_FILES) > $(top_srcdir)/Makefile-man.tmp
+       $(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
+       @echo "Makefile-man.am has been regenerated"
+
+$(INDEX_XML_FILE): $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES)
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
+       $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
 
-endif
+$(DIRECTIVE_FILE): $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES)
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
+       $(AM_V_GEN)$(PYTHON) $< $@ $(SOURCE_XML_FILES)
+
+CLEANFILES += \
+       $(INDEX_XML_FILE) \
+       $(DIRECTIVE_FILE)
 
 EXTRA_DIST += \
-       $(XML_FILES) \
-       $(HTML_FILES) \
-       $(HTML_ALIAS) \
-       $(man_MANS) \
+       $(filter-out $(DIRECTIVE_FILE) $(INDEX_XML_FILE),$(XML_FILES)) \
        tools/make-man-index.py \
+       tools/make-man-rules.py \
        tools/make-directive-index.py \
-       tools/xml_helper.py
+       tools/xml_helper.py \
+       man/glib-event-glue.c
 
 # ------------------------------------------------------------------------------
 noinst_LTLIBRARIES += \
-       libelogind-shared.la
+       libbasic.la
+
+libbasic_la_SOURCES = \
+       src/basic/missing.h \
+       src/basic/capability-util.c \
+       src/basic/capability-util.h \
+       src/basic/conf-files.c \
+       src/basic/conf-files.h \
+       src/basic/stdio-util.h \
+       src/basic/hostname-util.h \
+       src/basic/hostname-util.c \
+       src/basic/unit-name.c \
+       src/basic/unit-name.h \
+       src/basic/unaligned.h \
+       src/basic/util.c \
+       src/basic/util.h \
+       src/basic/io-util.c \
+       src/basic/io-util.h \
+       src/basic/string-util.c \
+       src/basic/string-util.h \
+       src/basic/parse-util.c \
+       src/basic/parse-util.h \
+       src/basic/fd-util.c \
+       src/basic/fd-util.h \
+       src/basic/user-util.c \
+       src/basic/user-util.h \
+       src/basic/dirent-util.c \
+       src/basic/dirent-util.h \
+       src/basic/xattr-util.c \
+       src/basic/xattr-util.h \
+       src/basic/proc-cmdline.c \
+       src/basic/proc-cmdline.h \
+       src/basic/fs-util.c \
+       src/basic/fs-util.h \
+       src/basic/syslog-util.c \
+       src/basic/syslog-util.h \
+       src/basic/stat-util.c \
+       src/basic/stat-util.h \
+       src/basic/mount-util.c \
+       src/basic/mount-util.h \
+       src/basic/hexdecoct.c \
+       src/basic/hexdecoct.h \
+       src/basic/extract-word.c \
+       src/basic/extract-word.h \
+       src/basic/escape.c \
+       src/basic/escape.h \
+       src/basic/path-util.c \
+       src/basic/path-util.h \
+       src/basic/parse-printf-format.c \
+       src/basic/parse-printf-format.h \
+       src/basic/time-util.c \
+       src/basic/time-util.h \
+       src/basic/locale-util.c \
+       src/basic/locale-util.h \
+       src/basic/umask-util.h \
+       src/basic/signal-util.c \
+       src/basic/signal-util.h \
+       src/basic/string-table.c \
+       src/basic/string-table.h \
+       src/basic/mempool.c \
+       src/basic/mempool.h \
+       src/basic/hashmap.c \
+       src/basic/hashmap.h \
+       src/basic/hash-funcs.c \
+       src/basic/hash-funcs.h \
+       src/basic/siphash24.c \
+       src/basic/siphash24.h \
+       src/basic/prioq.c \
+       src/basic/prioq.h \
+       src/basic/strv.c \
+       src/basic/strv.h \
+       src/basic/env-util.c \
+       src/basic/env-util.h \
+       src/basic/log.c \
+       src/basic/log.h \
+       src/basic/bus-label.c \
+       src/basic/bus-label.h \
+       src/basic/exec-util.c \
+       src/basic/exec-util.h \
+       src/basic/virt.c \
+       src/basic/virt.h \
+       src/basic/smack-util.c \
+       src/basic/smack-util.h \
+       src/basic/utf8.c \
+       src/basic/utf8.h \
+       src/basic/gunicode.c \
+       src/basic/gunicode.h \
+       src/basic/socket-util.c \
+       src/basic/socket-util.h \
+       src/basic/fileio.c \
+       src/basic/fileio.h \
+       src/basic/mkdir.c \
+       src/basic/mkdir.h \
+       src/basic/cgroup-util.c \
+       src/basic/cgroup-util.h \
+       src/basic/errno-list.c \
+       src/basic/errno-list.h \
+       src/basic/terminal-util.c \
+       src/basic/terminal-util.h \
+       src/basic/login-util.h \
+       src/basic/login-util.c \
+       src/basic/audit-util.c \
+       src/basic/audit-util.h \
+       src/basic/memfd-util.c \
+       src/basic/memfd-util.h \
+       src/basic/process-util.c \
+       src/basic/process-util.h \
+       src/basic/random-util.c \
+       src/basic/random-util.h \
+       src/basic/verbs.c \
+       src/basic/verbs.h \
+       src/basic/label.c \
+       src/basic/label.h \
+       src/basic/selinux-util.c \
+       src/basic/selinux-util.h \
+       src/basic/mkdir-label.c \
+       src/basic/fileio-label.c \
+       src/basic/fileio-label.h \
+       src/basic/rm-rf.c \
+       src/basic/rm-rf.h \
+       src/basic/copy.c \
+       src/basic/copy.h \
+       src/basic/alloc-util.h \
+       src/basic/alloc-util.c \
+       src/basic/format-util.h \
+       src/basic/khash.h \
+       src/basic/khash.c
+
+nodist_libbasic_la_SOURCES = \
+       src/basic/errno-from-name.h \
+       src/basic/errno-to-name.h
+
+libbasic_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(SELINUX_CFLAGS) \
+       $(CAP_CFLAGS) \
+       -pthread
 
-libelogind_shared_la_SOURCES = \
-       src/shared/capability.c \
-       src/shared/capability.h \
-       src/shared/linux/auto_dev-ioctl.h \
-       src/shared/ioprio.h \
-       src/shared/missing.h \
-       src/shared/initreq.h \
-       src/shared/securebits.h \
-       src/shared/special.h \
-       src/shared/list.h \
-       src/shared/unaligned.h \
-       src/shared/macro.h \
-       src/shared/def.h \
-       src/shared/sparse-endian.h \
-       src/shared/refcnt.h \
+libbasic_la_LDFLAGS = \
+       $(CAP_LDFLAGS)
+
+libbasic_la_LIBADD = \
+       $(SELINUX_LIBS) \
+       $(CAP_LIBS) \
+       -ldl \
+       -lm
+
+# -----------------------------------------------------------------------------
+noinst_LTLIBRARIES += \
+       libshared.la
+
+libshared_la_SOURCES = \
        src/shared/udev-util.h \
-       src/shared/device-nodes.c \
-       src/shared/device-nodes.h \
-       src/shared/util.c \
-       src/shared/util.h \
-       src/shared/virt.c \
-       src/shared/virt.h \
-       src/shared/architecture.c \
-       src/shared/architecture.h \
-       src/shared/fstab-util.c \
-       src/shared/fstab-util.h \
-       src/shared/path-util.c \
-       src/shared/path-util.h \
-       src/shared/time-util.c \
-       src/shared/time-util.h \
-       src/shared/locale-util.c \
-       src/shared/locale-util.h \
-       src/shared/mempool.c \
-       src/shared/mempool.h \
-       src/shared/hashmap.c \
-       src/shared/hashmap.h \
-       src/shared/siphash24.c \
-       src/shared/siphash24.h \
-       src/shared/set.h \
-       src/shared/fdset.c \
-       src/shared/fdset.h \
-       src/shared/prioq.c \
-       src/shared/prioq.h \
-       src/shared/sleep-config.c \
-       src/shared/sleep-config.h \
-       src/shared/strv.c \
-       src/shared/strv.h \
-       src/shared/env-util.c \
-       src/shared/env-util.h \
-       src/shared/strbuf.c \
-       src/shared/strbuf.h \
-       src/shared/strxcpyx.c \
-       src/shared/strxcpyx.h \
+       src/shared/udev-util.c \
+       src/shared/bus-util.c \
+       src/shared/bus-util.h \
+       src/shared/clean-ipc.c \
+       src/shared/clean-ipc.h \
        src/shared/conf-parser.c \
        src/shared/conf-parser.h \
-       src/shared/log.c \
-       src/shared/log.h \
-       src/shared/ratelimit.h \
-       src/shared/ratelimit.c \
-       src/shared/exit-status.c \
-       src/shared/exit-status.h \
-       src/shared/utf8.c \
-       src/shared/utf8.h \
-       src/shared/gunicode.c \
-       src/shared/gunicode.h \
+       src/shared/musl_missing.h \
+       src/shared/musl_missing.c \
        src/shared/pager.c \
        src/shared/pager.h \
-       src/shared/socket-util.c \
-       src/shared/socket-util.h \
-       src/shared/in-addr-util.c \
-       src/shared/in-addr-util.h \
-       src/shared/ether-addr-util.h \
-       src/shared/conf-files.c \
-       src/shared/conf-files.h \
-       src/shared/cgroup-util.c \
-       src/shared/cgroup-util.h \
-       src/shared/cgroup-show.c \
-       src/shared/cgroup-show.h \
-       src/shared/unit-name.c \
-       src/shared/unit-name.h \
-       src/shared/watchdog.c \
-       src/shared/watchdog.h \
-       src/shared/replace-var.c \
-       src/shared/replace-var.h \
+       src/shared/sleep-config.c \
+       src/shared/sleep-config.h \
        src/shared/spawn-polkit-agent.c \
        src/shared/spawn-polkit-agent.h \
-       src/shared/clock-util.c \
-       src/shared/clock-util.h \
-       src/shared/calendarspec.c \
-       src/shared/calendarspec.h \
-       src/shared/fileio.c \
-       src/shared/fileio.h \
-       src/shared/output-mode.h \
-       src/shared/MurmurHash2.c \
-       src/shared/MurmurHash2.h \
-       src/shared/acpi-fpdt.h \
-       src/shared/acpi-fpdt.c \
-       src/shared/mkdir.c \
-       src/shared/mkdir.h \
-       src/shared/smack-util.c \
-       src/shared/smack-util.h \
-       src/shared/apparmor-util.c \
-       src/shared/apparmor-util.h \
-       src/shared/ima-util.c \
-       src/shared/ima-util.h \
-       src/shared/ptyfwd.c \
-       src/shared/ptyfwd.h \
-       src/shared/errno-list.c \
-       src/shared/errno-list.h \
-       src/shared/af-list.c \
-       src/shared/af-list.h \
-       src/shared/arphrd-list.c \
-       src/shared/arphrd-list.h \
-       src/shared/cap-list.c \
-       src/shared/cap-list.h \
-       src/shared/audit.c \
-       src/shared/audit.h \
-       src/shared/xml.c \
-       src/shared/xml.h \
-       src/shared/json.c \
-       src/shared/json.h \
-       src/shared/selinux-util.c \
-       src/shared/selinux-util.h \
-       src/shared/label.c \
-       src/shared/label.h \
-       src/shared/socket-label.c \
-       src/shared/mkdir-label.c \
-       src/shared/fileio-label.h \
-       src/shared/fileio-label.c \
-       src/shared/bus-label.c \
-       src/shared/bus-label.h \
-       src/shared/gpt.h \
-       src/shared/clean-ipc.h \
-       src/shared/clean-ipc.c \
-       src/shared/login-shared.c \
-       src/shared/login-shared.h \
-       src/shared/ring.c \
-       src/shared/ring.h \
-       src/shared/barrier.c \
-       src/shared/barrier.h \
-       src/shared/pty.c \
-       src/shared/pty.h \
-       src/shared/async.c \
-       src/shared/async.h \
-       src/shared/base-filesystem.c \
-       src/shared/base-filesystem.h \
-       src/shared/memfd-util.c \
-       src/shared/memfd-util.h \
-       src/shared/uid-range.c \
-       src/shared/uid-range.h \
-       src/shared/nss-util.h \
-       src/shared/verbs.c \
-       src/shared/verbs.h \
-       src/shared/sigbus.c \
-       src/shared/sigbus.h \
-       src/shared/build.h \
-       src/shared/import-util.c \
-       src/shared/import-util.h \
-       src/shared/sysctl-util.c \
-       src/shared/sysctl-util.h
-
-nodist_libelogind_shared_la_SOURCES = \
-       src/shared/errno-from-name.h \
-       src/shared/errno-to-name.h \
-       src/shared/af-from-name.h \
-       src/shared/af-to-name.h \
-       src/shared/arphrd-from-name.h \
-       src/shared/arphrd-to-name.h \
-       src/shared/cap-from-name.h \
-       src/shared/cap-to-name.h
-
-libelogind_shared_la_CFLAGS = \
-       $(AM_CFLAGS) \
-       $(CAP_CFLAGS) \
-       $(SECCOMP_CFLAGS) \
-       -pthread
-
-libelogind_shared_la_LIBADD = \
-       $(CAP_LIBS) \
-       -lm
+       src/shared/tests.h \
+       src/shared/tests.c \
+       src/shared/nsflags.h \
+       src/shared/nsflags.c
 
-# ------------------------------------------------------------------------------
 if HAVE_ACL
-noinst_LTLIBRARIES += \
-       libelogind-acl.la
-
-libelogind_acl_la_SOURCES = \
+libshared_la_SOURCES += \
        src/shared/acl-util.c \
        src/shared/acl-util.h
+endif
 
-libelogind_acl_la_CFLAGS = \
+libshared_la_CFLAGS = \
        $(AM_CFLAGS) \
        $(ACL_CFLAGS)
 
-libelogind_acl_la_LIBADD = \
+libshared_la_LIBADD = \
+       libelogind-internal.la \
+       libbasic.la \
+       $(UDEV_LIBS) \
        $(ACL_LIBS)
-endif
 
+noinst_LTLIBRARIES += \
+       libelogind-shared.la
+
+libelogind_shared_la_SOURCES = \
+       $(libbasic_la_SOURCES) \
+       $(libshared_la_SOURCES) \
+       $(libelogind_internal_la_SOURCES)
+
+libelogind_shared_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(libbasic_la_CFLAGS) \
+       $(libshared_la_CFLAGS) \
+       $(libelogind_internal_la_CFLAGS) \
+       $(libelogind_journal_internal_la_CFLAGS) \
+       $(libudev_internal_la_CFLAGS) \
+       $(ACL_CFLAGS) \
+       $(LIBIDN_CFLAGS) \
+       $(SECCOMP_CFLAGS) \
+       -fvisibility=default
+
+# We can't use libshared_la_LIBADD here because it would
+# pull in libelogind*-internal.la
+libelogind_shared_la_LIBADD = \
+       $(libbasic_la_LIBADD) \
+       $(libelogind_internal_la_LIBADD) \
+       $(UDEV_LIBS) \
+       $(ACL_LIBS) \
+       $(LIBIDN_LIBS) \
+       $(SECCOMP_LIBS)
+
+libelogind_shared_la_LDFLAGS = \
+       $(AM_LDFLAGS)
+ # -----------------------------------------------------------------------------
 gperf_txt_sources = \
-       src/shared/errno-list.txt \
-       src/shared/af-list.txt \
-       src/shared/arphrd-list.txt \
-       src/shared/cap-list.txt
+       src/basic/errno-list.txt
 
 BUILT_SOURCES += \
+       $(gperf_gperf_m4_sources:-gperf.gperf.m4=-gperf.c) \
        $(gperf_gperf_sources:-gperf.gperf=-gperf.c) \
        $(gperf_txt_sources:-list.txt=-from-name.h) \
        $(gperf_txt_sources:-list.txt=-to-name.h)
@@ -558,61 +542,358 @@ DISTCLEANFILES = \
 
 EXTRA_DIST += \
        $(gperf_gperf_m4_sources) \
-       $(gperf_gperf_sources) \
-       $(gperf_txt_sources:-list.txt=-from-name.gperf)
+       $(gperf_gperf_sources)
 
 CLEANFILES += \
        $(gperf_txt_sources)
 
 %-from-name.gperf: %-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
+       $(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 <$< >$@
 
 
-src/shared/errno-list.txt:
+src/basic/errno-list.txt:
        $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
 
-src/shared/errno-to-name.h: src/shared/errno-list.txt
+src/basic/errno-to-name.h: src/basic/errno-list.txt
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
        $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
 
+# ------------------------------------------------------------------------------
 
-src/shared/af-list.txt:
-       $(AM_V_at)$(MKDIR_P) $(dir $@)
-       $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include sys/socket.h - </dev/null | grep -v AF_UNSPEC | grep -v AF_MAX | $(AWK) '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $$2; }' >$@
+manual_tests += \
+       test-cgroup
 
-src/shared/af-to-name.h: src/shared/af-list.txt
-       $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const af_names[] = { "} !/AF_FILE/ && !/AF_ROUTE/ && !/AF_LOCAL/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
+unsafe_tests = \
+       test-ipcrm
 
+tests += \
+       test-log \
+       test-path-util \
+       test-siphash24 \
+       test-utf8 \
+       test-ellipsize \
+       test-util \
+       test-exec-util \
+       test-hexdecoct \
+       test-escape \
+       test-alloc-util \
+       test-proc-cmdline \
+       test-io-util \
+       test-fs-util \
+       test-stat-util \
+       test-fd-util \
+       test-string-util \
+       test-extract-word \
+       test-parse-util \
+       test-user-util \
+       test-process-util \
+       test-strip-tab-ansi \
+       test-prioq \
+       test-hashmap \
+       test-set \
+       test-list \
+       test-unaligned \
+       test-conf-files \
+       test-conf-parser \
+       test-locale-util \
+       test-copy \
+       test-verbs \
+       test-signal-util \
+       test-selinux \
+       test-sizeof
+
+TEST_DATA_FILES += \
+       test/bus-policy/hello.conf \
+       test/bus-policy/methods.conf \
+       test/bus-policy/ownerships.conf \
+       test/bus-policy/signals.conf \
+       test/bus-policy/check-own-rules.conf \
+       test/bus-policy/many-rules.conf \
+       test/bus-policy/test.conf
 
-src/shared/arphrd-list.txt:
-       $(AM_V_at)$(MKDIR_P) $(dir $@)
-       $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include net/if_arp.h - </dev/null | $(AWK) '/^#define[ \t]+ARPHRD_[^ \t]+[ \t]+[^ \t]/ { print $$2; }' | sed -e 's/ARPHRD_//' >$@
 
-src/shared/arphrd-to-name.h: src/shared/arphrd-list.txt
-       $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const arphrd_names[] = { "} !/CISCO/ { printf "[ARPHRD_%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
+EXTRA_DIST += \
+       src/test/test-helper.h
+
+test_utf8_SOURCES = \
+       src/test/test-utf8.c
+
+test_utf8_LDADD = \
+       libelogind-shared.la
+
+test_locale_util_SOURCES = \
+       src/test/test-locale-util.c
+
+test_locale_util_LDADD = \
+       libelogind-shared.la
+
+test_copy_SOURCES = \
+       src/test/test-copy.c
 
-src/shared/arphrd-from-name.gperf: src/shared/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 }' <$< >$@
+# Link statically to ensure file is large
+test_copy_LDADD = \
+       libshared.la
+
+test_util_SOURCES = \
+       src/test/test-util.c
+
+test_util_LDADD = \
+       libelogind-shared.la
+
+test_exec_util_SOURCES = \
+       src/test/test-exec-util.c
+
+test_exec_util_LDADD = \
+       libelogind-shared.la
+
+test_hexdecoct_SOURCES = \
+       src/test/test-hexdecoct.c
+
+test_hexdecoct_LDADD = \
+       libelogind-shared.la
+
+test_alloc_util_SOURCES = \
+       src/test/test-alloc-util.c
+
+test_alloc_util_LDADD = \
+       libelogind-shared.la
+
+test_io_util_SOURCES = \
+       src/test/test-io-util.c
+
+test_io_util_LDADD = \
+       libelogind-shared.la
+
+test_fs_util_SOURCES = \
+       src/test/test-fs-util.c
+
+test_fs_util_LDADD = \
+       libelogind-shared.la
+
+test_proc_cmdline_SOURCES = \
+       src/test/test-proc-cmdline.c
+
+test_proc_cmdline_LDADD = \
+       libelogind-shared.la
 
+test_fd_util_SOURCES = \
+       src/test/test-fd-util.c
 
-src/shared/cap-list.txt:
+test_fd_util_LDADD = \
+       libelogind-shared.la
+
+test_stat_util_SOURCES = \
+       src/test/test-stat-util.c
+
+test_stat_util_LDADD = \
+       libelogind-shared.la
+
+test_escape_SOURCES = \
+       src/test/test-escape.c
+
+test_escape_LDADD = \
+       libelogind-shared.la
+
+test_string_util_SOURCES = \
+       src/test/test-string-util.c
+
+test_string_util_LDADD = \
+       libelogind-shared.la
+
+test_extract_word_SOURCES = \
+       src/test/test-extract-word.c
+
+test_extract_word_LDADD = \
+       libelogind-shared.la
+
+test_parse_util_SOURCES = \
+       src/test/test-parse-util.c
+
+test_parse_util_LDADD = \
+       libelogind-shared.la
+
+test_user_util_SOURCES = \
+       src/test/test-user-util.c
+
+test_user_util_LDADD = \
+       libelogind-shared.la
+
+test_process_util_SOURCES = \
+       src/test/test-process-util.c
+
+test_process_util_LDADD = \
+       libelogind-shared.la
+
+test_verbs_SOURCES = \
+       src/test/test-verbs.c
+
+test_verbs_LDADD = \
+       libelogind-shared.la
+
+test_signal_util_SOURCES = \
+       src/test/test-signal-util.c
+
+test_signal_util_LDADD = \
+       libelogind-shared.la
+
+test_selinux_SOURCES = \
+       src/test/test-selinux.c
+
+test_selinux_LDADD = \
+       libelogind-shared.la
+
+test_sizeof_SOURCES = \
+       src/test/test-sizeof.c
+
+test_sizeof_LDADD = \
+       libelogind-shared.la
+
+BUILT_SOURCES += \
+       src/test/test-hashmap-ordered.c
+
+src/test/test-hashmap-ordered.c: src/test/test-hashmap-plain.c
        $(AM_V_at)$(MKDIR_P) $(dir $@)
-       $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(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 >$@
+       $(AM_V_GEN)$(AWK) 'BEGIN { print "/* GENERATED FILE */\n#define ORDERED" } \
+                          { if (!match($$0, "^#include"))          \
+                                gsub(/hashmap/, "ordered_hashmap"); \
+                            gsub(/HASHMAP/, "ORDERED_HASHMAP");     \
+                            gsub(/Hashmap/, "OrderedHashmap");      \
+                            print }' <$< >$@
+
+nodist_test_hashmap_SOURCES = \
+       src/test/test-hashmap-ordered.c
+
+test_hashmap_SOURCES = \
+       src/test/test-hashmap.c \
+       src/test/test-hashmap-plain.c
+
+test_hashmap_LDADD = \
+       libelogind-shared.la
 
-src/shared/cap-to-name.h: src/shared/cap-list.txt
-       $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@
+test_set_SOURCES = \
+       src/test/test-set.c
 
-src/shared/cap-from-name.gperf: src/shared/cap-list.txt
-       $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct capability_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
+test_set_LDADD = \
+       libelogind-shared.la
+
+test_list_SOURCES = \
+       src/test/test-list.c
+
+test_list_LDADD = \
+       libelogind-shared.la
+
+test_unaligned_LDADD = \
+       libelogind-shared.la
+
+test_unaligned_SOURCES = \
+       src/test/test-unaligned.c
+
+test_prioq_SOURCES = \
+       src/test/test-prioq.c
+
+test_prioq_LDADD = \
+       libelogind-shared.la
+
+test_log_SOURCES = \
+       src/test/test-log.c
+
+test_log_LDADD = \
+       libelogind-shared.la
+
+test_ipcrm_SOURCES = \
+       src/test/test-ipcrm.c
+
+test_ipcrm_LDADD = \
+       libelogind-shared.la
+
+test_ellipsize_SOURCES = \
+       src/test/test-ellipsize.c
+
+test_ellipsize_LDADD = \
+       libelogind-shared.la
+
+test_strip_tab_ansi_SOURCES = \
+       src/test/test-strip-tab-ansi.c
+
+test_strip_tab_ansi_LDADD = \
+       libelogind-shared.la
+
+test_cgroup_SOURCES = \
+       src/test/test-cgroup.c
+
+test_cgroup_LDADD = \
+       libelogind-shared.la
+
+test_path_util_SOURCES = \
+       src/test/test-path-util.c
 
-src/shared/cap-from-name.h: src/shared/cap-from-name.gperf
-       $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@
+test_path_util_LDADD = \
+       libelogind-shared.la
+
+test_siphash24_SOURCES = \
+       src/test/test-siphash24.c
+
+test_siphash24_LDADD = \
+       libelogind-shared.la
+
+test_conf_files_SOURCES = \
+       src/test/test-conf-files.c
+
+test_conf_files_LDADD = \
+       libelogind-shared.la
+
+test_conf_parser_SOURCES = \
+       src/test/test-conf-parser.c
+
+test_conf_parser_LDADD = \
+       libelogind-shared.la
+
+# ------------------------------------------------------------------------------
+## .PHONY so it always rebuilds it
+.PHONY: coverage lcov-run lcov-report coverage-sync
+
+# run lcov from scratch, always
+coverage: all
+       $(MAKE) lcov-run
+       $(MAKE) lcov-report
+
+coverage_dir = coverage
+coverage_opts = --base-directory $(srcdir) --directory $(builddir) --rc 'geninfo_adjust_src_path=$(abspath $(srcdir))=>$(abspath $(builddir))'
+
+if ENABLE_COVERAGE
+# reset run coverage tests
+lcov-run:
+       @rm -rf $(coverage_dir)
+       lcov $(coverage_opts) --zerocounters
+       -$(MAKE) check
+
+# generate report based on current coverage data
+lcov-report:
+       $(MKDIR_P) $(coverage_dir)
+       lcov $(coverage_opts) --compat-libtool --capture --no-external \
+               | sed 's|$(abspath $(builddir))|$(abspath $(srcdir))|' > $(coverage_dir)/.lcov.info
+       lcov --remove $(coverage_dir)/.lcov.info --output-file $(coverage_dir)/.lcov-clean.info 'test-*'
+       genhtml -t "systemd test coverage" -o $(coverage_dir) $(coverage_dir)/.lcov-clean.info
+       @echo "Coverage report generated in $(abs_builddir)/$(coverage_dir)/index.html"
+
+# lcov doesn't work properly with vpath builds, make sure that bad
+# output is not uploaded by mistake.
+coverage-sync: coverage
+       test "$(builddir)" = "$(srcdir)"
+       rsync -rlv --delete --omit-dir-times coverage/ $(www_target)/coverage
+
+else
+lcov-run lcov-report:
+       echo "Need to reconfigure with --enable-coverage"
+endif
 
 # ------------------------------------------------------------------------------
-dist_factory_etc_DATA =
 
 if HAVE_PAM
 dist_factory_pam_DATA = \
@@ -621,23 +902,25 @@ dist_factory_pam_DATA = \
 endif
 
 # ------------------------------------------------------------------------------
-noinst_LTLIBRARIES += \
-       libelogind-internal.la
+pkglibexec_PROGRAMS += \
+       elogind-cgroups-agent
+
+elogind_cgroups_agent_SOURCES = \
+       src/cgroups-agent/cgroups-agent.c
+
+elogind_cgroups_agent_LDADD = \
+       libelogind-shared.la
 
+# ------------------------------------------------------------------------------
 libelogind_internal_la_SOURCES = \
        src/systemd/sd-bus.h \
        src/systemd/sd-bus-protocol.h \
        src/systemd/sd-bus-vtable.h \
-       src/systemd/sd-utf8.h \
        src/systemd/sd-event.h \
-       src/systemd/sd-rtnl.h \
-       src/systemd/sd-resolve.h \
        src/systemd/sd-login.h \
        src/systemd/sd-id128.h \
        src/systemd/sd-daemon.h \
-       src/systemd/sd-path.h \
-       src/systemd/sd-network.h \
-       src/systemd/sd-device.h \
+       src/libelogind/libelogind.sym \
        src/libelogind/sd-bus/sd-bus.c \
        src/libelogind/sd-bus/bus-control.c \
        src/libelogind/sd-bus/bus-control.h \
@@ -674,70 +957,125 @@ libelogind_internal_la_SOURCES = \
        src/libelogind/sd-bus/bus-convenience.c \
        src/libelogind/sd-bus/bus-track.c \
        src/libelogind/sd-bus/bus-track.h \
-       src/libelogind/sd-bus/bus-util.c \
-       src/libelogind/sd-bus/bus-util.h \
        src/libelogind/sd-bus/bus-slot.c \
        src/libelogind/sd-bus/bus-slot.h \
        src/libelogind/sd-bus/bus-protocol.h \
-       src/libelogind/sd-bus/kdbus.h \
-       src/libelogind/sd-utf8/sd-utf8.c \
        src/libelogind/sd-event/sd-event.c \
-       src/libelogind/sd-event/event-util.h \
-       src/libelogind/sd-rtnl/sd-rtnl.c \
-       src/libelogind/sd-rtnl/rtnl-internal.h \
-       src/libelogind/sd-rtnl/rtnl-message.c \
-       src/libelogind/sd-rtnl/rtnl-types.h \
-       src/libelogind/sd-rtnl/rtnl-types.c \
-       src/libelogind/sd-rtnl/rtnl-util.h \
-       src/libelogind/sd-rtnl/rtnl-util.c \
-       src/libelogind/sd-rtnl/local-addresses.h \
-       src/libelogind/sd-rtnl/local-addresses.c \
        src/libelogind/sd-id128/sd-id128.c \
+       src/libelogind/sd-id128/id128-util.h \
+       src/libelogind/sd-id128/id128-util.c \
        src/libelogind/sd-daemon/sd-daemon.c \
-       src/libelogind/sd-login/sd-login.c \
-       src/libelogind/sd-path/sd-path.c \
-       src/libelogind/sd-network/sd-network.c \
-       src/libelogind/sd-network/network-util.h \
-       src/libelogind/sd-network/network-util.c \
-       src/libelogind/sd-device/device-internal.h \
-       src/libelogind/sd-device/device-util.h \
-       src/libelogind/sd-device/sd-device.c \
-       src/libelogind/sd-device/device-private.c \
-       src/libelogind/sd-device/device-private.h
-
-nodist_libelogind_internal_la_SOURCES = \
-       src/libelogind/libelogind.sym
-
-libelogind_internal_la_CFLAGS = \
-       $(AM_CFLAGS) \
-       -pthread
+       src/libelogind/sd-login/sd-login.c
 
-BUILT_SOURCES += \
-       src/libelogind/libelogind.sym
+noinst_LTLIBRARIES += \
+       libelogind-internal.la
 
+EXTRA_DIST += \
+       src/libelogind/libelogind.pc.in \
+       src/libelogind/sd-bus/DIFFERENCES \
+       src/libelogind/sd-bus/GVARIANT-SERIALIZATION
 
-libelogind_internal_la_LIBADD = \
-       libelogind-shared.la
+libelogind_la_SOURCES =
 
-libelogind_internal_la_LDFLAGS = \
+libelogind_la_LDFLAGS = \
        $(AM_LDFLAGS) \
        -version-info $(LIBELOGIND_CURRENT):$(LIBELOGIND_REVISION):$(LIBELOGIND_AGE) \
-       -Wl,--version-script=$(top_builddir)/src/libelogind/libelogind.sym
-
-libelogind-install-hook:
-       libname=libelogind.so && $(move-to-rootlibdir)
+       -Wl,--version-script=$(top_srcdir)/src/libelogind/libelogind.sym
 
-libelogind-uninstall-hook:
-       rm -f $(DESTDIR)$(rootlibdir)/libelogind.so*
-
-INSTALL_EXEC_HOOKS += libelogind-install-hook
-UNINSTALL_EXEC_HOOKS += libelogind-uninstall-hook
+libelogind_la_LIBADD = \
+       libelogind-internal.la \
+       libbasic.la
 
 pkgconfiglib_DATA += \
-       src/libelogind/libsystemd.pc
+       src/libelogind/libelogind.pc
 
 pkginclude_HEADERS += \
-       src/systemd/sd-login.h
+       src/systemd/sd-login.h \
+       src/systemd/sd-messages.h \
+       src/systemd/sd-id128.h \
+       src/systemd/_sd-common.h
+
+header-install-hook:
+       $(MKDIR_P) $(DESTDIR)/$(pkgincludedir)
+       cd $(DESTDIR)/$(includedir)/elogind && \
+               for hdr in $(notdir $(pkginclude_HEADERS)) ; do \
+                       rm -f $$hdr ; \
+                       $(LN_S) systemd/$$hdr $$hdr ; \
+               done
+
+header-uninstall-hook:
+       m -f $(DESTDIR)/$(includedir)/elogind/*.h
+
+INSTALL_EXEC_HOOKS += header-install-hook
+UNINSTALL_EXEC_HOOKS += header-uninstall-hook
+
+rootlib_LTLIBRARIES += \
+       libelogind.la
+
+tests += \
+       test-bus-signature \
+       test-bus-server \
+       test-bus-match \
+       test-bus-introspect \
+       test-bus-error \
+       test-event
+
+test_bus_signature_SOURCES = \
+       src/libelogind/sd-bus/test-bus-signature.c
+
+test_bus_signature_LDADD = \
+       libelogind-shared.la
+
+test_bus_server_SOURCES = \
+       src/libelogind/sd-bus/test-bus-server.c
+
+test_bus_server_LDADD = \
+       libelogind-shared.la
+
+test_bus_error_SOURCES = \
+       src/libelogind/sd-bus/test-bus-error.c
+
+# Link statically because this test uses BUS_ERROR_MAP_ELF_REGISTER
+test_bus_error_LDADD = \
+       libshared.la
+
+test_bus_match_SOURCES = \
+       src/libelogind/sd-bus/test-bus-match.c
+
+test_bus_match_LDADD = \
+       libelogind-shared.la
+
+test_bus_introspect_SOURCES = \
+       src/libelogind/sd-bus/test-bus-introspect.c
+
+test_bus_introspect_LDADD = \
+       libelogind-shared.la
+
+test_event_SOURCES = \
+       src/libelogind/sd-event/test-event.c
+
+test_event_LDADD = \
+       libelogind-shared.la
+
+# ------------------------------------------------------------------------------
+test_id128_SOURCES = \
+       src/test/test-id128.c
+
+test_id128_LDADD = \
+       libelogind-shared.la
+
+tests += \
+       test-id128
+
+# ------------------------------------------------------------------------------
+test_hash_SOURCES = \
+       src/test/test-hash.c
+
+test_hash_LDADD = \
+       libelogind-shared.la
+
+tests += \
+       test-hash
 
 # ------------------------------------------------------------------------------
 elogind_SOURCES = \
@@ -751,6 +1089,14 @@ elogind_LDADD = \
        libelogind-core.la
 
 libelogind_core_la_SOURCES = \
+       src/core/cgroup.h \
+       src/core/cgroup.c \
+       src/core/mount-setup.h \
+       src/core/mount-setup.c \
+        src/login/elogind.c \
+        src/login/elogind.h \
+       src/login/elogind-dbus.c \
+       src/login/elogind-dbus.h \
        src/login/logind-core.c \
        src/login/logind-device.c \
        src/login/logind-device.h \
@@ -772,75 +1118,76 @@ libelogind_core_la_SOURCES = \
        src/login/logind-session-dbus.c \
        src/login/logind-seat-dbus.c \
        src/login/logind-user-dbus.c \
-       src/login/logind-acl.h
+       src/login/logind-utmp.c \
+       src/login/logind-acl.h \
+       src/sleep/sleep.c \
+       src/sleep/sleep.h
+
+if HAVE_UTMP
+libelogind_core_la_SOURCES += \
+       src/shared/utmp-wtmp.c \
+       src/update-utmp/update-utmp.c
+endif
 
 libelogind_core_la_LIBADD = \
-       $(UDEV_LIBS) \
-       libelogind-internal.la
+       libelogind-shared.la
 
 if HAVE_ACL
 libelogind_core_la_SOURCES += \
        src/login/logind-acl.c
-
-libelogind_core_la_LIBADD += \
-       libelogind-acl.la
 endif
 
 noinst_LTLIBRARIES += \
        libelogind-core.la
 
-rootlibexec_PROGRAMS += \
+pkglibexec_PROGRAMS += \
        elogind
 
 loginctl_SOURCES = \
+       src/login/eloginctl.c \
+       src/login/eloginctl.h \
        src/login/loginctl.c \
        src/login/sysfs-show.h \
        src/login/sysfs-show.c
 
 loginctl_LDADD = \
-       $(UDEV_LIBS) \
-       libelogind-internal.la \
        libelogind-shared.la
 
 rootbin_PROGRAMS += \
        loginctl
 
-dist_bashcompletion_DATA += \
+dist_bashcompletion_data = \
        shell-completion/bash/loginctl
 
-dist_zshcompletion_DATA += \
+dist_zshcompletion_data = \
        shell-completion/zsh/_loginctl \
-       shell-completion/zsh/_systemd-inhibit
+       shell-completion/zsh/_elogind-inhibit
 
-systemd_inhibit_SOURCES = \
+elogind_inhibit_SOURCES = \
        src/login/inhibit.c
 
-systemd_inhibit_LDADD = \
-       libelogind-internal.la \
+elogind_inhibit_LDADD = \
        libelogind-shared.la
 
 rootbin_PROGRAMS += \
-       systemd-inhibit
+       elogind-inhibit
 
 test_login_SOURCES = \
        src/libelogind/sd-login/test-login.c
 
 test_login_LDADD = \
-       libelogind-internal.la \
        libelogind-shared.la
 
 test_login_shared_SOURCES = \
        src/login/test-login-shared.c
 
 test_login_shared_LDADD = \
-       libelogind-internal.la \
        libelogind-shared.la
 
 test_inhibit_SOURCES = \
        src/login/test-inhibit.c
 
 test_inhibit_LDADD = \
-       libelogind-internal.la \
        libelogind-shared.la
 
 test_login_tables_SOURCES = \
@@ -864,8 +1211,7 @@ pam_elogind_la_SOURCES = \
 
 pam_elogind_la_CFLAGS = \
        $(AM_CFLAGS) \
-       $(PAM_CFLAGS) \
-       -fvisibility=hidden
+       $(PAM_CFLAGS)
 
 pam_elogind_la_LDFLAGS = \
        $(AM_LDFLAGS) \
@@ -876,15 +1222,19 @@ pam_elogind_la_LDFLAGS = \
        -Wl,--version-script=$(top_srcdir)/src/login/pam_elogind.sym
 
 pam_elogind_la_LIBADD = \
-       libelogind-internal.la \
+       libshared.la \
        $(PAM_LIBS)
 
 pamlib_LTLIBRARIES = \
        pam_elogind.la
 
+if ENABLE_PAM_CONFIG
 dist_pamconf_DATA = \
        src/login/elogind-user
+endif
 
+EXTRA_DIST += \
+       src/login/elogind-user.m4
 endif
 
 dist_dbussystemservice_DATA += \
@@ -893,23 +1243,17 @@ dist_dbussystemservice_DATA += \
 dist_dbuspolicy_DATA += \
        src/login/org.freedesktop.login1.conf
 
-dist_pkgsysconf_DATA += \
+nodist_pkgsysconf_DATA += \
        src/login/logind.conf
 
 polkitpolicy_files += \
        src/login/org.freedesktop.login1.policy
 
-INSTALL_DIRS += \
-       $(elogindstatedir)
-
-SYSTEM_UNIT_ALIASES += \
-       elogind.service dbus-org.freedesktop.login1.service
-
-dist_udevrules_DATA = \
+dist_udevrules_DATA += \
        src/login/70-uaccess.rules \
        src/login/70-power-switch.rules
 
-nodist_udevrules_DATA = \
+nodist_udevrules_DATA += \
        src/login/71-seat.rules \
        src/login/73-seat-late.rules
 
@@ -921,10 +1265,12 @@ gperf_gperf_sources = \
 
 EXTRA_DIST += \
        src/login/71-seat.rules.in \
-       src/login/73-seat-late.rules.in
+       src/login/73-seat-late.rules.in \
+       src/login/logind.conf.in
 
 # ------------------------------------------------------------------------------
 substitutions = \
+       '|rootlibdir=$(rootlibdir)|' \
        '|rootlibexecdir=$(rootlibexecdir)|' \
        '|rootbindir=$(rootbindir)|' \
        '|bindir=$(bindir)|' \
@@ -940,18 +1286,19 @@ substitutions = \
        '|includedir=$(includedir)|' \
        '|VERSION=$(VERSION)|' \
        '|rootprefix=$(rootprefix)|' \
+       '|udevlibexecdir=$(udevlibexecdir)|' \
+       '|KILL=$(KILL)|' \
        '|MKDIR_P=$(MKDIR_P)|' \
-       '|VARLOGDIR=$(varlogdir)|' \
+       '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \
        '|systemuidmax=$(SYSTEM_UID_MAX)|' \
-       '|systemgidmax=$(SYSTEM_GID_MAX)|'
+       '|systemgidmax=$(SYSTEM_GID_MAX)|' \
+       '|TTY_GID=$(TTY_GID)|'
 
 SED_PROCESS = \
        $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
        $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
-               < $< > $@
-
-units/%: units/%.in
-       $(SED_PROCESS)
+                -e '/^\#\# /d' \
+                < $< > $@
 
 man/%: man/%.in
        $(SED_PROCESS)
@@ -962,12 +1309,6 @@ sysctl.d/%: sysctl.d/%.in
 %.pc: %.pc.in
        $(SED_PROCESS)
 
-%.conf: %.conf.in
-       $(SED_PROCESS)
-
-src/%.policy.in: src/%.policy.in.in
-       $(SED_PROCESS)
-
 shell-completion/%: shell-completion/%.in
        $(SED_PROCESS)
 
@@ -1008,13 +1349,13 @@ units/user/%: units/user/%.m4
 
 if ENABLE_POLKIT
 nodist_polkitpolicy_DATA = \
-       $(polkitpolicy_files) \
-       $(polkitpolicy_in_in_files:.policy.in.in=.policy)
+       $(polkitpolicy_files)
+polkitrules_DATA = $(polkitrules_files)
+polkitpkla_DATA = $(polkitpkla_files)
 endif
 
 EXTRA_DIST += \
-       $(polkitpolicy_in_files) \
-       $(polkitpolicy_in_in_files)
+       $(polkitpolicy_in_files)
 
 # ------------------------------------------------------------------------------
 if ENABLE_MANPAGES
@@ -1024,7 +1365,7 @@ man/custom-entities.ent: configure.ac
         printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
         > $@ # '
 
-DISTCLEANFILES += \
+CLEANFILES += \
        man/custom-entities.ent
 
 XSLTPROC_FLAGS = \
@@ -1073,42 +1414,34 @@ EXTRA_DIST += \
 
 install-exec-hook: $(INSTALL_EXEC_HOOKS)
 
-uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
-
-install-data-hook: $(INSTALL_DATA_HOOKS)
+uninstall-hook: $(UNINSTALL_EXEC_HOOKS)
 
 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
 
 clean-local: $(CLEAN_LOCAL_HOOKS)
        rm -rf $(abs_srcdir)/install-tree
+       rm -f $(abs_srcdir)/hwdb/usb.ids $(abs_srcdir)/hwdb/pci.ids $(abs_srcdir)/hwdb/oui.txt \
+             $(abs_srcdir)/hwdb/iab.txt
 
 DISTCHECK_CONFIGURE_FLAGS = \
        --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \
-       --with-dbussessionservicedir=$$dc_install_base/$(dbussessionservicedir) \
        --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \
        --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
        --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \
        --with-pamlibdir=$$dc_install_base/$(pamlibdir) \
        --with-pamconfdir=$$dc_install_base/$(pamconfdir) \
-       --with-rootprefix=$$dc_install_base \
-       --disable-split-usr \
-       --enable-kdbus
+       --with-rootprefix=$$dc_install_base
 
+if ENABLE_SPLIT_USR
 DISTCHECK_CONFIGURE_FLAGS += \
-       --with-sysvinit-path= \
-       --with-sysvrcnd-path=
-
-if ENABLE_GTK_DOC
+       --enable-split-usr
+else
 DISTCHECK_CONFIGURE_FLAGS += \
-       --enable-gtk-doc
+       --disable-split-usr
 endif
 
-#
-# Require python when making dist
-#
 .PHONY: dist-check-help
-
-dist-check-help: $(rootbin_PROGRAMS) $(bin_PROGRAMS)
+dist-check-help: $(rootbin_PROGRAMS)
        for i in $(abspath $^); do                                             \
             if $$i  --help | grep -v 'default:' | grep -E -q '.{80}.' ; then   \
                echo "$(basename $$i) --help output is too wide:";             \
@@ -1116,4 +1449,193 @@ dist-check-help: $(rootbin_PROGRAMS) $(bin_PROGRAMS)
                exit 1;                                                        \
             fi; done
 
-dist: dist-check-python
+include_compilers = "$(CC)" "$(CC) -ansi" "$(CC) -std=iso9899:1990"
+public_headers = $(filter-out src/systemd/_sd-common.h, $(pkginclude_HEADERS) $(include_HEADERS))
+.PHONY: dist-check-includes
+dist-check-includes: $(public_headers)
+       @res=0;                                                                 \
+       for i in $(abspath $^); do                                              \
+           for cc in $(include_compilers); do                                  \
+               echo "$$cc -o/dev/null -c -x c -include "$$i" - </dev/null";    \
+               $$cc -o/dev/null -c -x c -include "$$i" - </dev/null || res=1;  \
+           done;                                                               \
+       done; exit $$res
+
+dist:
+
+.PHONY: git-tag
+git-tag:
+       git tag -s "v$(VERSION)" -m "elogind $(VERSION)"
+
+.PHONY: git-tar
+git-tar:
+       $(AM_V_at)git archive --format=tar --prefix=elogind-$(VERSION)-raw/ HEAD | \
+               (cd /var/tmp/ && tar xf -)
+       $(AM_V_GEN)(cd /var/tmp && rm -rf elogind-$(VERSION) && $(MKDIR_P) elogind-$(VERSION) && \
+        for f in `find elogind-$(VERSION)-raw/ -type f | cut -d '/' -f 2-` ; do \
+               $(MKDIR_P) elogind-$(VERSION)/`dirname $$f` ;            \
+               $(AWK) 'BEGIN                    { i=0;e=0      }        \
+                       /^#if\s+0.*elogind.*$$/  { i=1;next     }        \
+                       /^#else\s*$$/            {                       \
+                           { if ( i==1 ) e=1; else print }{next}        \
+                       }                                                \
+                       /^#endif\s*\/\/\s*0\s*$$/ {                      \
+                           { if ( i==1 ) { i=0;e=0 } else print }{next} \
+                       }                                                \
+                       /^\s*\/\/\/.*elogind.*$$/{ next         }        \
+                       /^\s*\/\/\s*#include.+$$/{ next         }        \
+                       { if ( (i==0) || (e==1) ) print         }'       \
+                         elogind-$(VERSION)-raw/$$f                     \
+                       > elogind-$(VERSION)/$$f ;                       \
+                       chmod `stat -c '%a' elogind-$(VERSION)-raw/$$f`  \
+                                           elogind-$(VERSION)/$$f ;     \
+        done ; \
+        for l in `find elogind-$(VERSION)-raw/ -type l | cut -d '/' -f 2-` ; do \
+               $(MKDIR_P) elogind-$(VERSION)/`dirname $$l` ; \
+               cp -P elogind-$(VERSION)-raw/$$l elogind-$(VERSION)/$$l ; \
+        done ; \
+        tar czf elogind-$(VERSION).tar.gz elogind-$(VERSION) ; \
+        rm -rf elogind-$(VERSION) elogind-$(VERSION)-raw) ; \
+       $(AM_V_at)mv /var/tmp/elogind-$(VERSION).tar.gz ./
+
+.PHONY: install-tree
+install-tree: all
+       rm -rf $(abs_srcdir)/install-tree
+       $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
+       tree $(abs_srcdir)/install-tree
+
+# Let's run all tests of the test suite, but under valgrind. Let's
+# exclude perl/python/shell scripts we have in there
+.PHONY: valgrind-tests
+valgrind-tests: $(TESTS)
+       $(AM_V_GEN)for f in $(filter-out %.pl %.py, $^); do \
+               if $(LIBTOOL) --mode=execute file $$f | grep -q shell; then \
+               echo -e "$${x}Skipping non-binary $$f"; else \
+               echo -e "$${x}Running $$f"; \
+               $(AM_TESTS_ENVIRONMENT) $(LIBTOOL) --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
+               x="\n\n"; \
+       done
+
+exported-%: %
+       $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@
+
+exported: $(addprefix exported-, $(rootlib_LTLIBRARIES))
+       $(AM_V_GEN)cat $^ > $@
+
+.PHONY: check-api-docs
+check-api-docs: exported man
+       $(AM_V_GEN)for symbol in `cat exported` ; do \
+               if test -f $(builddir)/man/$$symbol.html ; then \
+                       echo "  Symbol $$symbol() is documented." ; \
+               else \
+                       echo "‣ Symbol $$symbol() lacks documentation." ; \
+               fi ; \
+       done
+
+OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
+ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
+
+undefined defined: $(ALL_OBJECTS)
+       $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \
+               $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \
+       done | cut -c 20- | cut -d @ -f 1 | sort -u > $@
+
+CLEANFILES += \
+       defined \
+       undefined
+
+.PHONY: check-api-unused
+check-api-unused: defined undefined exported
+       ( cat exported undefined ) | sort -u  | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
+
+.PHONY: check-includes
+check-includes: $(top_srcdir)/tools/check-includes.pl
+       $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \
+               | xargs $(top_srcdir)/tools/check-includes.pl
+
+EXTRA_DIST += \
+       $(top_srcdir)/tools/check-includes.pl
+
+# Stupid test that everything purported to be exported really is
+define generate-sym-test
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
+       $(AM_V_at)printf '#include <stdio.h>\n' > $@
+       $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@
+       $(AM_V_at)printf 'void* functions[] = {\n' >> $@
+       $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@
+       $(AM_V_at)printf '};\nint main(void) {\n' >> $@
+       $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@
+       $(AM_V_at)printf 'return 0; }\n' >> $@
+endef
+
+test-libelogind-sym.c: \
+               $(top_builddir)/src/libelogind/libelogind.sym \
+               src/systemd/sd-daemon.h \
+               src/systemd/sd-login.h \
+               src/systemd/sd-bus.h \
+               src/systemd/sd-event.h
+       $(generate-sym-test)
+
+test_libelogind_sym_SOURCES = \
+       test-libelogind-sym.c
+test_libelogind_sym_LDADD = \
+       libelogind.la
+
+BUILT_SOURCES += \
+       $(test_libelogind_sym_SOURCES)
+
+tests += \
+       test-libelogind-sym
+
+.PHONY: install-tests
+install-tests: $(tests) $(TEST_DATA_FILES)
+       for f in $(tests); do \
+           if [ -x $(top_builddir)/.libs/$$f ]; then \
+               install -D -m 755 $(top_builddir)/.libs/$$f $(DESTDIR)/$(testsdir)/$$f; \
+           else \
+               install -D -m 755 $(top_builddir)/$$f $(DESTDIR)/$(testsdir)/$$f; \
+           fi; \
+       done
+       for f in $(TEST_DATA_FILES); do \
+           install -D -m 644 $(top_srcdir)/$$f $(DESTDIR)/$(testsdir)/testdata/$${f#test/}; \
+       done
+
+.PHONY: cccc cppcheck
+cccc: all
+       cccc --outdir=$(top_builddir)/cccc \
+       `find $(top_srcdir)/src/ -name '*.h' -or -name '*.c'`
+
+cppcheck:
+       cppcheck --enable=all -q \
+       -I $(top_srcdir)/src \
+       -I $(top_builddir)/src/basic \
+       -I $(top_srcdir)/src/basic \
+       -I $(top_srcdir)/src/core \
+       -I $(top_srcdir)/src/shared \
+       -I $(top_builddir)/src/shared \
+       -I $(top_srcdir)/src/login \
+       -I $(top_srcdir)/src/systemd \
+       -I $(top_srcdir)/src/libelogind/sd-bus \
+       -I $(top_srcdir)/src/libelogind/sd-event \
+       -I $(top_srcdir)/src/libelogind/sd-login \
+       -I $(top_srcdir)/src/libelogind/sd-id128 \
+       -I $(top_srcdir)/src/update-utmp \
+       -I $(top_srcdir)/src/sleep \
+       --force \
+       $(top_srcdir)
+
+# Used to extract compile flags for YCM.
+print-%:
+       @echo $($*)
+
+git-contrib:
+       @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | sed 's/ / /g' | awk '{ print $$0 "," }' | sort -u
+
+EXTRA_DIST += \
+        tools/gdb-sd_dump_hashmaps.py
+
+list-keys:
+       gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys
+
+add-key:
+       gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import -