chiark / gitweb /
d6e1bd856f260fdbfa4831c205d6b03c18031c89
[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=16
42 LIBELOGIND_REVISION=2
43 LIBELOGIND_AGE=16
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 bashcompletiondir=@bashcompletiondir@
54 zshcompletiondir=@zshcompletiondir@
55
56 CGROUP_CONTROLLER=@cgroup_controller@
57 PKTTYAGENT=$(bindir)/pkttyagent
58
59 # Our own, non-special dirs
60 pkgsysconfdir=$(sysconfdir)/elogind
61 pkgincludedir=$(includedir)/elogind/systemd
62 udevrulesdir=@udevrulesdir@
63 udevbindir=@udevbindir@
64 udevlibexecdir=$(udevbindir)
65 udevhomedir=$(udevlibexecdir)
66 systemshutdowndir=$(rootlibexecdir)/system-shutdown
67 systemsleepdir=$(rootlibexecdir)/system-sleep
68 factory_pamdir = $(datadir)/factory/etc/pam.d
69
70 # And these are the special ones for /
71 rootprefix=@rootprefix@
72 rootbindir=$(rootprefix)/bin
73 rootlibexecdir=$(rootprefix)/lib/elogind
74
75 EXTRA_DIST =
76 BUILT_SOURCES =
77 INSTALL_EXEC_HOOKS =
78 UNINSTALL_EXEC_HOOKS =
79 INSTALL_DATA_HOOKS =
80 UNINSTALL_DATA_HOOKS =
81 DISTCLEAN_LOCAL_HOOKS =
82 CLEAN_LOCAL_HOOKS =
83 pkginclude_HEADERS =
84 noinst_LTLIBRARIES =
85 lib_LTLIBRARIES =
86 rootlibexec_LTLIBRARIES =
87 noinst_DATA =
88 pkgconfiglib_DATA =
89 polkitpolicy_in_files =
90 polkitpolicy_files =
91 dist_udevrules_DATA =
92 nodist_udevrules_DATA =
93 dist_pkgsysconf_DATA =
94 nodist_pkgsysconf_DATA =
95 dist_dbuspolicy_DATA =
96 dist_dbussystemservice_DATA =
97 check_PROGRAMS =
98 check_DATA =
99 dist_rootlibexec_DATA =
100 tests=
101 manual_tests =
102 if ENABLE_TESTS
103 noinst_PROGRAMS = $(manual_tests) $(tests)
104 TESTS = $(tests)
105 else
106 noinst_PROGRAMS =
107 TESTS =
108 endif
109
110 if ENABLE_BASH_COMPLETION
111 dist_bashcompletion_DATA = $(dist_bashcompletion_data)
112 endif
113 if ENABLE_ZSH_COMPLETION
114 dist_zshcompletion_DATA = $(dist_zshcompletion_data)
115 endif
116
117 in_files = $(filter %.in,$(EXTRA_DIST))
118 in_in_files = $(filter %.in.in, $(in_files))
119 m4_files = $(filter %.m4,$(EXTRA_DIST) $(in_files:.m4.in=.m4))
120
121 CLEANFILES = $(BUILT_SOURCES) \
122         $(pkgconfiglib_DATA) \
123         $(in_files:.in=) $(in_in_files:.in.in=) \
124         $(m4_files:.m4=)
125
126 .PHONY: $(INSTALL_EXEC_HOOKS) $(UNINSTALL_EXEC_HOOKS) \
127         $(INSTALL_DATA_HOOKS) $(UNINSTALL_DATA_HOOKS) \
128         $(DISTCLEAN_LOCAL_HOOKS) $(CLEAN_LOCAL_HOOKS)
129
130 AM_CPPFLAGS = \
131         -include $(top_builddir)/config.h \
132         -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
133         -DSYSTEMD_CGROUP_CONTROLLER=\"$(CGROUP_CONTROLLER)\" \
134         -DSYSTEMD_CGROUP_AGENT_PATH=\"$(rootlibexecdir)/elogind-cgroups-agent\" \
135         -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \
136         -DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
137         -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
138         -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" \
139         -DHALT=\"$(HALT)\" \
140         -DREBOOT=\"$(REBOOT)\" \
141         -DKEXEC=\"$(KEXEC)\" \
142         -DLIBDIR=\"$(libdir)\" \
143         -DROOTLIBDIR=\"$(rootlibdir)\" \
144         -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \
145         -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
146         -I $(top_srcdir)/src \
147         -I $(top_builddir)/src/basic \
148         -I $(top_srcdir)/src/basic \
149         -I $(top_srcdir)/src/core \
150         -I $(top_srcdir)/src/shared \
151         -I $(top_builddir)/src/shared \
152         -I $(top_srcdir)/src/login \
153         -I $(top_srcdir)/src/systemd \
154         -I $(top_srcdir)/src/libelogind/sd-bus \
155         -I $(top_srcdir)/src/libelogind/sd-event \
156         -I $(top_srcdir)/src/libelogind/sd-login \
157         -I $(top_srcdir)/src/libelogind/sd-id128 \
158         -I $(top_srcdir)/src/update-utmp \
159         -I $(top_srcdir)/src/sleep \
160         $(OUR_CPPFLAGS)
161
162 AM_CFLAGS = $(OUR_CFLAGS)
163 AM_LDFLAGS = $(OUR_LDFLAGS)
164
165 # ------------------------------------------------------------------------------
166 define move-to-rootlibdir
167         if test "$(libdir)" != "$(rootlibdir)"; then \
168                 $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \
169                 so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \
170                 rm -f $(DESTDIR)$(libdir)/$$libname && \
171                 $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \
172                 mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \
173         fi
174 endef
175
176 install-touch-usr-hook:
177         touch -c $(DESTDIR)/$(prefix)
178
179 INSTALL_EXEC_HOOKS += \
180         install-touch-usr-hook
181
182
183 # ------------------------------------------------------------------------------
184 AM_V_M4 = $(AM_V_M4_$(V))
185 AM_V_M4_ = $(AM_V_M4_$(AM_DEFAULT_VERBOSITY))
186 AM_V_M4_0 = @echo "  M4      " $@;
187
188 AM_V_XSLT = $(AM_V_XSLT_$(V))
189 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
190 AM_V_XSLT_0 = @echo "  XSLT    " $@;
191
192 AM_V_GPERF = $(AM_V_GPERF_$(V))
193 AM_V_GPERF_ = $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY))
194 AM_V_GPERF_0 = @echo "  GPERF   " $@;
195
196 AM_V_LN = $(AM_V_LN_$(V))
197 AM_V_LN_ = $(AM_V_LN_$(AM_DEFAULT_VERBOSITY))
198 AM_V_LN_0 = @echo "  LN      " $@;
199
200 AM_V_RM = $(AM_V_RM_$(V))
201 AM_V_RM_ = $(AM_V_RM_$(AM_DEFAULT_VERBOSITY))
202 AM_V_RM_0 = @echo "  RM      " $@;
203
204 # ------------------------------------------------------------------------------
205 rootbin_PROGRAMS =
206 pkglibexec_PROGRAMS =
207
208 dist_doc_DATA = \
209         README \
210         NEWS \
211         LICENSE.LGPL2.1 \
212         LICENSE.GPL2
213
214 @INTLTOOL_POLICY_RULE@
215
216 # ------------------------------------------------------------------------------
217
218 MANPAGES =
219 MANPAGES_ALIAS =
220
221 include Makefile-man.am
222
223 .PHONY: man update-man-list
224 man: $(MANPAGES) $(MANPAGES_ALIAS) $(HTML_FILES) $(HTML_ALIAS)
225
226 XML_FILES = \
227         ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}}
228 HTML_FILES = \
229         ${XML_FILES:.xml=.html}
230 HTML_ALIAS = \
231         ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(MANPAGES_ALIAS)}}}}}
232
233 if ENABLE_MANPAGES
234 man_MANS = \
235         $(MANPAGES) \
236         $(MANPAGES_ALIAS)
237
238 noinst_DATA += \
239         $(HTML_FILES) \
240         $(HTML_ALIAS) \
241         docs/html/man
242 endif
243
244 CLEANFILES += \
245         $(man_MANS) \
246         $(HTML_FILES) \
247         $(HTML_ALIAS) \
248         docs/html/man
249
250 docs/html/man:
251         $(AM_V_at)$(MKDIR_P) $(dir $@)
252         $(AM_V_LN)$(LN_S) -f ../../man $@
253
254 man/index.html: man/elogind.index.html
255         $(AM_V_LN)$(LN_S) -f elogind.index.html $@
256
257 if HAVE_PYTHON
258 noinst_DATA += \
259        man/index.html
260 endif
261
262 CLEANFILES += \
263        man/index.html
264
265 XML_GLOB            := $(wildcard $(top_srcdir)/man/*.xml)
266 DIRECTIVE_FILE      := man/elogind.directives.xml
267 INDEX_XML_FILE      := man/elogind.index.xml
268 NON_INDEX_XML_FILES := $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_FILES))
269 ALL_XML_FILES       := $(INDEX_XML_FILE) $(DIRECTIVE_FILE) $(filter-out $(INDEX_XML_FILE) $(DIRECTIVE_FILE),$(XML_GLOB))
270 SOURCE_XML_FILES    := ${patsubst %,$(top_srcdir)/%,$(filter-out $(DIRECTIVE_FILE),$(NON_INDEX_XML_FILES))}
271
272 # This target should only be run manually. It recreates Makefile-man.am
273 # file in the source directory based on all man/*.xml files. Run it after
274 # adding, removing, or changing the conditional in a man page.
275 update-man-list: $(top_srcdir)/tools/make-man-rules.py $(ALL_XML_FILES) man/custom-entities.ent
276         $(AM_V_GEN)$(PYTHON) $< $(ALL_XML_FILES) > $(top_srcdir)/Makefile-man.tmp
277         $(AM_V_at)mv $(top_srcdir)/Makefile-man.tmp $(top_srcdir)/Makefile-man.am
278         @echo "Makefile-man.am has been regenerated"
279
280 $(INDEX_XML_FILE): $(top_srcdir)/tools/make-man-index.py $(NON_INDEX_XML_FILES)
281         $(AM_V_at)$(MKDIR_P) $(dir $@)
282         $(AM_V_GEN)$(PYTHON) $< $@ $(filter-out $<,$^)
283
284 $(DIRECTIVE_FILE): $(top_srcdir)/tools/make-directive-index.py man/custom-entities.ent $(SOURCE_XML_FILES)
285         $(AM_V_at)$(MKDIR_P) $(dir $@)
286         $(AM_V_GEN)$(PYTHON) $< $@ $(SOURCE_XML_FILES)
287
288 CLEANFILES += \
289        $(INDEX_XML_FILE) \
290        $(DIRECTIVE_FILE)
291
292 EXTRA_DIST += \
293         $(filter-out $(DIRECTIVE_FILE) $(INDEX_XML_FILE),$(XML_FILES)) \
294         tools/make-man-index.py \
295         tools/make-man-rules.py \
296         tools/make-directive-index.py \
297         tools/xml_helper.py \
298         man/glib-event-glue.c
299
300 # ------------------------------------------------------------------------------
301 noinst_LTLIBRARIES += \
302         libbasic.la
303
304 libbasic_la_SOURCES = \
305         src/basic/missing.h \
306         src/basic/capability-util.c \
307         src/basic/capability-util.h \
308         src/basic/conf-files.c \
309         src/basic/conf-files.h \
310         src/basic/stdio-util.h \
311         src/basic/hostname-util.h \
312         src/basic/hostname-util.c \
313         src/basic/unit-name.c \
314         src/basic/unit-name.h \
315         src/basic/unaligned.h \
316         src/basic/util.c \
317         src/basic/util.h \
318         src/basic/io-util.c \
319         src/basic/io-util.h \
320         src/basic/string-util.c \
321         src/basic/string-util.h \
322         src/basic/parse-util.c \
323         src/basic/parse-util.h \
324         src/basic/fd-util.c \
325         src/basic/fd-util.h \
326         src/basic/user-util.c \
327         src/basic/user-util.h \
328         src/basic/dirent-util.c \
329         src/basic/dirent-util.h \
330         src/basic/xattr-util.c \
331         src/basic/xattr-util.h \
332         src/basic/proc-cmdline.c \
333         src/basic/proc-cmdline.h \
334         src/basic/fs-util.c \
335         src/basic/fs-util.h \
336         src/basic/syslog-util.c \
337         src/basic/syslog-util.h \
338         src/basic/stat-util.c \
339         src/basic/stat-util.h \
340         src/basic/mount-util.c \
341         src/basic/mount-util.h \
342         src/basic/hexdecoct.c \
343         src/basic/hexdecoct.h \
344         src/basic/extract-word.c \
345         src/basic/extract-word.h \
346         src/basic/escape.c \
347         src/basic/escape.h \
348         src/basic/path-util.c \
349         src/basic/path-util.h \
350         src/basic/parse-printf-format.c \
351         src/basic/parse-printf-format.h \
352         src/basic/time-util.c \
353         src/basic/time-util.h \
354         src/basic/locale-util.c \
355         src/basic/locale-util.h \
356         src/basic/umask-util.h \
357         src/basic/signal-util.c \
358         src/basic/signal-util.h \
359         src/basic/string-table.c \
360         src/basic/string-table.h \
361         src/basic/mempool.c \
362         src/basic/mempool.h \
363         src/basic/hashmap.c \
364         src/basic/hashmap.h \
365         src/basic/hash-funcs.c \
366         src/basic/hash-funcs.h \
367         src/basic/siphash24.c \
368         src/basic/siphash24.h \
369         src/basic/prioq.c \
370         src/basic/prioq.h \
371         src/basic/strv.c \
372         src/basic/strv.h \
373         src/basic/log.c \
374         src/basic/log.h \
375         src/basic/bus-label.c \
376         src/basic/bus-label.h \
377         src/basic/virt.c \
378         src/basic/virt.h \
379         src/basic/smack-util.c \
380         src/basic/smack-util.h \
381         src/basic/utf8.c \
382         src/basic/utf8.h \
383         src/basic/gunicode.c \
384         src/basic/gunicode.h \
385         src/basic/socket-util.c \
386         src/basic/socket-util.h \
387         src/basic/fileio.c \
388         src/basic/fileio.h \
389         src/basic/mkdir.c \
390         src/basic/mkdir.h \
391         src/basic/cgroup-util.c \
392         src/basic/cgroup-util.h \
393         src/basic/errno-list.c \
394         src/basic/errno-list.h \
395         src/basic/terminal-util.c \
396         src/basic/terminal-util.h \
397         src/basic/login-util.h \
398         src/basic/login-util.c \
399         src/basic/audit-util.c \
400         src/basic/audit-util.h \
401         src/basic/memfd-util.c \
402         src/basic/memfd-util.h \
403         src/basic/process-util.c \
404         src/basic/process-util.h \
405         src/basic/random-util.c \
406         src/basic/random-util.h \
407         src/basic/verbs.c \
408         src/basic/verbs.h \
409         src/basic/label.c \
410         src/basic/label.h \
411         src/basic/selinux-util.c \
412         src/basic/selinux-util.h \
413         src/basic/mkdir-label.c \
414         src/basic/fileio-label.c \
415         src/basic/fileio-label.h \
416         src/basic/rm-rf.c \
417         src/basic/rm-rf.h \
418         src/basic/copy.c \
419         src/basic/copy.h \
420         src/basic/alloc-util.h \
421         src/basic/alloc-util.c
422
423 nodist_libbasic_la_SOURCES = \
424         src/basic/errno-from-name.h \
425         src/basic/errno-to-name.h
426
427 libbasic_la_CFLAGS = \
428         $(AM_CFLAGS) \
429         $(SELINUX_CFLAGS) \
430         $(CAP_CFLAGS) \
431         -pthread
432
433 libbasic_la_LDFLAGS = \
434         $(CAP_LDFLAGS)
435
436 libbasic_la_LIBADD = \
437         $(SELINUX_LIBS) \
438         $(CAP_LIBS) \
439         -ldl \
440         -lm
441
442 # -----------------------------------------------------------------------------
443 noinst_LTLIBRARIES += \
444         libshared.la
445
446 libshared_la_SOURCES = \
447         src/shared/bus-util.c \
448         src/shared/bus-util.h \
449         src/shared/clean-ipc.c \
450         src/shared/clean-ipc.h \
451         src/shared/conf-parser.c \
452         src/shared/conf-parser.h \
453         src/shared/musl_missing.h \
454         src/shared/musl_missing.c \
455         src/shared/pager.c \
456         src/shared/pager.h \
457         src/shared/sleep-config.c \
458         src/shared/sleep-config.h \
459         src/shared/spawn-polkit-agent.c \
460         src/shared/spawn-polkit-agent.h
461
462 if HAVE_ACL
463 libshared_la_SOURCES += \
464         src/shared/acl-util.c \
465         src/shared/acl-util.h
466 endif
467
468 libshared_la_CFLAGS = \
469         $(AM_CFLAGS) \
470         $(ACL_CFLAGS)
471
472 libshared_la_LIBADD = \
473         libelogind-internal.la \
474         libbasic.la \
475         $(UDEV_LIBS) \
476         $(ACL_LIBS)
477
478 rootlibexec_LTLIBRARIES += \
479         libelogind-shared.la
480
481 libelogind_shared_la_SOURCES = \
482         $(libbasic_la_SOURCES) \
483         $(libshared_la_SOURCES) \
484         $(libelogind_internal_la_SOURCES) \
485         $(libelogind_journal_internal_la_SOURCES) \
486         $(libudev_internal_la_SOURCES)
487
488 libelogind_shared_la_CFLAGS = \
489         $(AM_CFLAGS) \
490         $(libbasic_la_CFLAGS) \
491         $(libshared_la_CFLAGS) \
492         $(libelogind_internal_la_CFLAGS) \
493         $(libelogind_journal_internal_la_CFLAGS) \
494         $(libudev_internal_la_CFLAGS) \
495         $(ACL_CFLAGS) \
496         $(LIBIDN_CFLAGS) \
497         $(SECCOMP_CFLAGS) \
498         -fvisibility=default
499
500 # We can't use libshared_la_LIBADD here because it would
501 # pull in libelogind*-internal.la
502 libelogind_shared_la_LIBADD = \
503         $(libbasic_la_LIBADD) \
504         $(libelogind_internal_la_LIBADD) \
505         $(UDEV_LIBS) \
506         $(ACL_LIBS) \
507         $(LIBIDN_LIBS) \
508         $(SECCOMP_LIBS)
509
510 libelogind_shared_la_LDFLAGS = \
511         $(AM_LDFLAGS) \
512         -release $(PACKAGE_VERSION)
513
514  # -----------------------------------------------------------------------------
515 gperf_txt_sources = \
516         src/basic/errno-list.txt
517
518 BUILT_SOURCES += \
519         $(gperf_gperf_m4_sources:-gperf.gperf.m4=-gperf.c) \
520         $(gperf_gperf_sources:-gperf.gperf=-gperf.c) \
521         $(gperf_txt_sources:-list.txt=-from-name.h) \
522         $(gperf_txt_sources:-list.txt=-to-name.h)
523
524 CLEANFILES += \
525         $(gperf_txt_sources:-list.txt=-from-name.gperf)
526 DISTCLEANFILES = \
527         $(gperf_txt_sources)
528
529 EXTRA_DIST += \
530         $(gperf_gperf_m4_sources) \
531         $(gperf_gperf_sources)
532
533 CLEANFILES += \
534         $(gperf_txt_sources)
535
536 %-from-name.gperf: %-list.txt
537         $(AM_V_at)$(MKDIR_P) $(dir $@)
538         $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
539
540 %-from-name.h: %-from-name.gperf
541         $(AM_V_at)$(MKDIR_P) $(dir $@)
542         $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
543
544
545 src/basic/errno-list.txt:
546         $(AM_V_at)$(MKDIR_P) $(dir $@)
547         $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
548
549 src/basic/errno-to-name.h: src/basic/errno-list.txt
550         $(AM_V_at)$(MKDIR_P) $(dir $@)
551         $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
552
553
554 # ------------------------------------------------------------------------------
555
556 if HAVE_PAM
557 dist_factory_pam_DATA = \
558         factory/etc/pam.d/system-auth \
559         factory/etc/pam.d/other
560 endif
561
562 # ------------------------------------------------------------------------------
563 pkglibexec_PROGRAMS += \
564        elogind-cgroups-agent
565
566 elogind_cgroups_agent_SOURCES = \
567        src/cgroups-agent/cgroups-agent.c
568
569 elogind_cgroups_agent_LDADD = \
570        libelogind-shared.la
571
572 # ------------------------------------------------------------------------------
573 libelogind_internal_la_SOURCES = \
574         src/systemd/sd-bus.h \
575         src/systemd/sd-bus-protocol.h \
576         src/systemd/sd-bus-vtable.h \
577         src/systemd/sd-event.h \
578         src/systemd/sd-login.h \
579         src/systemd/sd-id128.h \
580         src/systemd/sd-daemon.h \
581         src/libelogind/libelogind.sym \
582         src/libelogind/sd-bus/sd-bus.c \
583         src/libelogind/sd-bus/bus-control.c \
584         src/libelogind/sd-bus/bus-control.h \
585         src/libelogind/sd-bus/bus-error.c \
586         src/libelogind/sd-bus/bus-error.h \
587         src/libelogind/sd-bus/bus-common-errors.h \
588         src/libelogind/sd-bus/bus-common-errors.c \
589         src/libelogind/sd-bus/bus-internal.c \
590         src/libelogind/sd-bus/bus-internal.h \
591         src/libelogind/sd-bus/bus-socket.c \
592         src/libelogind/sd-bus/bus-socket.h \
593         src/libelogind/sd-bus/bus-kernel.c \
594         src/libelogind/sd-bus/bus-kernel.h \
595         src/libelogind/sd-bus/bus-container.c \
596         src/libelogind/sd-bus/bus-container.h \
597         src/libelogind/sd-bus/bus-message.c \
598         src/libelogind/sd-bus/bus-message.h \
599         src/libelogind/sd-bus/bus-creds.c \
600         src/libelogind/sd-bus/bus-creds.h \
601         src/libelogind/sd-bus/bus-signature.c \
602         src/libelogind/sd-bus/bus-signature.h \
603         src/libelogind/sd-bus/bus-type.c \
604         src/libelogind/sd-bus/bus-type.h \
605         src/libelogind/sd-bus/bus-match.c \
606         src/libelogind/sd-bus/bus-match.h \
607         src/libelogind/sd-bus/bus-bloom.c \
608         src/libelogind/sd-bus/bus-bloom.h \
609         src/libelogind/sd-bus/bus-introspect.c \
610         src/libelogind/sd-bus/bus-introspect.h \
611         src/libelogind/sd-bus/bus-objects.c \
612         src/libelogind/sd-bus/bus-objects.h \
613         src/libelogind/sd-bus/bus-gvariant.c \
614         src/libelogind/sd-bus/bus-gvariant.h \
615         src/libelogind/sd-bus/bus-convenience.c \
616         src/libelogind/sd-bus/bus-track.c \
617         src/libelogind/sd-bus/bus-track.h \
618         src/libelogind/sd-bus/bus-slot.c \
619         src/libelogind/sd-bus/bus-slot.h \
620         src/libelogind/sd-bus/bus-protocol.h \
621         src/libelogind/sd-event/sd-event.c \
622         src/libelogind/sd-id128/sd-id128.c \
623         src/libelogind/sd-id128/id128-util.h \
624         src/libelogind/sd-id128/id128-util.c \
625         src/libelogind/sd-daemon/sd-daemon.c \
626         src/libelogind/sd-login/sd-login.c
627
628 libelogind_internal_la_LIBADD = \
629         -lresolv
630
631 noinst_LTLIBRARIES += \
632         libelogind-internal.la
633
634 EXTRA_DIST += \
635         src/libelogind/libelogind.pc.in \
636         src/libelogind/sd-bus/DIFFERENCES \
637         src/libelogind/sd-bus/GVARIANT-SERIALIZATION
638
639 libelogind_la_SOURCES =
640
641 libelogind_la_LDFLAGS = \
642         $(AM_LDFLAGS) \
643         -version-info $(LIBELOGIND_CURRENT):$(LIBELOGIND_REVISION):$(LIBELOGIND_AGE) \
644         -Wl,--version-script=$(top_srcdir)/src/libelogind/libelogind.sym
645
646 libelogind_la_LIBADD = \
647         libelogind-internal.la \
648         libbasic.la
649
650 libelogind-install-hook:
651         libname=libelogind.so && $(move-to-rootlibdir)
652
653 libelogind-uninstall-hook:
654         rm -f $(DESTDIR)$(rootlibdir)/libelogind.so*
655
656 INSTALL_EXEC_HOOKS += libelogind-install-hook
657 UNINSTALL_EXEC_HOOKS += libelogind-uninstall-hook
658
659 pkgconfiglib_DATA += \
660         src/libelogind/libelogind.pc
661
662 pkginclude_HEADERS += \
663         src/systemd/sd-login.h \
664         src/systemd/sd-messages.h \
665         src/systemd/sd-id128.h \
666         src/systemd/_sd-common.h
667
668 header-install-hook:
669         $(MKDIR_P) $(DESTDIR)/$(pkgincludedir)
670         cd $(DESTDIR)/$(includedir)/elogind && \
671                 for hdr in $(notdir $(pkginclude_HEADERS)) ; do \
672                         rm -f $$hdr ; \
673                         $(LN_S) systemd/$$hdr $$hdr ; \
674                 done
675
676 header-uninstall-hook:
677         m -f $(DESTDIR)/$(includedir)/elogind/*.h
678
679 INSTALL_EXEC_HOOKS += header-install-hook
680 UNINSTALL_EXEC_HOOKS += header-uninstall-hook
681
682 lib_LTLIBRARIES += \
683         libelogind.la
684
685 # ------------------------------------------------------------------------------
686 elogind_SOURCES = \
687         src/login/logind.c \
688         src/login/logind.h
689
690 nodist_elogind_SOURCES = \
691         src/login/logind-gperf.c
692
693 elogind_LDADD = \
694         libelogind-core.la
695
696 libelogind_core_la_SOURCES = \
697         src/core/cgroup.h \
698         src/core/cgroup.c \
699         src/core/mount-setup.h \
700         src/core/mount-setup.c \
701         src/login/elogind.c \
702         src/login/elogind.h \
703         src/login/elogind-action.c \
704         src/login/elogind-action.h \
705         src/login/logind-core.c \
706         src/login/logind-device.c \
707         src/login/logind-device.h \
708         src/login/logind-button.c \
709         src/login/logind-button.h \
710         src/login/logind-action.c \
711         src/login/logind-action.h \
712         src/login/logind-seat.c \
713         src/login/logind-seat.h \
714         src/login/logind-session.c \
715         src/login/logind-session.h \
716         src/login/logind-session-device.c \
717         src/login/logind-session-device.h \
718         src/login/logind-user.c \
719         src/login/logind-user.h \
720         src/login/logind-inhibit.c \
721         src/login/logind-inhibit.h \
722         src/login/logind-dbus.c \
723         src/login/logind-session-dbus.c \
724         src/login/logind-seat-dbus.c \
725         src/login/logind-user-dbus.c \
726         src/login/logind-utmp.c \
727         src/login/logind-acl.h \
728         src/sleep/sleep.c \
729         src/sleep/sleep.h
730
731 if HAVE_UTMP
732 libelogind_core_la_SOURCES += \
733         src/shared/utmp-wtmp.c \
734         src/update-utmp/update-utmp.c
735 endif
736
737 libelogind_core_la_LIBADD = \
738         libelogind-shared.la
739
740 if HAVE_ACL
741 libelogind_core_la_SOURCES += \
742         src/login/logind-acl.c
743 endif
744
745 noinst_LTLIBRARIES += \
746         libelogind-core.la
747
748 pkglibexec_PROGRAMS += \
749         elogind
750
751 loginctl_SOURCES = \
752         src/login/eloginctl.c \
753         src/login/eloginctl.h \
754         src/login/loginctl.c \
755         src/login/sysfs-show.h \
756         src/login/sysfs-show.c
757
758 loginctl_LDADD = \
759         libelogind-shared.la
760
761 rootbin_PROGRAMS += \
762         loginctl
763
764 dist_bashcompletion_data = \
765         shell-completion/bash/loginctl
766
767 dist_zshcompletion_data = \
768         shell-completion/zsh/_loginctl \
769         shell-completion/zsh/_elogind-inhibit
770
771 elogind_inhibit_SOURCES = \
772         src/login/inhibit.c
773
774 elogind_inhibit_LDADD = \
775         libelogind-shared.la
776
777 rootbin_PROGRAMS += \
778         elogind-inhibit
779
780 test_login_SOURCES = \
781         src/libelogind/sd-login/test-login.c
782
783 test_login_LDADD = \
784         libelogind-shared.la
785
786 test_login_shared_SOURCES = \
787         src/login/test-login-shared.c
788
789 test_login_shared_LDADD = \
790         libelogind-shared.la
791
792 test_inhibit_SOURCES = \
793         src/login/test-inhibit.c
794
795 test_inhibit_LDADD = \
796         libelogind-shared.la
797
798 test_login_tables_SOURCES = \
799         src/login/test-login-tables.c
800
801 test_login_tables_LDADD = \
802         libelogind-core.la
803
804 manual_tests += \
805         test-login \
806         test-inhibit
807
808 tests += \
809         test-login-tables \
810         test-login-shared
811
812 if HAVE_PAM
813 pam_elogind_la_SOURCES = \
814         src/login/pam_elogind.sym \
815         src/login/pam_elogind.c
816
817 pam_elogind_la_CFLAGS = \
818         $(AM_CFLAGS) \
819         $(PAM_CFLAGS)
820
821 pam_elogind_la_LDFLAGS = \
822         $(AM_LDFLAGS) \
823         -module \
824         -export-dynamic \
825         -avoid-version \
826         -shared \
827         -Wl,--version-script=$(top_srcdir)/src/login/pam_elogind.sym
828
829 pam_elogind_la_LIBADD = \
830         libelogind-shared.la \
831         $(PAM_LIBS)
832
833 pamlib_LTLIBRARIES = \
834         pam_elogind.la
835
836 dist_pamconf_DATA = \
837         src/login/elogind-user
838
839 EXTRA_DIST += \
840         src/login/elogind-user.m4
841 endif
842
843 dist_dbussystemservice_DATA += \
844         src/login/org.freedesktop.login1.service
845
846 dist_dbuspolicy_DATA += \
847         src/login/org.freedesktop.login1.conf
848
849 nodist_pkgsysconf_DATA += \
850         src/login/logind.conf
851
852 polkitpolicy_files += \
853         src/login/org.freedesktop.login1.policy
854
855 dist_udevrules_DATA += \
856         src/login/70-uaccess.rules \
857         src/login/70-power-switch.rules
858
859 nodist_udevrules_DATA += \
860         src/login/71-seat.rules \
861         src/login/73-seat-late.rules
862
863 polkitpolicy_in_files += \
864         src/login/org.freedesktop.login1.policy.in
865
866 gperf_gperf_sources = \
867         src/login/logind-gperf.gperf
868
869 EXTRA_DIST += \
870         src/login/71-seat.rules.in \
871         src/login/73-seat-late.rules.in \
872         src/login/logind.conf.in
873
874 # ------------------------------------------------------------------------------
875 substitutions = \
876        '|rootlibexecdir=$(rootlibexecdir)|' \
877        '|rootbindir=$(rootbindir)|' \
878        '|bindir=$(bindir)|' \
879        '|pkgsysconfdir=$(pkgsysconfdir)|' \
880        '|pkgdatadir=$(pkgdatadir)|' \
881        '|udevrulesdir=$(udevrulesdir)|' \
882        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
883        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
884        '|PACKAGE_URL=$(PACKAGE_URL)|' \
885        '|prefix=$(prefix)|' \
886        '|exec_prefix=$(exec_prefix)|' \
887        '|libdir=$(libdir)|' \
888        '|includedir=$(includedir)|' \
889        '|VERSION=$(VERSION)|' \
890        '|rootprefix=$(rootprefix)|' \
891        '|udevlibexecdir=$(udevlibexecdir)|' \
892        '|KILL=$(KILL)|' \
893        '|MKDIR_P=$(MKDIR_P)|' \
894        '|KILL_USER_PROCESSES=$(KILL_USER_PROCESSES)|' \
895        '|systemuidmax=$(SYSTEM_UID_MAX)|' \
896        '|systemgidmax=$(SYSTEM_GID_MAX)|' \
897        '|TTY_GID=$(TTY_GID)|'
898
899 SED_PROCESS = \
900         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
901         $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
902                 < $< > $@
903
904 man/%: man/%.in
905         $(SED_PROCESS)
906
907 sysctl.d/%: sysctl.d/%.in
908         $(SED_PROCESS)
909
910 %.pc: %.pc.in
911         $(SED_PROCESS)
912
913 shell-completion/%: shell-completion/%.in
914         $(SED_PROCESS)
915
916 %.rules: %.rules.in
917         $(SED_PROCESS)
918
919 %.conf: %.conf.in
920         $(SED_PROCESS)
921
922 %.sh: %.sh.in
923         $(SED_PROCESS)
924         $(AM_V_GEN)chmod +x $@
925
926 src/%.c: src/%.gperf
927         $(AM_V_at)$(MKDIR_P) $(dir $@)
928         $(AM_V_GPERF)$(GPERF) < $< > $@
929
930 src/%: src/%.m4
931         $(AM_V_at)$(MKDIR_P) $(dir $@)
932         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
933
934 sysusers.d/%: sysusers.d/%.m4
935         $(AM_V_at)$(MKDIR_P) $(dir $@)
936         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
937
938 tmpfiles.d/%: tmpfiles.d/%.m4
939         $(AM_V_at)$(MKDIR_P) $(dir $@)
940         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
941
942
943 units/%: units/%.m4
944         $(AM_V_at)$(MKDIR_P) $(dir $@)
945         $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_SYSTEM=1 < $< > $@
946
947 units/user/%: units/user/%.m4
948         $(AM_V_at)$(MKDIR_P) $(dir $@)
949         $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
950
951 if ENABLE_POLKIT
952 nodist_polkitpolicy_DATA = \
953         $(polkitpolicy_files)
954 endif
955
956 EXTRA_DIST += \
957         $(polkitpolicy_in_files)
958
959 # ------------------------------------------------------------------------------
960 if ENABLE_MANPAGES
961 man/custom-entities.ent: configure.ac
962         $(AM_V_GEN)$(MKDIR_P) $(dir $@)
963         $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
964          printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
965          > $@ # '
966
967 CLEANFILES += \
968         man/custom-entities.ent
969
970 XSLTPROC_FLAGS = \
971         --nonet \
972         --xinclude \
973         --stringparam man.output.quietly 1 \
974         --stringparam funcsynopsis.style ansi \
975         --stringparam man.authors.section.enabled 0 \
976         --stringparam man.copyright.section.enabled 0 \
977         --stringparam elogind.version $(VERSION) \
978         --path '$(builddir)/man:$(srcdir)/man'
979
980 XSLTPROC_PROCESS_MAN = \
981         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
982
983 XSLTPROC_PROCESS_HTML = \
984         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
985
986 man/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
987         $(XSLTPROC_PROCESS_MAN)
988
989 man/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
990         $(XSLTPROC_PROCESS_MAN)
991
992 man/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
993         $(XSLTPROC_PROCESS_MAN)
994
995 man/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
996         $(XSLTPROC_PROCESS_MAN)
997
998 man/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
999         $(XSLTPROC_PROCESS_MAN)
1000
1001 man/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
1002         $(XSLTPROC_PROCESS_HTML)
1003
1004 define html-alias
1005         $(AM_V_LN)$(LN_S) -f $(notdir $<) $@
1006 endef
1007
1008 endif
1009
1010 EXTRA_DIST += \
1011         man/custom-html.xsl \
1012         man/custom-man.xsl
1013
1014 install-exec-hook: $(INSTALL_EXEC_HOOKS)
1015
1016 uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
1017
1018 install-data-hook: $(INSTALL_DATA_HOOKS)
1019
1020 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
1021
1022 clean-local: $(CLEAN_LOCAL_HOOKS)
1023         rm -rf $(abs_srcdir)/install-tree
1024         rm -f $(abs_srcdir)/hwdb/usb.ids $(abs_srcdir)/hwdb/pci.ids $(abs_srcdir)/hwdb/oui.txt \
1025               $(abs_srcdir)/hwdb/iab.txt
1026
1027 DISTCHECK_CONFIGURE_FLAGS = \
1028         --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \
1029         --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \
1030         --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
1031         --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \
1032         --with-pamlibdir=$$dc_install_base/$(pamlibdir) \
1033         --with-pamconfdir=$$dc_install_base/$(pamconfdir) \
1034         --with-rootprefix=$$dc_install_base
1035
1036 if ENABLE_SPLIT_USR
1037 DISTCHECK_CONFIGURE_FLAGS += \
1038         --enable-split-usr
1039 else
1040 DISTCHECK_CONFIGURE_FLAGS += \
1041         --disable-split-usr
1042 endif
1043
1044 .PHONY: dist-check-help
1045 dist-check-help: $(rootbin_PROGRAMS)
1046         for i in $(abspath $^); do                                             \
1047             if $$i  --help | grep -v 'default:' | grep -E -q '.{80}.' ; then   \
1048                 echo "$(basename $$i) --help output is too wide:";             \
1049                 $$i  --help | awk 'length > 80' | grep -E --color=yes '.{80}'; \
1050                 exit 1;                                                        \
1051             fi; done
1052
1053 include_compilers = "$(CC)" "$(CC) -ansi" "$(CC) -std=iso9899:1990"
1054 public_headers = $(filter-out src/systemd/_sd-common.h, $(pkginclude_HEADERS) $(include_HEADERS))
1055 .PHONY: dist-check-includes
1056 dist-check-includes: $(public_headers)
1057         @res=0;                                                                 \
1058         for i in $(abspath $^); do                                              \
1059             for cc in $(include_compilers); do                                  \
1060                 echo "$$cc -o/dev/null -c -x c -include "$$i" - </dev/null";    \
1061                 $$cc -o/dev/null -c -x c -include "$$i" - </dev/null || res=1;  \
1062             done;                                                               \
1063         done; exit $$res
1064
1065 dist:
1066
1067 .PHONY: git-tag
1068 git-tag:
1069         git tag -s "v$(VERSION)" -m "elogind $(VERSION)"
1070
1071 .PHONY: git-tar
1072 git-tar:
1073         $(AM_V_at)git archive --format=tar --prefix=elogind-$(VERSION)-raw/ HEAD | \
1074                 (cd /var/tmp/ && tar xf -)
1075         $(AM_V_GEN)(cd /var/tmp && rm -rf elogind-$(VERSION) && $(MKDIR_P) elogind-$(VERSION) && \
1076          for f in `find elogind-$(VERSION)-raw/ -type f | cut -d '/' -f 2-` ; do \
1077                 $(MKDIR_P) elogind-$(VERSION)/`dirname $$f` ;            \
1078                 $(AWK) 'BEGIN                    { i=0;e=0      }        \
1079                         /^#if\s+0.*elogind.*$$/  { i=1;next     }        \
1080                         /^#else\s*$$/            {                       \
1081                             { if ( i==1 ) e=1; else print }{next}        \
1082                         }                                                \
1083                         /^#endif\s*\/\/\s*0\s*$$/ {                      \
1084                             { if ( i==1 ) { i=0;e=0 } else print }{next} \
1085                         }                                                \
1086                         /^\s*\/\/\/.*elogind.*$$/{ next         }        \
1087                         /^\s*\/\/\s*#include.+$$/{ next         }        \
1088                         { if ( (i==0) || (e==1) ) print         }'       \
1089                           elogind-$(VERSION)-raw/$$f                     \
1090                         > elogind-$(VERSION)/$$f ;                       \
1091                         chmod `stat -c '%a' elogind-$(VERSION)-raw/$$f`  \
1092                                             elogind-$(VERSION)/$$f ;     \
1093          done ; \
1094          for l in `find elogind-$(VERSION)-raw/ -type l | cut -d '/' -f 2-` ; do \
1095                 $(MKDIR_P) elogind-$(VERSION)/`dirname $$l` ; \
1096                 cp -P elogind-$(VERSION)-raw/$$l elogind-$(VERSION)/$$l ; \
1097          done ; \
1098          tar czf elogind-$(VERSION).tar.gz elogind-$(VERSION) ; \
1099          rm -rf elogind-$(VERSION) elogind-$(VERSION)-raw) ; \
1100         $(AM_V_at)mv /var/tmp/elogind-$(VERSION).tar.gz ./
1101
1102 .PHONY: install-tree
1103 install-tree: all
1104         rm -rf $(abs_srcdir)/install-tree
1105         $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
1106         tree $(abs_srcdir)/install-tree
1107
1108 # Let's run all tests of the test suite, but under valgrind. Let's
1109 # exclude the one perl script we have in there
1110 .PHONY: valgrind-tests
1111 valgrind-tests: $(TESTS)
1112         $(AM_V_GEN)for f in $(filter-out %.pl, $^); do \
1113                 if $(LIBTOOL) --mode=execute file $$f | grep -q shell; then \
1114                 echo -e "$${x}Skipping non-binary $$f"; else \
1115                 echo -e "$${x}Running $$f"; \
1116                 libtool --mode=execute valgrind -q --leak-check=full --max-stackframe=5242880 --error-exitcode=55 $(builddir)/$$f ; fi; \
1117                 x="\n\n"; \
1118         done
1119
1120 exported-%: %
1121         $(AM_V_GEN)$(NM) -g --defined-only $(builddir)/.libs/$(<:.la=.so) 2>&1 /dev/null | grep " T " | cut -d" " -f3 > $@
1122
1123 exported: $(addprefix exported-, $(lib_LTLIBRARIES))
1124         $(AM_V_GEN)cat $^ > $@
1125
1126 .PHONY: check-api-docs
1127 check-api-docs: exported man
1128         $(AM_V_GEN)for symbol in `cat exported` ; do \
1129                 if test -f $(builddir)/man/$$symbol.html ; then \
1130                         echo "  Symbol $$symbol() is documented." ; \
1131                 else \
1132                         echo "‣ Symbol $$symbol() lacks documentation." ; \
1133                 fi ; \
1134         done
1135
1136 OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES))
1137 ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v)))
1138
1139 undefined defined: $(ALL_OBJECTS)
1140         $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \
1141                 $(NM) -g --$@-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \
1142         done | cut -c 20- | cut -d @ -f 1 | sort -u > $@
1143
1144 CLEANFILES += \
1145         defined \
1146         undefined
1147
1148 .PHONY: check-api-unused
1149 check-api-unused: defined undefined exported
1150         ( cat exported undefined ) | sort -u  | diff -u - defined | grep ^+ | grep -v ^+++ | cut -c2-
1151
1152 .PHONY: check-includes
1153 check-includes: $(top_srcdir)/tools/check-includes.pl
1154         $(AM_V_GEN) find * -name '*.[hcS]' -type f -print | sort -u \
1155                 | xargs $(top_srcdir)/tools/check-includes.pl
1156
1157 EXTRA_DIST += \
1158         $(top_srcdir)/tools/check-includes.pl
1159
1160 # Stupid test that everything purported to be exported really is
1161 define generate-sym-test
1162         $(AM_V_at)$(MKDIR_P) $(dir $@)
1163         $(AM_V_at)printf '#include <stdio.h>\n' > $@
1164         $(AM_V_at)printf '#include "%s"\n' $(notdir $(filter %.h, $^)) >> $@
1165         $(AM_V_at)printf 'void* functions[] = {\n' >> $@
1166         $(AM_V_GEN)sed -r -n 's/^ +([a-zA-Z0-9_]+);/\1,/p' $< >> $@
1167         $(AM_V_at)printf '};\nint main(void) {\n' >> $@
1168         $(AM_V_at)printf 'unsigned i; for (i=0;i<sizeof(functions)/sizeof(void*);i++) printf("%%p\\n", functions[i]);\n' >> $@
1169         $(AM_V_at)printf 'return 0; }\n' >> $@
1170 endef
1171
1172 test-libelogind-sym.c: \
1173                 $(top_builddir)/src/libelogind/libelogind.sym \
1174                 src/systemd/sd-daemon.h \
1175                 src/systemd/sd-login.h \
1176                 src/systemd/sd-bus.h \
1177                 src/systemd/sd-event.h
1178         $(generate-sym-test)
1179
1180 test_libelogind_sym_SOURCES = \
1181         test-libelogind-sym.c
1182 test_libelogind_sym_LDADD = \
1183         libelogind.la
1184
1185 BUILT_SOURCES += \
1186         $(test_libelogind_sym_SOURCES)
1187
1188 tests += \
1189         test-libelogind-sym
1190
1191 .PHONY: cppcheck
1192 cppcheck:
1193         cppcheck --enable=all -q $(top_srcdir)
1194
1195 # Used to extract compile flags for YCM.
1196 print-%:
1197         @echo $($*)
1198
1199 git-contrib:
1200         @git shortlog -s `git describe --abbrev=0`.. | cut -c8- | awk '{ print $$0 "," }' | sort -u
1201
1202 EXTRA_DIST += \
1203         tools/gdb-sd_dump_hashmaps.py
1204
1205 list-keys:
1206         gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --list-keys
1207
1208 add-key:
1209         gpg --verbose --no-options --no-default-keyring --no-auto-key-locate --batch --trust-model=always --keyring=$(srcdir)/src/import/import-pubring.gpg --import -