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