1 # -*- Mode: makefile; indent-tabs-mode: t -*-
3 # This file is part of elogind.
5 # Copyright 2010-2012 Lennart Poettering
6 # Copyright 2010-2012 Kay Sievers
7 # Copyright 2013 Zbigniew Jędrzejewski-Szmek
8 # Copyright 2013 David Strauss
10 # elogind is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU Lesser General Public License as published by
12 # the Free Software Foundation; either version 2.1 of the License, or
13 # (at your option) any later version.
15 # elogind is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public License
21 # along with elogind; If not, see <http://www.gnu.org/licenses/>.
23 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
24 AM_MAKEFLAGS = --no-print-directory
25 AUTOMAKE_OPTIONS = color-tests parallel-tests
27 GCC_COLORS ?= 'ooh, shiny!'
32 # remove targets if the command fails
35 # keep intermediate files
38 # Keep the test-suite.log
39 .PRECIOUS: $(TEST_SUITE_LOG) Makefile
45 # Dirs of external packages
46 dbuspolicydir=@dbuspolicydir@
47 dbussystemservicedir=@dbussystemservicedir@
49 pamconfdir=@pamconfdir@
50 pkgconfigdatadir=$(datadir)/pkgconfig
51 pkgconfiglibdir=$(libdir)/pkgconfig
52 polkitpolicydir=$(datadir)/polkit-1/actions
53 bashcompletiondir=@bashcompletiondir@
54 zshcompletiondir=@zshcompletiondir@
56 CGROUP_CONTROLLER=@cgroup_controller@
57 PKTTYAGENT=$(bindir)/pkttyagent
59 # Our own, non-special dirs
60 pkgsysconfdir=$(sysconfdir)/elogind
61 pkgincludedir=$(includedir)/elogind/systemd
62 udevrulesdir=@udevrulesdir@
63 udevbindir=@udevbindir@
64 udevlibexecdir=$(udevbindir)
65 udevhomedir=$(udevlibexecdir)
66 systemshutdowndir=$(rootlibexecdir)/system-shutdown
67 systemsleepdir=$(rootlibexecdir)/system-sleep
68 factory_pamdir = $(datadir)/factory/etc/pam.d
70 # And these are the special ones for /
71 rootprefix=@rootprefix@
72 rootbindir=$(rootprefix)/bin
73 rootlibexecdir=$(rootprefix)/lib/elogind
78 UNINSTALL_EXEC_HOOKS =
80 UNINSTALL_DATA_HOOKS =
81 DISTCLEAN_LOCAL_HOOKS =
86 rootlibexec_LTLIBRARIES =
89 polkitpolicy_in_files =
92 nodist_udevrules_DATA =
93 dist_pkgsysconf_DATA =
94 nodist_pkgsysconf_DATA =
95 dist_dbuspolicy_DATA =
96 dist_dbussystemservice_DATA =
99 dist_rootlibexec_DATA =
103 noinst_PROGRAMS = $(manual_tests) $(tests)
110 if ENABLE_BASH_COMPLETION
111 dist_bashcompletion_DATA = $(dist_bashcompletion_data)
113 if ENABLE_ZSH_COMPLETION
114 dist_zshcompletion_DATA = $(dist_zshcompletion_data)
117 in_files = $(filter %.in,$(EXTRA_DIST))
118 in_in_files = $(filter %.in.in, $(in_files))
119 m4_files = $(filter %.m4,$(EXTRA_DIST) $(in_files:.m4.in=.m4))
121 CLEANFILES = $(BUILT_SOURCES) \
122 $(pkgconfiglib_DATA) \
123 $(in_files:.in=) $(in_in_files:.in.in=) \
126 .PHONY: $(INSTALL_EXEC_HOOKS) $(UNINSTALL_EXEC_HOOKS) \
127 $(INSTALL_DATA_HOOKS) $(UNINSTALL_DATA_HOOKS) \
128 $(DISTCLEAN_LOCAL_HOOKS) $(CLEAN_LOCAL_HOOKS)
131 -include $(top_builddir)/config.h \
132 -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
133 -DSYSTEMD_CGROUP_CONTROLLER=\"$(CGROUP_CONTROLLER)\" \
134 -DSYSTEMD_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
135 -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
136 -DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
137 -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
138 -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" \
140 -DREBOOT=\"$(REBOOT)\" \
141 -DKEXEC=\"$(KEXEC)\" \
142 -DLIBDIR=\"$(libdir)\" \
143 -DROOTLIBDIR=\"$(rootlibdir)\" \
144 -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
145 -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
146 -I $(top_srcdir)/src \
147 -I $(top_builddir)/src/basic \
148 -I $(top_srcdir)/src/basic \
149 -I $(top_srcdir)/src/core \
150 -I $(top_srcdir)/src/shared \
151 -I $(top_builddir)/src/shared \
152 -I $(top_srcdir)/src/login \
153 -I $(top_srcdir)/src/systemd \
154 -I $(top_srcdir)/src/libelogind/sd-bus \
155 -I $(top_srcdir)/src/libelogind/sd-event \
156 -I $(top_srcdir)/src/libelogind/sd-login \
157 -I $(top_srcdir)/src/libelogind/sd-id128 \
158 -I $(top_srcdir)/src/update-utmp \
161 AM_CFLAGS = $(OUR_CFLAGS)
162 AM_LDFLAGS = $(OUR_LDFLAGS)
164 # ------------------------------------------------------------------------------
165 define move-to-rootlibdir
166 if test "$(libdir)" != "$(rootlibdir)"; then \
167 $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
168 so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \
169 rm -f $(DESTDIR)$(libdir)/$$libname && \
170 $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
171 mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \
175 install-touch-usr-hook:
176 touch -c $(DESTDIR)/$(prefix)
178 INSTALL_EXEC_HOOKS += \
179 install-touch-usr-hook
182 # ------------------------------------------------------------------------------
183 AM_V_M4 = $(AM_V_M4_$(V))
184 AM_V_M4_ = $(AM_V_M4_$(AM_DEFAULT_VERBOSITY))
185 AM_V_M4_0 = @echo " M4 " $@;
187 AM_V_XSLT = $(AM_V_XSLT_$(V))
188 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
189 AM_V_XSLT_0 = @echo " XSLT " $@;
191 AM_V_GPERF = $(AM_V_GPERF_$(V))
192 AM_V_GPERF_ = $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY))
193 AM_V_GPERF_0 = @echo " GPERF " $@;
195 AM_V_LN = $(AM_V_LN_$(V))
196 AM_V_LN_ = $(AM_V_LN_$(AM_DEFAULT_VERBOSITY))
197 AM_V_LN_0 = @echo " LN " $@;
199 AM_V_RM = $(AM_V_RM_$(V))
200 AM_V_RM_ = $(AM_V_RM_$(AM_DEFAULT_VERBOSITY))
201 AM_V_RM_0 = @echo " RM " $@;
203 # ------------------------------------------------------------------------------
205 pkglibexec_PROGRAMS =
213 @INTLTOOL_POLICY_RULE@
215 # ------------------------------------------------------------------------------
220 include Makefile-man.am
222 .PHONY: man update-man-list
223 man: $(MANPAGES) $(MANPAGES_ALIAS) $(HTML_FILES) $(HTML_ALIAS)
226 ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}}
228 ${XML_FILES:.xml=.html}
230 ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(MANPAGES_ALIAS)}}}}}
250 $(AM_V_at)$(MKDIR_P) $(dir $@)
251 $(AM_V_LN)$(LN_S) -f ../../man $@
253 man/index.html: man/elogind.index.html
254 $(AM_V_LN)$(LN_S) -f elogind.index.html $@
264 XML_GLOB := $(wildcard $(top_srcdir)/man/*.xml)
265 DIRECTIVE_FILE := man/elogind.directives.xml
266 INDEX_XML_FILE := man/elogind.index.xml
267 NON_INDEX_XML_FILES := $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_FILES))
268 ALL_XML_FILES := $(INDEX_XML_FILE) $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_GLOB))
269 SOURCE_XML_FILES := ${patsubst %,$(top_srcdir)/%,$(filter-out $(DIRECTIVE_FILE),$(NON_INDEX_XML_FILES))}
271 # This target should only be run manually. It recreates Makefile-man.am
272 # file in the source directory based on all man/*.xml files. Run it after
273 # adding, removing, or changing the conditional in a man page.
274 update-man-list: $(top_srcdir)/tools/make-man-rules.py $(ALL_XML_FILES) man/custom-entities.ent
275 $(AM_V_GEN)$(PYTHON) $< $(ALL_XML_FILES) > $(top_srcdir)/Makefile-man.tmp
276 $(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
277 @echo "Makefile-man.am has been regenerated"
279 $(INDEX_XML_FILE): $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES)
280 $(AM_V_at)$(MKDIR_P) $(dir $@)
281 $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
283 $(DIRECTIVE_FILE): $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES)
284 $(AM_V_at)$(MKDIR_P) $(dir $@)
285 $(AM_V_GEN)$(PYTHON) $< $@ $(SOURCE_XML_FILES)
292 $(filter-out $(DIRECTIVE_FILE) $(INDEX_XML_FILE),$(XML_FILES)) \
293 tools/make-man-index.py \
294 tools/make-man-rules.py \
295 tools/make-directive-index.py \
296 tools/xml_helper.py \
297 man/glib-event-glue.c
299 # ------------------------------------------------------------------------------
300 noinst_LTLIBRARIES += \
303 libbasic_la_SOURCES = \
304 src/basic/missing.h \
305 src/basic/capability-util.c \
306 src/basic/capability-util.h \
307 src/basic/conf-files.c \
308 src/basic/conf-files.h \
309 src/basic/stdio-util.h \
310 src/basic/hostname-util.h \
311 src/basic/hostname-util.c \
312 src/basic/unit-name.c \
313 src/basic/unit-name.h \
314 src/basic/unaligned.h \
317 src/basic/io-util.c \
318 src/basic/io-util.h \
319 src/basic/string-util.c \
320 src/basic/string-util.h \
321 src/basic/parse-util.c \
322 src/basic/parse-util.h \
323 src/basic/fd-util.c \
324 src/basic/fd-util.h \
325 src/basic/user-util.c \
326 src/basic/user-util.h \
327 src/basic/dirent-util.c \
328 src/basic/dirent-util.h \
329 src/basic/xattr-util.c \
330 src/basic/xattr-util.h \
331 src/basic/proc-cmdline.c \
332 src/basic/proc-cmdline.h \
333 src/basic/fs-util.c \
334 src/basic/fs-util.h \
335 src/basic/syslog-util.c \
336 src/basic/syslog-util.h \
337 src/basic/stat-util.c \
338 src/basic/stat-util.h \
339 src/basic/mount-util.c \
340 src/basic/mount-util.h \
341 src/basic/hexdecoct.c \
342 src/basic/hexdecoct.h \
343 src/basic/extract-word.c \
344 src/basic/extract-word.h \
347 src/basic/path-util.c \
348 src/basic/path-util.h \
349 src/basic/parse-printf-format.c \
350 src/basic/parse-printf-format.h \
351 src/basic/time-util.c \
352 src/basic/time-util.h \
353 src/basic/locale-util.c \
354 src/basic/locale-util.h \
355 src/basic/umask-util.h \
356 src/basic/signal-util.c \
357 src/basic/signal-util.h \
358 src/basic/string-table.c \
359 src/basic/string-table.h \
360 src/basic/mempool.c \
361 src/basic/mempool.h \
362 src/basic/hashmap.c \
363 src/basic/hashmap.h \
364 src/basic/hash-funcs.c \
365 src/basic/hash-funcs.h \
366 src/basic/siphash24.c \
367 src/basic/siphash24.h \
374 src/basic/bus-label.c \
375 src/basic/bus-label.h \
378 src/basic/smack-util.c \
379 src/basic/smack-util.h \
382 src/basic/gunicode.c \
383 src/basic/gunicode.h \
384 src/basic/socket-util.c \
385 src/basic/socket-util.h \
390 src/basic/cgroup-util.c \
391 src/basic/cgroup-util.h \
392 src/basic/errno-list.c \
393 src/basic/errno-list.h \
394 src/basic/terminal-util.c \
395 src/basic/terminal-util.h \
396 src/basic/login-util.h \
397 src/basic/login-util.c \
398 src/basic/audit-util.c \
399 src/basic/audit-util.h \
400 src/basic/memfd-util.c \
401 src/basic/memfd-util.h \
402 src/basic/process-util.c \
403 src/basic/process-util.h \
404 src/basic/random-util.c \
405 src/basic/random-util.h \
410 src/basic/selinux-util.c \
411 src/basic/selinux-util.h \
412 src/basic/mkdir-label.c \
413 src/basic/fileio-label.c \
414 src/basic/fileio-label.h \
419 src/basic/alloc-util.h \
420 src/basic/alloc-util.c
422 nodist_libbasic_la_SOURCES = \
423 src/basic/errno-from-name.h \
424 src/basic/errno-to-name.h
426 libbasic_la_CFLAGS = \
432 libbasic_la_LDFLAGS = \
435 libbasic_la_LIBADD = \
441 # -----------------------------------------------------------------------------
442 noinst_LTLIBRARIES += \
445 libshared_la_SOURCES = \
446 src/shared/bus-util.c \
447 src/shared/bus-util.h \
448 src/shared/clean-ipc.c \
449 src/shared/clean-ipc.h \
450 src/shared/conf-parser.c \
451 src/shared/conf-parser.h \
452 src/shared/musl_missing.h \
453 src/shared/musl_missing.c \
456 src/shared/spawn-polkit-agent.c \
457 src/shared/spawn-polkit-agent.h
460 libshared_la_SOURCES += \
461 src/shared/utmp-wtmp.c \
462 src/update-utmp/update-utmp.c
466 libshared_la_SOURCES += \
467 src/shared/acl-util.c \
468 src/shared/acl-util.h
471 libshared_la_CFLAGS = \
475 libshared_la_LIBADD = \
476 libelogind-internal.la \
481 rootlibexec_LTLIBRARIES += \
484 libelogind_shared_la_SOURCES = \
485 $(libbasic_la_SOURCES) \
486 $(libshared_la_SOURCES) \
487 $(libelogind_internal_la_SOURCES) \
488 $(libelogind_journal_internal_la_SOURCES) \
489 $(libudev_internal_la_SOURCES)
491 libelogind_shared_la_CFLAGS = \
493 $(libbasic_la_CFLAGS) \
494 $(libshared_la_CFLAGS) \
495 $(libelogind_internal_la_CFLAGS) \
496 $(libelogind_journal_internal_la_CFLAGS) \
497 $(libudev_internal_la_CFLAGS) \
503 # We can't use libshared_la_LIBADD here because it would
504 # pull in libelogind*-internal.la
505 libelogind_shared_la_LIBADD = \
506 $(libbasic_la_LIBADD) \
507 $(libelogind_internal_la_LIBADD) \
513 libelogind_shared_la_LDFLAGS = \
515 -release $(PACKAGE_VERSION)
517 # -----------------------------------------------------------------------------
518 gperf_txt_sources = \
519 src/basic/errno-list.txt
522 $(gperf_gperf_m4_sources:-gperf.gperf.m4=-gperf.c) \
523 $(gperf_gperf_sources:-gperf.gperf=-gperf.c) \
524 $(gperf_txt_sources:-list.txt=-from-name.h) \
525 $(gperf_txt_sources:-list.txt=-to-name.h)
528 $(gperf_txt_sources:-list.txt=-from-name.gperf)
533 $(gperf_gperf_m4_sources) \
534 $(gperf_gperf_sources)
539 %-from-name.gperf: %-list.txt
540 $(AM_V_at)$(MKDIR_P) $(dir $@)
541 $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
543 %-from-name.h: %-from-name.gperf
544 $(AM_V_at)$(MKDIR_P) $(dir $@)
545 $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
548 src/basic/errno-list.txt:
549 $(AM_V_at)$(MKDIR_P) $(dir $@)
550 $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
552 src/basic/errno-to-name.h: src/basic/errno-list.txt
553 $(AM_V_at)$(MKDIR_P) $(dir $@)
554 $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
557 # ------------------------------------------------------------------------------
560 dist_factory_pam_DATA = \
561 factory/etc/pam.d/system-auth \
562 factory/etc/pam.d/other
565 # ------------------------------------------------------------------------------
566 pkglibexec_PROGRAMS += \
567 elogind-cgroups-agent
569 elogind_cgroups_agent_SOURCES = \
570 src/cgroups-agent/cgroups-agent.c
572 elogind_cgroups_agent_LDADD = \
575 # ------------------------------------------------------------------------------
576 libelogind_internal_la_SOURCES = \
577 src/systemd/sd-bus.h \
578 src/systemd/sd-bus-protocol.h \
579 src/systemd/sd-bus-vtable.h \
580 src/systemd/sd-event.h \
581 src/systemd/sd-login.h \
582 src/systemd/sd-id128.h \
583 src/systemd/sd-daemon.h \
584 src/libelogind/libelogind.sym \
585 src/libelogind/sd-bus/sd-bus.c \
586 src/libelogind/sd-bus/bus-control.c \
587 src/libelogind/sd-bus/bus-control.h \
588 src/libelogind/sd-bus/bus-error.c \
589 src/libelogind/sd-bus/bus-error.h \
590 src/libelogind/sd-bus/bus-common-errors.h \
591 src/libelogind/sd-bus/bus-common-errors.c \
592 src/libelogind/sd-bus/bus-internal.c \
593 src/libelogind/sd-bus/bus-internal.h \
594 src/libelogind/sd-bus/bus-socket.c \
595 src/libelogind/sd-bus/bus-socket.h \
596 src/libelogind/sd-bus/bus-kernel.c \
597 src/libelogind/sd-bus/bus-kernel.h \
598 src/libelogind/sd-bus/bus-container.c \
599 src/libelogind/sd-bus/bus-container.h \
600 src/libelogind/sd-bus/bus-message.c \
601 src/libelogind/sd-bus/bus-message.h \
602 src/libelogind/sd-bus/bus-creds.c \
603 src/libelogind/sd-bus/bus-creds.h \
604 src/libelogind/sd-bus/bus-signature.c \
605 src/libelogind/sd-bus/bus-signature.h \
606 src/libelogind/sd-bus/bus-type.c \
607 src/libelogind/sd-bus/bus-type.h \
608 src/libelogind/sd-bus/bus-match.c \
609 src/libelogind/sd-bus/bus-match.h \
610 src/libelogind/sd-bus/bus-bloom.c \
611 src/libelogind/sd-bus/bus-bloom.h \
612 src/libelogind/sd-bus/bus-introspect.c \
613 src/libelogind/sd-bus/bus-introspect.h \
614 src/libelogind/sd-bus/bus-objects.c \
615 src/libelogind/sd-bus/bus-objects.h \
616 src/libelogind/sd-bus/bus-gvariant.c \
617 src/libelogind/sd-bus/bus-gvariant.h \
618 src/libelogind/sd-bus/bus-convenience.c \
619 src/libelogind/sd-bus/bus-track.c \
620 src/libelogind/sd-bus/bus-track.h \
621 src/libelogind/sd-bus/bus-slot.c \
622 src/libelogind/sd-bus/bus-slot.h \
623 src/libelogind/sd-bus/bus-protocol.h \
624 src/libelogind/sd-event/sd-event.c \
625 src/libelogind/sd-id128/sd-id128.c \
626 src/libelogind/sd-id128/id128-util.h \
627 src/libelogind/sd-id128/id128-util.c \
628 src/libelogind/sd-daemon/sd-daemon.c \
629 src/libelogind/sd-login/sd-login.c
631 libelogind_internal_la_LIBADD = \
634 noinst_LTLIBRARIES += \
635 libelogind-internal.la
638 src/libelogind/libelogind.pc.in \
639 src/libelogind/sd-bus/DIFFERENCES \
640 src/libelogind/sd-bus/GVARIANT-SERIALIZATION
642 libelogind_la_SOURCES =
644 libelogind_la_LDFLAGS = \
646 -version-info $(LIBELOGIND_CURRENT):$(LIBELOGIND_REVISION):$(LIBELOGIND_AGE) \
647 -Wl,--version-script=$(top_srcdir)/src/libelogind/libelogind.sym
649 libelogind_la_LIBADD = \
650 libelogind-internal.la \
653 libelogind-install-hook:
654 libname=libelogind.so && $(move-to-rootlibdir)
656 libelogind-uninstall-hook:
657 rm -f $(DESTDIR)$(rootlibdir)/libelogind.so*
659 INSTALL_EXEC_HOOKS += libelogind-install-hook
660 UNINSTALL_EXEC_HOOKS += libelogind-uninstall-hook
662 pkgconfiglib_DATA += \
663 src/libelogind/libelogind.pc
665 pkginclude_HEADERS += \
666 src/systemd/sd-login.h \
667 src/systemd/sd-messages.h \
668 src/systemd/sd-id128.h \
669 src/systemd/_sd-common.h
672 $(MKDIR_P) $(DESTDIR)/$(pkgincludedir)
673 cd $(DESTDIR)/$(includedir)/elogind && \
674 for hdr in $(notdir $(pkginclude_HEADERS)) ; do \
676 $(LN_S) systemd/$$hdr $$hdr ; \
679 header-uninstall-hook:
680 m -f $(DESTDIR)/$(includedir)/elogind/*.h
682 INSTALL_EXEC_HOOKS += header-install-hook
683 UNINSTALL_EXEC_HOOKS += header-uninstall-hook
688 # ------------------------------------------------------------------------------
693 nodist_elogind_SOURCES = \
694 src/login/logind-gperf.c
699 libelogind_core_la_SOURCES = \
700 src/login/logind-core.c \
701 src/login/logind-device.c \
702 src/login/logind-device.h \
703 src/login/logind-button.c \
704 src/login/logind-button.h \
705 src/login/logind-action.c \
706 src/login/logind-action.h \
707 src/login/logind-seat.c \
708 src/login/logind-seat.h \
709 src/login/logind-session.c \
710 src/login/logind-session.h \
711 src/login/logind-session-device.c \
712 src/login/logind-session-device.h \
713 src/login/logind-sleep.c \
714 src/login/logind-sleep.h \
715 src/login/logind-user.c \
716 src/login/logind-user.h \
717 src/login/logind-inhibit.c \
718 src/login/logind-inhibit.h \
719 src/login/logind-dbus.c \
720 src/login/logind-session-dbus.c \
721 src/login/logind-seat-dbus.c \
722 src/login/logind-user-dbus.c \
723 src/login/logind-utmp.c \
724 src/login/logind-acl.h \
727 src/core/mount-setup.h \
728 src/core/mount-setup.c
730 libelogind_core_la_LIBADD = \
734 libelogind_core_la_SOURCES += \
735 src/login/logind-acl.c
738 noinst_LTLIBRARIES += \
741 pkglibexec_PROGRAMS += \
745 src/login/loginctl.c \
746 src/login/sysfs-show.h \
747 src/login/sysfs-show.c
752 rootbin_PROGRAMS += \
755 dist_bashcompletion_data = \
756 shell-completion/bash/loginctl
758 dist_zshcompletion_data = \
759 shell-completion/zsh/_loginctl \
760 shell-completion/zsh/_elogind-inhibit
762 elogind_inhibit_SOURCES = \
765 elogind_inhibit_LDADD = \
768 rootbin_PROGRAMS += \
771 test_login_SOURCES = \
772 src/libelogind/sd-login/test-login.c
777 test_login_shared_SOURCES = \
778 src/login/test-login-shared.c
780 test_login_shared_LDADD = \
783 test_inhibit_SOURCES = \
784 src/login/test-inhibit.c
786 test_inhibit_LDADD = \
789 test_login_tables_SOURCES = \
790 src/login/test-login-tables.c
792 test_login_tables_LDADD = \
804 pam_elogind_la_SOURCES = \
805 src/login/pam_elogind.sym \
806 src/login/pam_elogind.c
808 pam_elogind_la_CFLAGS = \
812 pam_elogind_la_LDFLAGS = \
818 -Wl,--version-script=$(top_srcdir)/src/login/pam_elogind.sym
820 pam_elogind_la_LIBADD = \
821 libelogind-shared.la \
824 pamlib_LTLIBRARIES = \
827 dist_pamconf_DATA = \
828 src/login/elogind-user
831 src/login/elogind-user.m4
834 dist_dbussystemservice_DATA += \
835 src/login/org.freedesktop.login1.service
837 dist_dbuspolicy_DATA += \
838 src/login/org.freedesktop.login1.conf
840 nodist_pkgsysconf_DATA += \
841 src/login/logind.conf
843 polkitpolicy_files += \
844 src/login/org.freedesktop.login1.policy
846 dist_udevrules_DATA += \
847 src/login/70-uaccess.rules \
848 src/login/70-power-switch.rules
850 nodist_udevrules_DATA += \
851 src/login/71-seat.rules \
852 src/login/73-seat-late.rules
854 polkitpolicy_in_files += \
855 src/login/org.freedesktop.login1.policy.in
857 gperf_gperf_sources = \
858 src/login/logind-gperf.gperf
861 src/login/71-seat.rules.in \
862 src/login/73-seat-late.rules.in \
863 src/login/logind.conf.in
865 # ------------------------------------------------------------------------------
867 '|rootlibexecdir=$(rootlibexecdir)|' \
868 '|rootbindir=$(rootbindir)|' \
869 '|bindir=$(bindir)|' \
870 '|pkgsysconfdir=$(pkgsysconfdir)|' \
871 '|pkgdatadir=$(pkgdatadir)|' \
872 '|udevrulesdir=$(udevrulesdir)|' \
873 '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
874 '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
875 '|PACKAGE_URL=$(PACKAGE_URL)|' \
876 '|prefix=$(prefix)|' \
877 '|exec_prefix=$(exec_prefix)|' \
878 '|libdir=$(libdir)|' \
879 '|includedir=$(includedir)|' \
880 '|VERSION=$(VERSION)|' \
881 '|rootprefix=$(rootprefix)|' \
882 '|udevlibexecdir=$(udevlibexecdir)|' \
884 '|MKDIR_P=$(MKDIR_P)|' \
885 '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \
886 '|systemuidmax=$(SYSTEM_UID_MAX)|' \
887 '|systemgidmax=$(SYSTEM_GID_MAX)|' \
888 '|TTY_GID=$(TTY_GID)|'
891 $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
892 $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
898 sysctl.d/%: sysctl.d/%.in
904 shell-completion/%: shell-completion/%.in
915 $(AM_V_GEN)chmod +x $@
918 $(AM_V_at)$(MKDIR_P) $(dir $@)
919 $(AM_V_GPERF)$(GPERF) < $< > $@
922 $(AM_V_at)$(MKDIR_P) $(dir $@)
923 $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
925 sysusers.d/%: sysusers.d/%.m4
926 $(AM_V_at)$(MKDIR_P) $(dir $@)
927 $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
929 tmpfiles.d/%: tmpfiles.d/%.m4
930 $(AM_V_at)$(MKDIR_P) $(dir $@)
931 $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
935 $(AM_V_at)$(MKDIR_P) $(dir $@)
936 $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_SYSTEM=1 < $< > $@
938 units/user/%: units/user/%.m4
939 $(AM_V_at)$(MKDIR_P) $(dir $@)
940 $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
943 nodist_polkitpolicy_DATA = \
944 $(polkitpolicy_files)
948 $(polkitpolicy_in_files)
950 # ------------------------------------------------------------------------------
952 man/custom-entities.ent: configure.ac
953 $(AM_V_GEN)$(MKDIR_P) $(dir $@)
954 $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
955 printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
959 man/custom-entities.ent
964 --stringparam man.output.quietly 1 \
965 --stringparam funcsynopsis.style ansi \
966 --stringparam man.authors.section.enabled 0 \
967 --stringparam man.copyright.section.enabled 0 \
968 --stringparam elogind.version $(VERSION) \
969 --path '$(builddir)/man:$(srcdir)/man'
971 XSLTPROC_PROCESS_MAN = \
972 $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
974 XSLTPROC_PROCESS_HTML = \
975 $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
977 man/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
978 $(XSLTPROC_PROCESS_MAN)
980 man/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
981 $(XSLTPROC_PROCESS_MAN)
983 man/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
984 $(XSLTPROC_PROCESS_MAN)
986 man/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
987 $(XSLTPROC_PROCESS_MAN)
989 man/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
990 $(XSLTPROC_PROCESS_MAN)
992 man/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
993 $(XSLTPROC_PROCESS_HTML)
996 $(AM_V_LN)$(LN_S) -f $(notdir $<) $@
1002 man/custom-html.xsl \
1005 install-exec-hook: $(INSTALL_EXEC_HOOKS)
1007 uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
1009 install-data-hook: $(INSTALL_DATA_HOOKS)
1011 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
1013 clean-local: $(CLEAN_LOCAL_HOOKS)
1014 rm -rf $(abs_srcdir)/install-tree
1015 rm -f $(abs_srcdir)/hwdb/usb.ids $(abs_srcdir)/hwdb/pci.ids $(abs_srcdir)/hwdb/oui.txt \
1016 $(abs_srcdir)/hwdb/iab.txt
1018 DISTCHECK_CONFIGURE_FLAGS = \
1019 --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \
1020 --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \
1021 --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
1022 --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \
1023 --with-pamlibdir=$$dc_install_base/$(pamlibdir) \
1024 --with-pamconfdir=$$dc_install_base/$(pamconfdir) \
1025 --with-rootprefix=$$dc_install_base
1028 DISTCHECK_CONFIGURE_FLAGS += \
1031 DISTCHECK_CONFIGURE_FLAGS += \
1035 .PHONY: dist-check-help
1036 dist-check-help: $(rootbin_PROGRAMS)
1037 for i in $(abspath $^); do \
1038 if $$i --help | grep -v 'default:' | grep -E -q '.{80}.' ; then \
1039 echo "$(basename $$i) --help output is too wide:"; \
1040 $$i --help | awk 'length > 80' | grep -E --color=yes '.{80}'; \
1044 include_compilers = "$(CC)" "$(CC) -ansi" "$(CC) -std=iso9899:1990"
1045 public_headers = $(filter-out src/systemd/_sd-common.h, $(pkginclude_HEADERS) $(include_HEADERS))
1046 .PHONY: dist-check-includes
1047 dist-check-includes: $(public_headers)
1049 for i in $(abspath $^); do \
1050 for cc in $(include_compilers); do \
1051 echo "$$cc -o/dev/null -c -x c -include "$$i" - </dev/null"; \
1052 $$cc -o/dev/null -c -x c -include "$$i" - </dev/null || res=1; \
1060 git tag -s "v$(VERSION)" -m "elogind $(VERSION)"
1064 $(AM_V_at)git archive --format=tar --prefix=elogind-$(VERSION)-raw/ HEAD | \
1065 (cd /var/tmp/ && tar xf -)
1066 $(AM_V_GEN)(cd /var/tmp && rm -rf elogind-$(VERSION) && $(MKDIR_P) elogind-$(VERSION) && \
1067 for f in `find elogind-$(VERSION)-raw/ -type f | cut -d '/' -f 2-` ; do \
1068 $(MKDIR_P) elogind-$(VERSION)/`dirname $$f` ; \
1069 $(AWK) 'BEGIN { i=0;e=0 } \
1070 /^#if\s+0.*elogind.*$$/ { i=1;next } \
1072 { if ( i==1 ) e=1; else print }{next} \
1074 /^#endif\s*\/\/\s*0\s*$$/ { \
1075 { if ( i==1 ) { i=0;e=0 } else print }{next} \
1077 /^\s*\/\/\/.*elogind.*$$/{ next } \
1078 /^\s*\/\/\s*#include.+$$/{ next } \
1079 { if ( (i==0) || (e==1) ) print }' \
1080 elogind-$(VERSION)-raw/$$f \
1081 > elogind-$(VERSION)/$$f ; \
1082 chmod `stat -c '%a' elogind-$(VERSION)-raw/$$f` \
1083 elogind-$(VERSION)/$$f ; \
1085 for l in `find elogind-$(VERSION)-raw/ -type l | cut -d '/' -f 2-` ; do \
1086 $(MKDIR_P) elogind-$(VERSION)/`dirname $$l` ; \
1087 cp -P elogind-$(VERSION)-raw/$$l elogind-$(VERSION)/$$l ; \
1089 tar czf elogind-$(VERSION).tar.gz elogind-$(VERSION) ; \
1090 rm -rf elogind-$(VERSION) elogind-$(VERSION)-raw) ; \
1091 $(AM_V_at)mv /var/tmp/elogind-$(VERSION).tar.gz ./
1093 .PHONY: install-tree
1095 rm -rf $(abs_srcdir)/install-tree
1096 $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
1097 tree $(abs_srcdir)/install-tree
1099 # Let's run all tests of the test suite, but under valgrind. Let's
1100 # exclude the one perl script we have in there
1101 .PHONY: valgrind-tests
1102 valgrind-tests: $(TESTS)
1103 $(AM_V_GEN)for f in $(filter-out %.pl, $^); do \
1104 if $(LIBTOOL) --mode=execute file $$f | grep -q shell; then \
1105 echo -e "$${x}Skipping non-binary $$f"; else \
1106 echo -e "$${x}Running $$f"; \
1107 libtool --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
1112 $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@
1114 exported: $(addprefix exported-, $(lib_LTLIBRARIES))
1115 $(AM_V_GEN)cat $^ > $@
1117 .PHONY: check-api-docs
1118 check-api-docs: exported man
1119 $(AM_V_GEN)for symbol in `cat exported` ; do \
1120 if test -f $(builddir)/man/$$symbol.html ; then \
1121 echo " Symbol $$symbol() is documented." ; \
1123 echo "‣ Symbol $$symbol() lacks documentation." ; \
1127 OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
1128 ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
1130 undefined defined: $(ALL_OBJECTS)
1131 $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \
1132 $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \
1133 done | cut -c 20- | cut -d @ -f 1 | sort -u > $@
1139 .PHONY: check-api-unused
1140 check-api-unused: defined undefined exported
1141 ( cat exported undefined ) | sort -u | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
1143 .PHONY: check-includes
1144 check-includes: $(top_srcdir)/tools/check-includes.pl
1145 $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \
1146 | xargs $(top_srcdir)/tools/check-includes.pl
1149 $(top_srcdir)/tools/check-includes.pl
1151 # Stupid test that everything purported to be exported really is
1152 define generate-sym-test
1153 $(AM_V_at)$(MKDIR_P) $(dir $@)
1154 $(AM_V_at)printf '#include <stdio.h>\n' > $@
1155 $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@
1156 $(AM_V_at)printf 'void* functions[] = {\n' >> $@
1157 $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@
1158 $(AM_V_at)printf '};\nint main(void) {\n' >> $@
1159 $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@
1160 $(AM_V_at)printf 'return 0; }\n' >> $@
1163 test-libelogind-sym.c: \
1164 $(top_builddir)/src/libelogind/libelogind.sym \
1165 src/systemd/sd-daemon.h \
1166 src/systemd/sd-login.h \
1167 src/systemd/sd-bus.h \
1168 src/systemd/sd-event.h
1169 $(generate-sym-test)
1171 test_libelogind_sym_SOURCES = \
1172 test-libelogind-sym.c
1173 test_libelogind_sym_LDADD = \
1177 $(test_libelogind_sym_SOURCES)
1184 cppcheck --enable=all -q $(top_srcdir)
1186 # Used to extract compile flags for YCM.
1191 @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | awk '{ print $$0 "," }' | sort -u
1194 tools/gdb-sd_dump_hashmaps.py
1197 gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys
1200 gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import -