chiark / gitweb /
Prep v234: Apply missing upstream fixes in src/libelogind (2/6)
[elogind.git] / Makefile.am
1 #  -*- Mode: makefile; indent-tabs-mode: t -*-
2 #
3 #  This file is part of elogind.
4 #
5 #  Copyright 2010-2012 Lennart Poettering
6 #  Copyright 2010-2012 Kay Sievers
7 #  Copyright 2013 Zbigniew Jędrzejewski-Szmek
8 #  Copyright 2013 David Strauss
9 #
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.
14 #
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.
19 #
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/>.
22
23 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
24 AM_MAKEFLAGS = --no-print-directory
25 AUTOMAKE_OPTIONS = color-tests parallel-tests
26
27 GCC_COLORS ?= 'ooh, shiny!'
28 export GCC_COLORS
29
30 SUBDIRS = . po
31
32 # remove targets if the command fails
33 .DELETE_ON_ERROR:
34
35 # keep intermediate files
36 .SECONDARY:
37
38 # Keep the test-suite.log
39 .PRECIOUS: $(TEST_SUITE_LOG) Makefile
40
41 LIBELOGIND_CURRENT=19
42 LIBELOGIND_REVISION=0
43 LIBELOGIND_AGE=19
44
45 # Dirs of external packages
46 dbuspolicydir=@dbuspolicydir@
47 dbussystemservicedir=@dbussystemservicedir@
48 pamlibdir=@pamlibdir@
49 pamconfdir=@pamconfdir@
50 pkgconfigdatadir=$(datadir)/pkgconfig
51 pkgconfiglibdir=$(libdir)/pkgconfig
52 polkitpolicydir=$(datadir)/polkit-1/actions
53 polkitrulesdir=$(datadir)/polkit-1/rules.d
54 polkitpkladir=$(localstatedir)/lib/polkit-1/localauthority/10-vendor.d
55 bashcompletiondir=@bashcompletiondir@
56 zshcompletiondir=@zshcompletiondir@
57
58 CGROUP_CONTROLLER=@cgroup_controller@
59 PKTTYAGENT=$(bindir)/pkttyagent
60
61 # Our own, non-special dirs
62 pkgsysconfdir=$(sysconfdir)/elogind
63 pkgincludedir=$(includedir)/elogind/systemd
64 udevrulesdir=@udevrulesdir@
65 udevbindir=@udevbindir@
66 udevlibexecdir=$(udevbindir)
67 udevhomedir=$(udevlibexecdir)
68 systemshutdowndir=$(rootlibexecdir)/system-shutdown
69 systemsleepdir=$(rootlibexecdir)/system-sleep
70 factory_pamdir = $(datadir)/factory/etc/pam.d
71
72 # And these are the special ones for /
73 rootprefix=@rootprefix@
74 rootbindir=$(rootprefix)/bin
75 rootlibexecdir=$(rootprefix)/lib/elogind
76
77 EXTRA_DIST =
78 BUILT_SOURCES =
79 INSTALL_EXEC_HOOKS =
80 UNINSTALL_EXEC_HOOKS =
81 DISTCLEAN_LOCAL_HOOKS =
82 CLEAN_LOCAL_HOOKS =
83 pkginclude_HEADERS =
84 noinst_LTLIBRARIES =
85 lib_LTLIBRARIES =
86 noinst_DATA =
87 pkgconfiglib_DATA =
88 polkitpolicy_in_files =
89 polkitpolicy_files =
90 polkitrules_files =
91 polkitpkla_files =
92 dist_udevrules_DATA =
93 nodist_udevrules_DATA =
94 dist_pkgsysconf_DATA =
95 nodist_pkgsysconf_DATA =
96 dist_dbuspolicy_DATA =
97 dist_dbussystemservice_DATA =
98 check_PROGRAMS =
99 check_DATA =
100 dist_rootlibexec_DATA =
101 rootlib_LTLIBRARIES =
102 tests=
103 manual_tests =
104 TEST_DATA_FILES =
105 if ENABLE_TESTS
106 noinst_PROGRAMS = $(manual_tests) $(tests) $(unsafe_tests)
107 TESTS = $(tests)
108 if ENABLE_UNSAFE_TESTS
109 TESTS += \
110         $(unsafe_tests)
111 endif
112 else
113 noinst_PROGRAMS =
114 TESTS =
115 endif
116
117 if ENABLE_BASH_COMPLETION
118 dist_bashcompletion_DATA = $(dist_bashcompletion_data)
119 endif
120 if ENABLE_ZSH_COMPLETION
121 dist_zshcompletion_DATA = $(dist_zshcompletion_data)
122 endif
123
124 in_files = $(filter %.in,$(EXTRA_DIST))
125 in_in_files = $(filter %.in.in, $(in_files))
126 m4_files = $(filter %.m4,$(EXTRA_DIST) $(in_files:.m4.in=.m4))
127
128 CLEANFILES = $(BUILT_SOURCES) \
129         $(pkgconfiglib_DATA) \
130         $(in_files:.in=) $(in_in_files:.in.in=) \
131         $(m4_files:.m4=)
132
133 .PHONY: $(INSTALL_EXEC_HOOKS) $(UNINSTALL_EXEC_HOOKS) \
134         $(DISTCLEAN_LOCAL_HOOKS) $(CLEAN_LOCAL_HOOKS)
135
136 AM_CPPFLAGS = \
137         -include $(top_builddir)/config.h \
138         -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
139         -DSYSTEMD_CGROUP_CONTROLLER=\"_$(CGROUP_CONTROLLER)\" \
140         -DSYSTEMD_CGROUP_CONTROLLER_LEGACY=\"name=$(CGROUP_CONTROLLER)\" \
141         -DSYSTEMD_CGROUP_CONTROLLER_HYBRID=\"name=$(CGROUP_CONTROLLER)\" \
142         -DSYSTEMD_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
143         -DSYSTEMD_BINARY_PATH=\"$(rootlibexecdir)/elogind\" \
144         -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
145         -DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
146         -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
147         -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" \
148         -DHALT=\"$(HALT)\" \
149         -DREBOOT=\"$(REBOOT)\" \
150         -DKEXEC=\"$(KEXEC)\" \
151         -DLIBDIR=\"$(libdir)\" \
152         -DROOTLIBDIR=\"$(rootlibdir)\" \
153         -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
154         -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
155         -I $(top_srcdir)/src \
156         -I $(top_builddir)/src/basic \
157         -I $(top_srcdir)/src/basic \
158         -I $(top_srcdir)/src/core \
159         -I $(top_srcdir)/src/shared \
160         -I $(top_builddir)/src/shared \
161         -I $(top_srcdir)/src/login \
162         -I $(top_srcdir)/src/systemd \
163         -I $(top_srcdir)/src/libelogind/sd-bus \
164         -I $(top_srcdir)/src/libelogind/sd-event \
165         -I $(top_srcdir)/src/libelogind/sd-login \
166         -I $(top_srcdir)/src/libelogind/sd-id128 \
167         -I $(top_srcdir)/src/update-utmp \
168         -I $(top_srcdir)/src/sleep \
169         -DABS_SRC_DIR=\"$(abs_top_srcdir)\" \
170         -DABS_BUILD_DIR=\"$(abs_top_builddir)\" \
171         $(OUR_CPPFLAGS)
172
173 AM_CFLAGS = $(OUR_CFLAGS)
174 AM_LDFLAGS = $(OUR_LDFLAGS)
175
176 # ------------------------------------------------------------------------------
177 install-touch-usr-hook:
178         touch -c $(DESTDIR)/$(prefix)
179
180 INSTALL_EXEC_HOOKS += \
181         install-touch-usr-hook
182
183
184 # ------------------------------------------------------------------------------
185 AM_V_M4 = $(AM_V_M4_$(V))
186 AM_V_M4_ = $(AM_V_M4_$(AM_DEFAULT_VERBOSITY))
187 AM_V_M4_0 = @echo "  M4      " $@;
188
189 AM_V_XSLT = $(AM_V_XSLT_$(V))
190 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
191 AM_V_XSLT_0 = @echo "  XSLT    " $@;
192
193 AM_V_GPERF = $(AM_V_GPERF_$(V))
194 AM_V_GPERF_ = $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY))
195 AM_V_GPERF_0 = @echo "  GPERF   " $@;
196
197 AM_V_LN = $(AM_V_LN_$(V))
198 AM_V_LN_ = $(AM_V_LN_$(AM_DEFAULT_VERBOSITY))
199 AM_V_LN_0 = @echo "  LN      " $@;
200
201 AM_V_RM = $(AM_V_RM_$(V))
202 AM_V_RM_ = $(AM_V_RM_$(AM_DEFAULT_VERBOSITY))
203 AM_V_RM_0 = @echo "  RM      " $@;
204
205 # ------------------------------------------------------------------------------
206 rootbin_PROGRAMS =
207 rootlibexec_PROGRAMS = \
208         elogind \
209         elogind-cgroups-agent
210
211 pkglibexec_PROGRAMS =
212
213 dist_doc_DATA = \
214         README \
215         NEWS \
216         LICENSE.LGPL2.1 \
217         LICENSE.GPL2
218
219 @INTLTOOL_POLICY_RULE@
220
221 # ------------------------------------------------------------------------------
222
223 MANPAGES =
224 MANPAGES_ALIAS =
225
226 include Makefile-man.am
227
228 .PHONY: man update-man-list
229 man: $(MANPAGES) $(MANPAGES_ALIAS) $(HTML_FILES) $(HTML_ALIAS)
230
231 XML_FILES = \
232         ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}}
233 HTML_FILES = \
234         ${XML_FILES:.xml=.html}
235 HTML_ALIAS = \
236         ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(MANPAGES_ALIAS)}}}}}
237
238 if ENABLE_MANPAGES
239 man_MANS = \
240         $(MANPAGES) \
241         $(MANPAGES_ALIAS)
242
243 noinst_DATA += \
244         $(HTML_FILES) \
245         $(HTML_ALIAS) \
246         docs/html/man
247 endif
248
249 CLEANFILES += \
250         $(man_MANS) \
251         $(HTML_FILES) \
252         $(HTML_ALIAS) \
253         docs/html/man
254
255 docs/html/man:
256         $(AM_V_at)$(MKDIR_P) $(dir $@)
257         $(AM_V_LN)$(LN_S) -f ../../man $@
258
259 man/index.html: man/elogind.index.html
260         $(AM_V_LN)$(LN_S) -f elogind.index.html $@
261
262 if HAVE_PYTHON
263 if ENABLE_MANPAGES
264 noinst_DATA += \
265        man/index.html
266 endif
267 endif
268
269 CLEANFILES += \
270        man/index.html
271
272 XML_GLOB            := $(wildcard $(top_srcdir)/man/*.xml)
273 DIRECTIVE_FILE      := man/elogind.directives.xml
274 INDEX_XML_FILE      := man/elogind.index.xml
275 NON_INDEX_XML_FILES := $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_FILES))
276 ALL_XML_FILES       := $(INDEX_XML_FILE) $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_GLOB))
277 SOURCE_XML_FILES    := ${patsubst %,$(top_srcdir)/%,$(filter-out $(DIRECTIVE_FILE),$(NON_INDEX_XML_FILES))}
278
279 # This target should only be run manually. It recreates Makefile-man.am
280 # file in the source directory based on all man/*.xml files. Run it after
281 # adding, removing, or changing the conditional in a man page.
282 update-man-list: $(top_srcdir)/tools/make-man-rules.py $(ALL_XML_FILES) man/custom-entities.ent
283         $(AM_V_GEN)$(PYTHON) $< $(ALL_XML_FILES) > $(top_srcdir)/Makefile-man.tmp
284         $(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
285         @echo "Makefile-man.am has been regenerated"
286
287 $(INDEX_XML_FILE): $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES)
288         $(AM_V_at)$(MKDIR_P) $(dir $@)
289         $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
290
291 $(DIRECTIVE_FILE): $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES)
292         $(AM_V_at)$(MKDIR_P) $(dir $@)
293         $(AM_V_GEN)$(PYTHON) $< $@ $(SOURCE_XML_FILES)
294
295 CLEANFILES += \
296        $(INDEX_XML_FILE) \
297        $(DIRECTIVE_FILE)
298
299 EXTRA_DIST += \
300         $(filter-out $(DIRECTIVE_FILE) $(INDEX_XML_FILE),$(XML_FILES)) \
301         tools/make-man-index.py \
302         tools/make-man-rules.py \
303         tools/make-directive-index.py \
304         tools/xml_helper.py \
305         man/glib-event-glue.c
306
307 # ------------------------------------------------------------------------------
308 noinst_LTLIBRARIES += \
309         libbasic.la
310
311 libbasic_la_SOURCES = \
312         src/basic/missing.h \
313         src/basic/capability-util.c \
314         src/basic/capability-util.h \
315         src/basic/conf-files.c \
316         src/basic/conf-files.h \
317         src/basic/stdio-util.h \
318         src/basic/hostname-util.h \
319         src/basic/hostname-util.c \
320         src/basic/unit-name.c \
321         src/basic/unit-name.h \
322         src/basic/unaligned.h \
323         src/basic/util.c \
324         src/basic/util.h \
325         src/basic/io-util.c \
326         src/basic/io-util.h \
327         src/basic/string-util.c \
328         src/basic/string-util.h \
329         src/basic/parse-util.c \
330         src/basic/parse-util.h \
331         src/basic/fd-util.c \
332         src/basic/fd-util.h \
333         src/basic/user-util.c \
334         src/basic/user-util.h \
335         src/basic/dirent-util.c \
336         src/basic/dirent-util.h \
337         src/basic/xattr-util.c \
338         src/basic/xattr-util.h \
339         src/basic/proc-cmdline.c \
340         src/basic/proc-cmdline.h \
341         src/basic/fs-util.c \
342         src/basic/fs-util.h \
343         src/basic/syslog-util.c \
344         src/basic/syslog-util.h \
345         src/basic/stat-util.c \
346         src/basic/stat-util.h \
347         src/basic/mount-util.c \
348         src/basic/mount-util.h \
349         src/basic/hexdecoct.c \
350         src/basic/hexdecoct.h \
351         src/basic/extract-word.c \
352         src/basic/extract-word.h \
353         src/basic/escape.c \
354         src/basic/escape.h \
355         src/basic/path-util.c \
356         src/basic/path-util.h \
357         src/basic/parse-printf-format.c \
358         src/basic/parse-printf-format.h \
359         src/basic/time-util.c \
360         src/basic/time-util.h \
361         src/basic/locale-util.c \
362         src/basic/locale-util.h \
363         src/basic/umask-util.h \
364         src/basic/signal-util.c \
365         src/basic/signal-util.h \
366         src/basic/string-table.c \
367         src/basic/string-table.h \
368         src/basic/mempool.c \
369         src/basic/mempool.h \
370         src/basic/hashmap.c \
371         src/basic/hashmap.h \
372         src/basic/hash-funcs.c \
373         src/basic/hash-funcs.h \
374         src/basic/siphash24.c \
375         src/basic/siphash24.h \
376         src/basic/prioq.c \
377         src/basic/prioq.h \
378         src/basic/strv.c \
379         src/basic/strv.h \
380         src/basic/env-util.c \
381         src/basic/env-util.h \
382         src/basic/log.c \
383         src/basic/log.h \
384         src/basic/bus-label.c \
385         src/basic/bus-label.h \
386         src/basic/exec-util.c \
387         src/basic/exec-util.h \
388         src/basic/virt.c \
389         src/basic/virt.h \
390         src/basic/smack-util.c \
391         src/basic/smack-util.h \
392         src/basic/utf8.c \
393         src/basic/utf8.h \
394         src/basic/gunicode.c \
395         src/basic/gunicode.h \
396         src/basic/socket-util.c \
397         src/basic/socket-util.h \
398         src/basic/fileio.c \
399         src/basic/fileio.h \
400         src/basic/mkdir.c \
401         src/basic/mkdir.h \
402         src/basic/cgroup-util.c \
403         src/basic/cgroup-util.h \
404         src/basic/errno-list.c \
405         src/basic/errno-list.h \
406         src/basic/terminal-util.c \
407         src/basic/terminal-util.h \
408         src/basic/login-util.h \
409         src/basic/login-util.c \
410         src/basic/audit-util.c \
411         src/basic/audit-util.h \
412         src/basic/memfd-util.c \
413         src/basic/memfd-util.h \
414         src/basic/process-util.c \
415         src/basic/process-util.h \
416         src/basic/random-util.c \
417         src/basic/random-util.h \
418         src/basic/verbs.c \
419         src/basic/verbs.h \
420         src/basic/label.c \
421         src/basic/label.h \
422         src/basic/selinux-util.c \
423         src/basic/selinux-util.h \
424         src/basic/mkdir-label.c \
425         src/basic/fileio-label.c \
426         src/basic/fileio-label.h \
427         src/basic/rm-rf.c \
428         src/basic/rm-rf.h \
429         src/basic/copy.c \
430         src/basic/copy.h \
431         src/basic/alloc-util.h \
432         src/basic/alloc-util.c \
433         src/basic/format-util.h \
434         src/basic/khash.h \
435         src/basic/khash.c
436
437 nodist_libbasic_la_SOURCES = \
438         src/basic/errno-from-name.h \
439         src/basic/errno-to-name.h
440
441 libbasic_la_CFLAGS = \
442         $(AM_CFLAGS) \
443         $(SELINUX_CFLAGS) \
444         $(CAP_CFLAGS) \
445         -pthread
446
447 libbasic_la_LDFLAGS = \
448         $(CAP_LDFLAGS)
449
450 libbasic_la_LIBADD = \
451         $(SELINUX_LIBS) \
452         $(CAP_LIBS) \
453         -ldl \
454         -lm
455
456 # -----------------------------------------------------------------------------
457 noinst_LTLIBRARIES += \
458         libshared.la
459
460 libshared_la_SOURCES = \
461         src/shared/udev-util.h \
462         src/shared/udev-util.c \
463         src/shared/bus-util.c \
464         src/shared/bus-util.h \
465         src/shared/clean-ipc.c \
466         src/shared/clean-ipc.h \
467         src/shared/conf-parser.c \
468         src/shared/conf-parser.h \
469         src/shared/musl_missing.h \
470         src/shared/musl_missing.c \
471         src/shared/pager.c \
472         src/shared/pager.h \
473         src/shared/sleep-config.c \
474         src/shared/sleep-config.h \
475         src/shared/spawn-polkit-agent.c \
476         src/shared/spawn-polkit-agent.h \
477         src/shared/tests.h \
478         src/shared/tests.c \
479         src/shared/nsflags.h \
480         src/shared/nsflags.c
481
482 if HAVE_ACL
483 libshared_la_SOURCES += \
484         src/shared/acl-util.c \
485         src/shared/acl-util.h
486 endif
487
488 libshared_la_CFLAGS = \
489         $(AM_CFLAGS) \
490         $(ACL_CFLAGS)
491
492 libshared_la_LIBADD = \
493         libelogind-internal.la \
494         libbasic.la \
495         $(UDEV_LIBS) \
496         $(ACL_LIBS)
497
498 noinst_LTLIBRARIES += \
499         libelogind-shared.la
500
501 libelogind_shared_la_SOURCES = \
502         $(libbasic_la_SOURCES) \
503         $(libshared_la_SOURCES) \
504         $(libelogind_internal_la_SOURCES)
505
506 libelogind_shared_la_CFLAGS = \
507         $(AM_CFLAGS) \
508         $(libbasic_la_CFLAGS) \
509         $(libshared_la_CFLAGS) \
510         $(libelogind_internal_la_CFLAGS) \
511         $(libelogind_journal_internal_la_CFLAGS) \
512         $(libudev_internal_la_CFLAGS) \
513         $(ACL_CFLAGS) \
514         $(SECCOMP_CFLAGS) \
515         -fvisibility=default
516
517 # We can't use libshared_la_LIBADD here because it would
518 # pull in libelogind*-internal.la
519 libelogind_shared_la_LIBADD = \
520         $(libbasic_la_LIBADD) \
521         $(libelogind_internal_la_LIBADD) \
522         $(UDEV_LIBS) \
523         $(ACL_LIBS) \
524         $(SECCOMP_LIBS)
525
526 libelogind_shared_la_LDFLAGS = \
527         $(AM_LDFLAGS)
528  # -----------------------------------------------------------------------------
529 gperf_txt_sources = \
530         src/basic/errno-list.txt
531
532 BUILT_SOURCES += \
533         $(gperf_gperf_m4_sources:-gperf.gperf.m4=-gperf.c) \
534         $(gperf_gperf_sources:-gperf.gperf=-gperf.c) \
535         $(gperf_txt_sources:-list.txt=-from-name.h) \
536         $(gperf_txt_sources:-list.txt=-to-name.h)
537
538 CLEANFILES += \
539         $(gperf_txt_sources:-list.txt=-from-name.gperf)
540 DISTCLEANFILES = \
541         $(gperf_txt_sources)
542
543 EXTRA_DIST += \
544         $(gperf_gperf_m4_sources) \
545         $(gperf_gperf_sources)
546
547 CLEANFILES += \
548         $(gperf_txt_sources)
549
550 %-from-name.gperf: %-list.txt
551         $(AM_V_at)$(MKDIR_P) $(dir $@)
552         $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
553
554 %-from-name.h: %-from-name.gperf
555         $(AM_V_at)$(MKDIR_P) $(dir $@)
556         $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
557
558
559 src/basic/errno-list.txt:
560         $(AM_V_at)$(MKDIR_P) $(dir $@)
561         $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
562
563 src/basic/errno-to-name.h: src/basic/errno-list.txt
564         $(AM_V_at)$(MKDIR_P) $(dir $@)
565         $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
566
567 # ------------------------------------------------------------------------------
568
569 manual_tests += \
570         test-cgroup
571
572 unsafe_tests = \
573         test-ipcrm
574
575 tests += \
576         test-log \
577         test-path-util \
578         test-siphash24 \
579         test-utf8 \
580         test-ellipsize \
581         test-util \
582         test-exec-util \
583         test-hexdecoct \
584         test-escape \
585         test-alloc-util \
586         test-proc-cmdline \
587         test-io-util \
588         test-fs-util \
589         test-stat-util \
590         test-fd-util \
591         test-string-util \
592         test-extract-word \
593         test-parse-util \
594         test-user-util \
595         test-process-util \
596         test-strip-tab-ansi \
597         test-prioq \
598         test-hashmap \
599         test-set \
600         test-list \
601         test-unaligned \
602         test-conf-files \
603         test-random-util \
604         test-conf-parser \
605         test-locale-util \
606         test-copy \
607         test-verbs \
608         test-signal-util \
609         test-selinux \
610         test-sizeof
611
612 TEST_DATA_FILES += \
613         test/bus-policy/hello.conf \
614         test/bus-policy/methods.conf \
615         test/bus-policy/ownerships.conf \
616         test/bus-policy/signals.conf \
617         test/bus-policy/check-own-rules.conf \
618         test/bus-policy/many-rules.conf \
619         test/bus-policy/test.conf
620
621
622 EXTRA_DIST += \
623         src/test/test-helper.h
624
625 test_utf8_SOURCES = \
626         src/test/test-utf8.c
627
628 test_utf8_LDADD = \
629         libelogind-shared.la
630
631 test_locale_util_SOURCES = \
632         src/test/test-locale-util.c
633
634 test_locale_util_LDADD = \
635         libelogind-shared.la
636
637 test_copy_SOURCES = \
638         src/test/test-copy.c
639
640 # Link statically to ensure file is large
641 test_copy_LDADD = \
642         libshared.la
643
644 test_random_util_SOURCES = \
645         src/test/test-random-util.c
646
647 test_random_util_LDADD = \
648         libelogind-shared.la
649
650 test_util_SOURCES = \
651         src/test/test-util.c
652
653 test_util_LDADD = \
654         libelogind-shared.la
655
656 test_exec_util_SOURCES = \
657         src/test/test-exec-util.c
658
659 test_exec_util_LDADD = \
660         libelogind-shared.la
661
662 test_hexdecoct_SOURCES = \
663         src/test/test-hexdecoct.c
664
665 test_hexdecoct_LDADD = \
666         libelogind-shared.la
667
668 test_alloc_util_SOURCES = \
669         src/test/test-alloc-util.c
670
671 test_alloc_util_LDADD = \
672         libelogind-shared.la
673
674 test_io_util_SOURCES = \
675         src/test/test-io-util.c
676
677 test_io_util_LDADD = \
678         libelogind-shared.la
679
680 test_fs_util_SOURCES = \
681         src/test/test-fs-util.c
682
683 test_fs_util_LDADD = \
684         libelogind-shared.la
685
686 test_proc_cmdline_SOURCES = \
687         src/test/test-proc-cmdline.c
688
689 test_proc_cmdline_LDADD = \
690         libelogind-shared.la
691
692 test_fd_util_SOURCES = \
693         src/test/test-fd-util.c
694
695 test_fd_util_LDADD = \
696         libelogind-shared.la
697
698 test_stat_util_SOURCES = \
699         src/test/test-stat-util.c
700
701 test_stat_util_LDADD = \
702         libelogind-shared.la
703
704 test_escape_SOURCES = \
705         src/test/test-escape.c
706
707 test_escape_LDADD = \
708         libelogind-shared.la
709
710 test_string_util_SOURCES = \
711         src/test/test-string-util.c
712
713 test_string_util_LDADD = \
714         libelogind-shared.la
715
716 test_extract_word_SOURCES = \
717         src/test/test-extract-word.c
718
719 test_extract_word_LDADD = \
720         libelogind-shared.la
721
722 test_parse_util_SOURCES = \
723         src/test/test-parse-util.c
724
725 test_parse_util_LDADD = \
726         libelogind-shared.la
727
728 test_user_util_SOURCES = \
729         src/test/test-user-util.c
730
731 test_user_util_LDADD = \
732         libelogind-shared.la
733
734 test_process_util_SOURCES = \
735         src/test/test-process-util.c
736
737 test_process_util_LDADD = \
738         libelogind-shared.la
739
740 test_verbs_SOURCES = \
741         src/test/test-verbs.c
742
743 test_verbs_LDADD = \
744         libelogind-shared.la
745
746 test_signal_util_SOURCES = \
747         src/test/test-signal-util.c
748
749 test_signal_util_LDADD = \
750         libelogind-shared.la
751
752 test_selinux_SOURCES = \
753         src/test/test-selinux.c
754
755 test_selinux_LDADD = \
756         libelogind-shared.la
757
758 test_sizeof_SOURCES = \
759         src/test/test-sizeof.c
760
761 BUILT_SOURCES += \
762         src/test/test-hashmap-ordered.c
763
764 src/test/test-hashmap-ordered.c: src/test/test-hashmap-plain.c
765         $(AM_V_at)$(MKDIR_P) $(dir $@)
766         $(AM_V_GEN)$(AWK) 'BEGIN { print "/* GENERATED FILE */\n#define ORDERED" } \
767                            { if (!match($$0, "^#include"))          \
768                                  gsub(/hashmap/, "ordered_hashmap"); \
769                              gsub(/HASHMAP/, "ORDERED_HASHMAP");     \
770                              gsub(/Hashmap/, "OrderedHashmap");      \
771                              print }' <$< >$@
772
773 nodist_test_hashmap_SOURCES = \
774         src/test/test-hashmap-ordered.c
775
776 test_hashmap_SOURCES = \
777         src/test/test-hashmap.c \
778         src/test/test-hashmap-plain.c
779
780 test_hashmap_LDADD = \
781         libelogind-shared.la
782
783 test_set_SOURCES = \
784         src/test/test-set.c
785
786 test_set_LDADD = \
787         libelogind-shared.la
788
789 test_list_SOURCES = \
790         src/test/test-list.c
791
792 test_list_LDADD = \
793         libelogind-shared.la
794
795 test_unaligned_LDADD = \
796         libelogind-shared.la
797
798 test_unaligned_SOURCES = \
799         src/test/test-unaligned.c
800
801 test_prioq_SOURCES = \
802         src/test/test-prioq.c
803
804 test_prioq_LDADD = \
805         libelogind-shared.la
806
807 test_log_SOURCES = \
808         src/test/test-log.c
809
810 test_log_LDADD = \
811         libelogind-shared.la
812
813 test_ipcrm_SOURCES = \
814         src/test/test-ipcrm.c
815
816 test_ipcrm_LDADD = \
817         libelogind-shared.la
818
819 test_ellipsize_SOURCES = \
820         src/test/test-ellipsize.c
821
822 test_ellipsize_LDADD = \
823         libelogind-shared.la
824
825 test_strip_tab_ansi_SOURCES = \
826         src/test/test-strip-tab-ansi.c
827
828 test_strip_tab_ansi_LDADD = \
829         libelogind-shared.la
830
831 test_cgroup_SOURCES = \
832         src/test/test-cgroup.c
833
834 test_cgroup_LDADD = \
835         libelogind-shared.la
836
837 test_path_util_SOURCES = \
838         src/test/test-path-util.c
839
840 test_path_util_LDADD = \
841         libelogind-shared.la
842
843 test_siphash24_SOURCES = \
844         src/test/test-siphash24.c
845
846 test_siphash24_LDADD = \
847         libelogind-shared.la
848
849 test_conf_files_SOURCES = \
850         src/test/test-conf-files.c
851
852 test_conf_files_LDADD = \
853         libelogind-shared.la
854
855 test_conf_parser_SOURCES = \
856         src/test/test-conf-parser.c
857
858 test_conf_parser_LDADD = \
859         libelogind-shared.la
860
861 # ------------------------------------------------------------------------------
862 ## .PHONY so it always rebuilds it
863 .PHONY: coverage lcov-run lcov-report coverage-sync
864
865 # run lcov from scratch, always
866 coverage: all
867         $(MAKE) lcov-run
868         $(MAKE) lcov-report
869
870 coverage_dir = coverage
871 coverage_opts = --base-directory $(srcdir) --directory $(builddir) --rc 'geninfo_adjust_src_path=$(abspath $(srcdir))=>$(abspath $(builddir))'
872
873 if ENABLE_COVERAGE
874 # reset run coverage tests
875 lcov-run:
876         @rm -rf $(coverage_dir)
877         lcov $(coverage_opts) --zerocounters
878         -$(MAKE) check
879
880 # generate report based on current coverage data
881 lcov-report:
882         $(MKDIR_P) $(coverage_dir)
883         lcov $(coverage_opts) --compat-libtool --capture --no-external \
884                 | sed 's|$(abspath $(builddir))|$(abspath $(srcdir))|' > $(coverage_dir)/.lcov.info
885         lcov --remove $(coverage_dir)/.lcov.info --output-file $(coverage_dir)/.lcov-clean.info 'test-*'
886         genhtml -t "systemd test coverage" -o $(coverage_dir) $(coverage_dir)/.lcov-clean.info
887         @echo "Coverage report generated in $(abs_builddir)/$(coverage_dir)/index.html"
888
889 # lcov doesn't work properly with vpath builds, make sure that bad
890 # output is not uploaded by mistake.
891 coverage-sync: coverage
892         test "$(builddir)" = "$(srcdir)"
893         rsync -rlv --delete --omit-dir-times coverage/ $(www_target)/coverage
894
895 else
896 lcov-run lcov-report:
897         echo "Need to reconfigure with --enable-coverage"
898 endif
899
900 # ------------------------------------------------------------------------------
901
902 if HAVE_PAM
903 dist_factory_pam_DATA = \
904         factory/etc/pam.d/system-auth \
905         factory/etc/pam.d/other
906 endif
907
908 # ------------------------------------------------------------------------------
909 pkglibexec_PROGRAMS += \
910        elogind-cgroups-agent
911
912 elogind_cgroups_agent_SOURCES = \
913        src/cgroups-agent/cgroups-agent.c
914
915 elogind_cgroups_agent_LDADD = \
916        libelogind-shared.la
917
918 # ------------------------------------------------------------------------------
919 libelogind_internal_la_SOURCES = \
920         src/systemd/sd-bus.h \
921         src/systemd/sd-bus-protocol.h \
922         src/systemd/sd-bus-vtable.h \
923         src/systemd/sd-event.h \
924         src/systemd/sd-login.h \
925         src/systemd/sd-id128.h \
926         src/systemd/sd-daemon.h \
927         src/libelogind/libelogind.sym \
928         src/libelogind/sd-bus/sd-bus.c \
929         src/libelogind/sd-bus/bus-control.c \
930         src/libelogind/sd-bus/bus-control.h \
931         src/libelogind/sd-bus/bus-error.c \
932         src/libelogind/sd-bus/bus-error.h \
933         src/libelogind/sd-bus/bus-common-errors.h \
934         src/libelogind/sd-bus/bus-common-errors.c \
935         src/libelogind/sd-bus/bus-internal.c \
936         src/libelogind/sd-bus/bus-internal.h \
937         src/libelogind/sd-bus/bus-socket.c \
938         src/libelogind/sd-bus/bus-socket.h \
939         src/libelogind/sd-bus/bus-kernel.c \
940         src/libelogind/sd-bus/bus-kernel.h \
941         src/libelogind/sd-bus/bus-container.c \
942         src/libelogind/sd-bus/bus-container.h \
943         src/libelogind/sd-bus/bus-message.c \
944         src/libelogind/sd-bus/bus-message.h \
945         src/libelogind/sd-bus/bus-creds.c \
946         src/libelogind/sd-bus/bus-creds.h \
947         src/libelogind/sd-bus/bus-signature.c \
948         src/libelogind/sd-bus/bus-signature.h \
949         src/libelogind/sd-bus/bus-type.c \
950         src/libelogind/sd-bus/bus-type.h \
951         src/libelogind/sd-bus/bus-match.c \
952         src/libelogind/sd-bus/bus-match.h \
953         src/libelogind/sd-bus/bus-bloom.c \
954         src/libelogind/sd-bus/bus-bloom.h \
955         src/libelogind/sd-bus/bus-introspect.c \
956         src/libelogind/sd-bus/bus-introspect.h \
957         src/libelogind/sd-bus/bus-objects.c \
958         src/libelogind/sd-bus/bus-objects.h \
959         src/libelogind/sd-bus/bus-gvariant.c \
960         src/libelogind/sd-bus/bus-gvariant.h \
961         src/libelogind/sd-bus/bus-convenience.c \
962         src/libelogind/sd-bus/bus-track.c \
963         src/libelogind/sd-bus/bus-track.h \
964         src/libelogind/sd-bus/bus-slot.c \
965         src/libelogind/sd-bus/bus-slot.h \
966         src/libelogind/sd-bus/bus-protocol.h \
967         src/libelogind/sd-event/sd-event.c \
968         src/libelogind/sd-id128/sd-id128.c \
969         src/libelogind/sd-id128/id128-util.h \
970         src/libelogind/sd-id128/id128-util.c \
971         src/libelogind/sd-daemon/sd-daemon.c \
972         src/libelogind/sd-login/sd-login.c
973
974 noinst_LTLIBRARIES += \
975         libelogind-internal.la
976
977 EXTRA_DIST += \
978         src/libelogind/libelogind.pc.in \
979         src/libelogind/sd-bus/GVARIANT-SERIALIZATION
980
981 libelogind_la_SOURCES =
982
983 libelogind_la_LDFLAGS = \
984         $(AM_LDFLAGS) \
985         -version-info $(LIBELOGIND_CURRENT):$(LIBELOGIND_REVISION):$(LIBELOGIND_AGE) \
986         -Wl,--version-script=$(top_srcdir)/src/libelogind/libelogind.sym
987
988 libelogind_la_LIBADD = \
989         libelogind-internal.la \
990         libbasic.la
991
992 pkgconfiglib_DATA += \
993         src/libelogind/libelogind.pc
994
995 pkginclude_HEADERS += \
996         src/systemd/sd-login.h \
997         src/systemd/sd-messages.h \
998         src/systemd/sd-id128.h \
999         src/systemd/_sd-common.h
1000
1001 header-install-hook:
1002         $(MKDIR_P) $(DESTDIR)/$(pkgincludedir)
1003         cd $(DESTDIR)/$(includedir)/elogind && \
1004                 for hdr in $(notdir $(pkginclude_HEADERS)) ; do \
1005                         rm -f $$hdr ; \
1006                         $(LN_S) systemd/$$hdr $$hdr ; \
1007                 done
1008
1009 header-uninstall-hook:
1010         m -f $(DESTDIR)/$(includedir)/elogind/*.h
1011
1012 INSTALL_EXEC_HOOKS += header-install-hook
1013 UNINSTALL_EXEC_HOOKS += header-uninstall-hook
1014
1015 rootlib_LTLIBRARIES += \
1016         libelogind.la
1017
1018 tests += \
1019         test-bus-signature \
1020         test-bus-server \
1021         test-bus-match \
1022         test-bus-introspect \
1023         test-bus-vtable \
1024         test-bus-error \
1025         test-event
1026
1027 test_bus_signature_SOURCES = \
1028         src/libelogind/sd-bus/test-bus-signature.c
1029
1030 test_bus_signature_LDADD = \
1031         libelogind-shared.la
1032
1033 test_bus_server_SOURCES = \
1034         src/libelogind/sd-bus/test-bus-server.c
1035
1036 test_bus_server_LDADD = \
1037         libelogind-shared.la
1038
1039 test_bus_vtable_SOURCES = \
1040         src/libelogind/sd-bus/test-bus-vtable.c
1041
1042 test_bus_vtable_LDADD = \
1043         libelogind-shared.la
1044
1045 test_bus_error_SOURCES = \
1046         src/libelogind/sd-bus/test-bus-error.c
1047
1048 # Link statically because this test uses BUS_ERROR_MAP_ELF_REGISTER
1049 test_bus_error_LDADD = \
1050         libshared.la
1051
1052 test_bus_match_SOURCES = \
1053         src/libelogind/sd-bus/test-bus-match.c
1054
1055 test_bus_match_LDADD = \
1056         libelogind-shared.la
1057
1058 test_bus_introspect_SOURCES = \
1059         src/libelogind/sd-bus/test-bus-introspect.c
1060
1061 test_bus_introspect_LDADD = \
1062         libelogind-shared.la
1063
1064 test_event_SOURCES = \
1065         src/libelogind/sd-event/test-event.c
1066
1067 test_event_LDADD = \
1068         libelogind-shared.la
1069
1070 # ------------------------------------------------------------------------------
1071 test_id128_SOURCES = \
1072         src/test/test-id128.c
1073
1074 test_id128_LDADD = \
1075         libelogind-shared.la
1076
1077 tests += \
1078         test-id128
1079
1080 # ------------------------------------------------------------------------------
1081 test_hash_SOURCES = \
1082         src/test/test-hash.c
1083
1084 test_hash_LDADD = \
1085         libelogind-shared.la
1086
1087 tests += \
1088         test-hash
1089
1090 # ------------------------------------------------------------------------------
1091 elogind_SOURCES = \
1092         src/login/logind.c \
1093         src/login/logind.h
1094
1095 nodist_elogind_SOURCES = \
1096         src/login/logind-gperf.c
1097
1098 elogind_LDADD = \
1099         libelogind-core.la
1100
1101 libelogind_core_la_SOURCES = \
1102         src/core/cgroup.h \
1103         src/core/cgroup.c \
1104         src/core/mount-setup.h \
1105         src/core/mount-setup.c \
1106         src/login/elogind.c \
1107         src/login/elogind.h \
1108         src/login/elogind-dbus.c \
1109         src/login/elogind-dbus.h \
1110         src/login/logind-core.c \
1111         src/login/logind-device.c \
1112         src/login/logind-device.h \
1113         src/login/logind-button.c \
1114         src/login/logind-button.h \
1115         src/login/logind-action.c \
1116         src/login/logind-action.h \
1117         src/login/logind-seat.c \
1118         src/login/logind-seat.h \
1119         src/login/logind-session.c \
1120         src/login/logind-session.h \
1121         src/login/logind-session-device.c \
1122         src/login/logind-session-device.h \
1123         src/login/logind-user.c \
1124         src/login/logind-user.h \
1125         src/login/logind-inhibit.c \
1126         src/login/logind-inhibit.h \
1127         src/login/logind-dbus.c \
1128         src/login/logind-session-dbus.c \
1129         src/login/logind-seat-dbus.c \
1130         src/login/logind-user-dbus.c \
1131         src/login/logind-utmp.c \
1132         src/login/logind-acl.h \
1133         src/sleep/sleep.c \
1134         src/sleep/sleep.h
1135
1136 if HAVE_UTMP
1137 libelogind_core_la_SOURCES += \
1138         src/shared/utmp-wtmp.c \
1139         src/update-utmp/update-utmp.c
1140 endif
1141
1142 libelogind_core_la_LIBADD = \
1143         libelogind-shared.la
1144
1145 if HAVE_ACL
1146 libelogind_core_la_SOURCES += \
1147         src/login/logind-acl.c
1148 endif
1149
1150 noinst_LTLIBRARIES += \
1151         libelogind-core.la
1152
1153 pkglibexec_PROGRAMS += \
1154         elogind
1155
1156 loginctl_SOURCES = \
1157         src/login/eloginctl.c \
1158         src/login/eloginctl.h \
1159         src/login/loginctl.c \
1160         src/login/sysfs-show.h \
1161         src/login/sysfs-show.c
1162
1163 loginctl_LDADD = \
1164         libelogind-shared.la
1165
1166 rootbin_PROGRAMS += \
1167         loginctl
1168
1169 dist_bashcompletion_data = \
1170         shell-completion/bash/loginctl
1171
1172 dist_zshcompletion_data = \
1173         shell-completion/zsh/_loginctl \
1174         shell-completion/zsh/_elogind-inhibit
1175
1176 elogind_inhibit_SOURCES = \
1177         src/login/inhibit.c
1178
1179 elogind_inhibit_LDADD = \
1180         libelogind-shared.la
1181
1182 rootbin_PROGRAMS += \
1183         elogind-inhibit
1184
1185 test_login_SOURCES = \
1186         src/libelogind/sd-login/test-login.c
1187
1188 test_login_LDADD = \
1189         libelogind-shared.la
1190
1191 test_login_shared_SOURCES = \
1192         src/login/test-login-shared.c
1193
1194 test_login_shared_LDADD = \
1195         libelogind-shared.la
1196
1197 test_inhibit_SOURCES = \
1198         src/login/test-inhibit.c
1199
1200 test_inhibit_LDADD = \
1201         libelogind-shared.la
1202
1203 test_login_tables_SOURCES = \
1204         src/login/test-login-tables.c
1205
1206 test_login_tables_LDADD = \
1207         libelogind-core.la
1208
1209 manual_tests += \
1210         test-inhibit
1211
1212 tests += \
1213         test-login \
1214         test-login-tables \
1215         test-login-shared
1216
1217 if HAVE_PAM
1218 pam_elogind_la_SOURCES = \
1219         src/login/pam_elogind.sym \
1220         src/login/pam_elogind.c
1221
1222 pam_elogind_la_CFLAGS = \
1223         $(AM_CFLAGS) \
1224         $(PAM_CFLAGS)
1225
1226 pam_elogind_la_LDFLAGS = \
1227         $(AM_LDFLAGS) \
1228         -module \
1229         -export-dynamic \
1230         -avoid-version \
1231         -shared \
1232         -Wl,--version-script=$(top_srcdir)/src/login/pam_elogind.sym
1233
1234 pam_elogind_la_LIBADD = \
1235         libshared.la \
1236         $(PAM_LIBS)
1237
1238 pamlib_LTLIBRARIES = \
1239         pam_elogind.la
1240
1241 if ENABLE_PAM_CONFIG
1242 dist_pamconf_DATA = \
1243         src/login/elogind-user
1244 endif
1245
1246 EXTRA_DIST += \
1247         src/login/elogind-user.m4
1248 endif
1249
1250 dist_dbussystemservice_DATA += \
1251         src/login/org.freedesktop.login1.service
1252
1253 dist_dbuspolicy_DATA += \
1254         src/login/org.freedesktop.login1.conf
1255
1256 nodist_pkgsysconf_DATA += \
1257         src/login/logind.conf
1258
1259 polkitpolicy_files += \
1260         src/login/org.freedesktop.login1.policy
1261
1262 dist_udevrules_DATA += \
1263         src/login/70-uaccess.rules \
1264         src/login/70-power-switch.rules
1265
1266 nodist_udevrules_DATA += \
1267         src/login/71-seat.rules \
1268         src/login/73-seat-late.rules
1269
1270 polkitpolicy_in_files += \
1271         src/login/org.freedesktop.login1.policy.in
1272
1273 gperf_gperf_sources = \
1274         src/login/logind-gperf.gperf
1275
1276 EXTRA_DIST += \
1277         src/login/71-seat.rules.in \
1278         src/login/73-seat-late.rules.in \
1279         src/login/logind.conf.in
1280
1281 # ------------------------------------------------------------------------------
1282 substitutions = \
1283        '|rootlibdir=$(rootlibdir)|' \
1284        '|rootlibexecdir=$(rootlibexecdir)|' \
1285        '|rootbindir=$(rootbindir)|' \
1286        '|bindir=$(bindir)|' \
1287        '|pkgsysconfdir=$(pkgsysconfdir)|' \
1288        '|pkgdatadir=$(pkgdatadir)|' \
1289        '|udevrulesdir=$(udevrulesdir)|' \
1290        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
1291        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
1292        '|PACKAGE_URL=$(PACKAGE_URL)|' \
1293        '|prefix=$(prefix)|' \
1294        '|exec_prefix=$(exec_prefix)|' \
1295        '|libdir=$(libdir)|' \
1296        '|includedir=$(includedir)|' \
1297        '|rootprefix=$(rootprefix)|' \
1298        '|udevlibexecdir=$(udevlibexecdir)|' \
1299        '|KILL=$(KILL)|' \
1300        '|MKDIR_P=$(MKDIR_P)|' \
1301        '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \
1302        '|systemuidmax=$(SYSTEM_UID_MAX)|' \
1303        '|systemgidmax=$(SYSTEM_GID_MAX)|'
1304
1305 SED_PROCESS = \
1306         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
1307         $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
1308                 -e '/^\#\# /d' \
1309                 < $< > $@
1310
1311 man/%: man/%.in
1312         $(SED_PROCESS)
1313
1314 sysctl.d/%: sysctl.d/%.in
1315         $(SED_PROCESS)
1316
1317 %.pc: %.pc.in
1318         $(SED_PROCESS)
1319
1320 shell-completion/%: shell-completion/%.in
1321         $(SED_PROCESS)
1322
1323 %.rules: %.rules.in
1324         $(SED_PROCESS)
1325
1326 %.conf: %.conf.in
1327         $(SED_PROCESS)
1328
1329 %.sh: %.sh.in
1330         $(SED_PROCESS)
1331         $(AM_V_GEN)chmod +x $@
1332
1333 src/%.c: src/%.gperf
1334         $(AM_V_at)$(MKDIR_P) $(dir $@)
1335         $(AM_V_GPERF)$(GPERF) < $< > $@
1336
1337 src/%: src/%.m4
1338         $(AM_V_at)$(MKDIR_P) $(dir $@)
1339         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
1340
1341 sysusers.d/%: sysusers.d/%.m4
1342         $(AM_V_at)$(MKDIR_P) $(dir $@)
1343         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
1344
1345 tmpfiles.d/%: tmpfiles.d/%.m4
1346         $(AM_V_at)$(MKDIR_P) $(dir $@)
1347         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
1348
1349
1350 units/%: units/%.m4
1351         $(AM_V_at)$(MKDIR_P) $(dir $@)
1352         $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_SYSTEM=1 < $< > $@
1353
1354 units/user/%: units/user/%.m4
1355         $(AM_V_at)$(MKDIR_P) $(dir $@)
1356         $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
1357
1358 if ENABLE_POLKIT
1359 nodist_polkitpolicy_DATA = \
1360         $(polkitpolicy_files)
1361 polkitrules_DATA = $(polkitrules_files)
1362 if ENABLE_POLKIT_PKLA
1363 polkitpkla_DATA = $(polkitpkla_files)
1364 endif
1365 endif
1366
1367 EXTRA_DIST += \
1368         $(polkitpolicy_in_files)
1369
1370 # ------------------------------------------------------------------------------
1371 if ENABLE_MANPAGES
1372 man/custom-entities.ent: configure.ac
1373         $(AM_V_GEN)$(MKDIR_P) $(dir $@)
1374         $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
1375          printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
1376          > $@ # '
1377
1378 CLEANFILES += \
1379         man/custom-entities.ent
1380
1381 XSLTPROC_FLAGS = \
1382         --nonet \
1383         --xinclude \
1384         --stringparam man.output.quietly 1 \
1385         --stringparam funcsynopsis.style ansi \
1386         --stringparam man.authors.section.enabled 0 \
1387         --stringparam man.copyright.section.enabled 0 \
1388         --stringparam elogind.version $(PACKAGE_VERSION) \
1389         --path '$(builddir)/man:$(srcdir)/man'
1390
1391 XSLTPROC_PROCESS_MAN = \
1392         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
1393
1394 XSLTPROC_PROCESS_HTML = \
1395         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
1396
1397 man/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
1398         $(XSLTPROC_PROCESS_MAN)
1399
1400 man/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
1401         $(XSLTPROC_PROCESS_MAN)
1402
1403 man/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
1404         $(XSLTPROC_PROCESS_MAN)
1405
1406 man/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
1407         $(XSLTPROC_PROCESS_MAN)
1408
1409 man/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
1410         $(XSLTPROC_PROCESS_MAN)
1411
1412 man/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
1413         $(XSLTPROC_PROCESS_HTML)
1414
1415 define html-alias
1416         $(AM_V_LN)$(LN_S) -f $(notdir $<) $@
1417 endef
1418
1419 endif
1420
1421 EXTRA_DIST += \
1422         man/custom-html.xsl \
1423         man/custom-man.xsl
1424
1425 install-exec-hook: $(INSTALL_EXEC_HOOKS)
1426
1427 uninstall-hook: $(UNINSTALL_EXEC_HOOKS)
1428
1429 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
1430
1431 clean-local: $(CLEAN_LOCAL_HOOKS)
1432         rm -rf $(abs_srcdir)/install-tree
1433         rm -f $(abs_srcdir)/hwdb/usb.ids $(abs_srcdir)/hwdb/pci.ids $(abs_srcdir)/hwdb/oui.txt \
1434               $(abs_srcdir)/hwdb/iab.txt
1435
1436 DISTCHECK_CONFIGURE_FLAGS = \
1437         --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \
1438         --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \
1439         --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
1440         --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \
1441         --with-pamlibdir=$$dc_install_base/$(pamlibdir) \
1442         --with-pamconfdir=$$dc_install_base/$(pamconfdir) \
1443         --with-rootprefix=$$dc_install_base
1444
1445 if ENABLE_SPLIT_USR
1446 DISTCHECK_CONFIGURE_FLAGS += \
1447         --enable-split-usr
1448 else
1449 DISTCHECK_CONFIGURE_FLAGS += \
1450         --disable-split-usr
1451 endif
1452
1453 .PHONY: dist-check-help
1454 dist-check-help: $(rootbin_PROGRAMS)
1455         for i in $(abspath $^); do                                             \
1456             if $$i  --help | grep -v 'default:' | grep -E -q '.{80}.' ; then   \
1457                 echo "$(basename $$i) --help output is too wide:";             \
1458                 $$i  --help | awk 'length > 80' | grep -E --color=yes '.{80}'; \
1459                 exit 1;                                                        \
1460             fi; done
1461
1462 include_compilers = "$(CC)" "$(CC) -ansi" "$(CC) -std=iso9899:1990"
1463 public_headers = $(filter-out src/systemd/_sd-common.h, $(pkginclude_HEADERS) $(include_HEADERS))
1464 .PHONY: dist-check-includes
1465 dist-check-includes: $(public_headers)
1466         @res=0;                                                                 \
1467         for i in $(abspath $^); do                                              \
1468             for cc in $(include_compilers); do                                  \
1469                 echo "$$cc -o/dev/null -c -x c -include "$$i" - </dev/null";    \
1470                 $$cc -o/dev/null -c -x c -include "$$i" - </dev/null || res=1;  \
1471             done;                                                               \
1472         done; exit $$res
1473
1474 dist:
1475
1476 .PHONY: git-tag
1477 git-tag:
1478         git tag -s "v$(PACKAGE_VERSION)" -m "elogind $(PACKAGE_VERSION)"
1479
1480 .PHONY: git-tar
1481 git-tar:
1482         $(AM_V_at)git archive --format=tar --prefix=elogind-$(PACKAGE_VERSION)-raw/ HEAD | \
1483                 (cd /var/tmp/ && tar xf -)
1484         $(AM_V_GEN)(cd /var/tmp &&                                              \
1485                 rm -rf elogind-$(PACKAGE_VERSION) &&                            \
1486                 $(MKDIR_P) elogind-$(PACKAGE_VERSION) &&                        \
1487          for f in `find elogind-$(PACKAGE_VERSION)-raw/ -type f |               \
1488                         cut -d '/' -f 2-` ; do                                  \
1489                 $(MKDIR_P) elogind-$(PACKAGE_VERSION)/`dirname $$f` ;           \
1490                 $(AWK) 'BEGIN                    { i=0;e=0      }               \
1491                         /^#if\s+0.*elogind.*$$/  { i=1;next     }               \
1492                         /^#else\s*$$/            {                              \
1493                             { if ( i==1 ) e=1; else print }{next}               \
1494                         }                                                       \
1495                         /^#endif\s*\/\/\s*0\s*$$/ {                             \
1496                             { if ( i==1 ) { i=0;e=0 } else print }{next}        \
1497                         }                                                       \
1498                         /^\s*\/\/\/.*elogind.*$$/{ next         }               \
1499                         /^\s*\/\/\s*#include.+$$/{ next         }               \
1500                         { if ( (i==0) || (e==1) ) print         }'              \
1501                           elogind-$(PACKAGE_VERSION)-raw/$$f                    \
1502                         > elogind-$(PACKAGE_VERSION)/$$f ;                      \
1503                         chmod `stat -c '%a' elogind-$(PACKAGE_VERSION)-raw/$$f` \
1504                                             elogind-$(PACKAGE_VERSION)/$$f ;    \
1505          done ;                                                                 \
1506          for l in `find elogind-$(PACKAGE_VERSION)-raw/ -type l |               \
1507                         cut -d '/' -f 2-` ; do                                  \
1508                 $(MKDIR_P) elogind-$(PACKAGE_VERSION)/`dirname $$l` ;           \
1509                 cp -P elogind-$(PACKAGE_VERSION)-raw/$$l                        \
1510                         elogind-$(PACKAGE_VERSION)/$$l ;                        \
1511          done ;                                                                 \
1512          tar czf elogind-$(PACKAGE_VERSION).tar.gz elogind-$(PACKAGE_VERSION) ; \
1513          rm -rf elogind-$(PACKAGE_VERSION) elogind-$(PACKAGE_VERSION)-raw) ;    \
1514         $(AM_V_at)mv /var/tmp/elogind-$(PACKAGE_VERSION).tar.gz ./
1515
1516 .PHONY: install-tree
1517 install-tree: all
1518         rm -rf $(abs_srcdir)/install-tree
1519         $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
1520         tree $(abs_srcdir)/install-tree
1521
1522 # Let's run all tests of the test suite, but under valgrind. Let's
1523 # exclude perl/python/shell scripts we have in there
1524 .PHONY: valgrind-tests
1525 valgrind-tests: $(TESTS)
1526         $(AM_V_GEN)for f in $(filter-out %.pl %.py, $^); do \
1527                 if $(LIBTOOL) --mode=execute file $$f | grep -q shell; then \
1528                 echo -e "$${x}Skipping non-binary $$f"; else \
1529                 echo -e "$${x}Running $$f"; \
1530                 $(AM_TESTS_ENVIRONMENT) $(LIBTOOL) --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
1531                 x="\n\n"; \
1532         done
1533
1534 exported-%: %
1535         $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@
1536
1537 exported: $(addprefix exported-, $(rootlib_LTLIBRARIES))
1538         $(AM_V_GEN)cat $^ > $@
1539
1540 .PHONY: check-api-docs
1541 check-api-docs: exported man
1542         $(AM_V_GEN)for symbol in `cat exported` ; do \
1543                 if test -f $(builddir)/man/$$symbol.html ; then \
1544                         echo "  Symbol $$symbol() is documented." ; \
1545                 else \
1546                         echo "‣ Symbol $$symbol() lacks documentation." ; \
1547                 fi ; \
1548         done
1549
1550 OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
1551 ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
1552
1553 undefined defined: $(ALL_OBJECTS)
1554         $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \
1555                 $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \
1556         done | cut -c 20- | cut -d @ -f 1 | sort -u > $@
1557
1558 CLEANFILES += \
1559         defined \
1560         undefined
1561
1562 .PHONY: check-api-unused
1563 check-api-unused: defined undefined exported
1564         ( cat exported undefined ) | sort -u  | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
1565
1566 .PHONY: check-includes
1567 check-includes: $(top_srcdir)/tools/check-includes.pl
1568         $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \
1569                 | xargs $(top_srcdir)/tools/check-includes.pl
1570
1571 EXTRA_DIST += \
1572         $(top_srcdir)/tools/check-includes.pl
1573
1574 # Stupid test that everything purported to be exported really is
1575 define generate-sym-test
1576         $(AM_V_at)$(MKDIR_P) $(dir $@)
1577         $(AM_V_at)printf '#include <stdio.h>\n' > $@
1578         $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@
1579         $(AM_V_at)printf 'void* functions[] = {\n' >> $@
1580         $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@
1581         $(AM_V_at)printf '};\nint main(void) {\n' >> $@
1582         $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@
1583         $(AM_V_at)printf 'return 0; }\n' >> $@
1584 endef
1585
1586 test-libelogind-sym.c: \
1587                 $(top_builddir)/src/libelogind/libelogind.sym \
1588                 src/systemd/sd-daemon.h \
1589                 src/systemd/sd-login.h \
1590                 src/systemd/sd-bus.h \
1591                 src/systemd/sd-event.h
1592         $(generate-sym-test)
1593
1594 test_libelogind_sym_SOURCES = \
1595         test-libelogind-sym.c
1596 test_libelogind_sym_LDADD = \
1597         libelogind.la
1598
1599 BUILT_SOURCES += \
1600         $(test_libelogind_sym_SOURCES)
1601
1602 tests += \
1603         test-libelogind-sym
1604
1605 .PHONY: install-tests
1606 install-tests: $(tests) $(TEST_DATA_FILES)
1607         for f in $(tests); do \
1608             if [ -x $(top_builddir)/.libs/$$f ]; then \
1609                 install -D -m 755 $(top_builddir)/.libs/$$f $(DESTDIR)/$(testsdir)/$$f; \
1610             else \
1611                 install -D -m 755 $(top_builddir)/$$f $(DESTDIR)/$(testsdir)/$$f; \
1612             fi; \
1613         done
1614         for f in $(TEST_DATA_FILES); do \
1615             install -D -m 644 $(top_srcdir)/$$f $(DESTDIR)/$(testsdir)/testdata/$${f#test/}; \
1616         done
1617
1618 .PHONY: cccc cppcheck
1619 cccc: all
1620         cccc --outdir=$(top_builddir)/cccc \
1621         `find $(top_srcdir)/src/ -name '*.h' -or -name '*.c'`
1622
1623 cppcheck:
1624         cppcheck --enable=all -q \
1625         -I $(top_srcdir)/src \
1626         -I $(top_builddir)/src/basic \
1627         -I $(top_srcdir)/src/basic \
1628         -I $(top_srcdir)/src/core \
1629         -I $(top_srcdir)/src/shared \
1630         -I $(top_builddir)/src/shared \
1631         -I $(top_srcdir)/src/login \
1632         -I $(top_srcdir)/src/systemd \
1633         -I $(top_srcdir)/src/libelogind/sd-bus \
1634         -I $(top_srcdir)/src/libelogind/sd-event \
1635         -I $(top_srcdir)/src/libelogind/sd-login \
1636         -I $(top_srcdir)/src/libelogind/sd-id128 \
1637         -I $(top_srcdir)/src/update-utmp \
1638         -I $(top_srcdir)/src/sleep \
1639         --force \
1640         $(top_srcdir)
1641
1642 # Used to extract compile flags for YCM.
1643 print-%:
1644         @echo $($*)
1645
1646 git-contrib:
1647         @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | sed 's/ / /g' | awk '{ print $$0 "," }' | sort -u
1648
1649 EXTRA_DIST += \
1650         tools/gdb-sd_dump_hashmaps.py
1651
1652 list-keys:
1653         gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys
1654
1655 add-key:
1656         gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import -