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