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