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