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