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