chiark / gitweb /
logind: cast close() call to (void)
[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=6
42 LIBELOGIND_REVISION=0
43 LIBELOGIND_AGE=6
44
45 # Dirs of external packages
46 dbuspolicydir=@dbuspolicydir@
47 dbussessionservicedir=@dbussessionservicedir@
48 dbussystemservicedir=@dbussystemservicedir@
49 pamlibdir=@pamlibdir@
50 pamconfdir=@pamconfdir@
51 pkgconfiglibdir=$(libdir)/pkgconfig
52 polkitpolicydir=$(datadir)/polkit-1/actions
53 bashcompletiondir=@bashcompletiondir@
54 zshcompletiondir=@zshcompletiondir@
55 varlogdir=$(localstatedir)/log
56 elogindstatedir=$(localstatedir)/lib/elogind
57 systemsleepdir=$(pkglibexecdir)/sleep.d
58 systemshutdowndir=$(pkglibexecdir)/shutdown.d
59
60 udevrulesdir=@udevrulesdir@
61 udevbindir=@udevbindir@
62
63 PKTTYAGENT=$(bindir)/pkttyagent
64
65 # Our own, non-special dirs
66 pkgsysconfdir=$(sysconfdir)/elogind
67 pkgincludedir=$(includedir)/elogind
68 factory_etcdir = $(prefix)/share/factory/etc
69 factory_pamdir = $(prefix)/share/factory/etc/pam.d
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 include_HEADERS =
83 noinst_DATA =
84 pkgconfiglib_DATA =
85 polkitpolicy_in_in_files =
86 polkitpolicy_in_files =
87 polkitpolicy_files =
88 dist_pkgsysconf_DATA =
89 nodist_pkgsysconf_DATA =
90 dist_pkgdata_DATA =
91 dist_dbuspolicy_DATA =
92 dist_dbussystemservice_DATA =
93 check_PROGRAMS =
94 check_DATA =
95 tests=
96 manual_tests =
97 TEST_EXTENSIONS = .py
98 PY_LOG_COMPILER = $(PYTHON)
99 if ENABLE_TESTS
100 noinst_PROGRAMS = $(manual_tests) $(tests)
101 TESTS = $(tests)
102 else
103 noinst_PROGRAMS =
104 TESTS =
105 endif
106
107 in_files = $(filter %.in,$(EXTRA_DIST))
108 in_in_files = $(filter %.in.in, $(in_files))
109 m4_files = $(filter %.m4,$(EXTRA_DIST) $(in_files:.m4.in=.m4))
110
111 CLEANFILES = $(BUILT_SOURCES) \
112         $(pkgconfiglib_DATA) \
113         $(in_files:.in=) $(in_in_files:.in.in=) \
114         $(m4_files:.m4=)
115
116 .PHONY: $(INSTALL_EXEC_HOOKS) $(UNINSTALL_EXEC_HOOKS) \
117         $(INSTALL_DATA_HOOKS) $(UNINSTALL_DATA_HOOKS) \
118         $(DISTCLEAN_LOCAL_HOOKS) $(CLEAN_LOCAL_HOOKS)
119
120 AM_CPPFLAGS = \
121         -include $(top_builddir)/config.h \
122         -DPKGSYSCONFDIR=\"$(pkgsysconfdir)\" \
123         -DPOLKIT_AGENT_BINARY_PATH=\"$(PKTTYAGENT)\" \
124         -DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \
125         -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" \
126         -DSYSTEMD_CGROUP_AGENT_PATH=\"$(pkglibexecdir)/logind-cgroups-agent\" \
127         -DUSER_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/user\" \
128         -DUSER_DATA_UNIT_PATH=\"$(userunitdir)\" \
129         -DROOTPREFIX=\"$(rootprefix)\" \
130         -DSYSTEM_SLEEP_PATH=\"$(systemsleepdir)\" \
131         -DSYSTEM_SHUTDOWN_PATH=\"$(systemshutdowndir)\" \
132         -DHALT=\"$(HALT)\" \
133         -DREBOOT=\"$(REBOOT)\" \
134         -DKEXEC=\"$(KEXEC)\" \
135         -DLIBDIR=\"$(libdir)\" \
136         -DTEST_DIR=\"$(abs_top_srcdir)/test\" \
137         -I $(top_srcdir)/src \
138         -I $(top_builddir)/src/shared \
139         -I $(top_srcdir)/src/shared \
140         -I $(top_srcdir)/src/login \
141         -I $(top_srcdir)/src/systemd \
142         -I $(top_srcdir)/src/libelogind/sd-bus \
143         -I $(top_srcdir)/src/libelogind/sd-event \
144         -I $(top_srcdir)/src/libelogind/sd-device \
145         $(UDEV_CFLAGS) \
146         $(OUR_CPPFLAGS)
147
148 AM_CFLAGS = $(OUR_CFLAGS)
149 AM_LDFLAGS = $(OUR_LDFLAGS)
150
151 # ------------------------------------------------------------------------------
152 SHUTDOWN_TARGET_WANTS =
153 LOCAL_FS_TARGET_WANTS =
154 MULTI_USER_TARGET_WANTS =
155 GRAPHICAL_TARGET_WANTS =
156 RESCUE_TARGET_WANTS =
157 SYSINIT_TARGET_WANTS =
158 SOCKETS_TARGET_WANTS =
159 BUSNAMES_TARGET_WANTS =
160 TIMERS_TARGET_WANTS =
161 USER_SOCKETS_TARGET_WANTS =
162 USER_DEFAULT_TARGET_WANTS =
163 USER_BUSNAMES_TARGET_WANTS =
164
165 SYSTEM_UNIT_ALIASES =
166 USER_UNIT_ALIASES =
167 GENERAL_ALIASES =
168
169 install-target-wants-hook:
170         what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && dir=$(systemunitdir) && $(add-wants)
171         what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && dir=$(systemunitdir) && $(add-wants)
172         what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && dir=$(systemunitdir) && $(add-wants)
173         what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && dir=$(systemunitdir) && $(add-wants)
174         what="$(RESCUE_TARGET_WANTS)" && wants=rescue.target && dir=$(systemunitdir) && $(add-wants)
175         what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && dir=$(systemunitdir) && $(add-wants)
176         what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(systemunitdir) && $(add-wants)
177         what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && dir=$(systemunitdir) && $(add-wants)
178         what="$(SLICES_TARGET_WANTS)" && wants=slices.target && dir=$(systemunitdir) && $(add-wants)
179         what="$(USER_SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(userunitdir) && $(add-wants)
180         what="$(USER_DEFAULT_TARGET_WANTS)" && wants=default.target && dir=$(userunitdir) && $(add-wants)
181
182 install-busnames-target-wants-hook:
183         what="$(BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(systemunitdir) && $(add-wants)
184         what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
185
186 define add-wants
187         [ -z "$$what" ] || ( \
188           dir=$(DESTDIR)$$dir/$$wants.wants && \
189           $(MKDIR_P) -m 0755 $$dir && \
190           cd $$dir && \
191           rm -f $$what && \
192           for i in $$what; do $(LN_S) ../$$i . || exit $$? ; done )
193 endef
194
195 install-aliases-hook:
196         set -- $(GENERAL_ALIASES) && \
197                 dir= && $(install-relative-aliases)
198
199 define install-aliases
200         while [ -n "$$1" ]; do \
201                 $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
202                 rm -f $(DESTDIR)$$dir/$$2 && \
203                 $(LN_S) $$1 $(DESTDIR)$$dir/$$2 && \
204                 shift 2 || exit $$?; \
205         done
206 endef
207
208 define install-relative-aliases
209         while [ -n "$$1" ]; do \
210                 $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \
211                 rm -f $(DESTDIR)$$dir/$$2 && \
212                 $(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \
213                 shift 2 || exit $$?; \
214         done
215 endef
216
217 install-touch-usr-hook:
218         touch -c $(DESTDIR)/$(prefix)
219
220 INSTALL_EXEC_HOOKS += \
221         install-target-wants-hook \
222         install-aliases-hook \
223         install-touch-usr-hook
224
225 if ENABLE_KDBUS
226 INSTALL_EXEC_HOOKS += \
227         install-busnames-target-wants-hook
228 endif
229
230 # ------------------------------------------------------------------------------
231 AM_V_M4 = $(AM_V_M4_$(V))
232 AM_V_M4_ = $(AM_V_M4_$(AM_DEFAULT_VERBOSITY))
233 AM_V_M4_0 = @echo "  M4      " $@;
234
235 AM_V_XSLT = $(AM_V_XSLT_$(V))
236 AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
237 AM_V_XSLT_0 = @echo "  XSLT    " $@;
238
239 AM_V_GPERF = $(AM_V_GPERF_$(V))
240 AM_V_GPERF_ = $(AM_V_GPERF_$(AM_DEFAULT_VERBOSITY))
241 AM_V_GPERF_0 = @echo "  GPERF   " $@;
242
243 AM_V_LN = $(AM_V_LN_$(V))
244 AM_V_LN_ = $(AM_V_LN_$(AM_DEFAULT_VERBOSITY))
245 AM_V_LN_0 = @echo "  LN      " $@;
246
247 AM_V_RM = $(AM_V_RM_$(V))
248 AM_V_RM_ = $(AM_V_RM_$(AM_DEFAULT_VERBOSITY))
249 AM_V_RM_0 = @echo "  RM      " $@;
250
251 # ------------------------------------------------------------------------------
252 bin_PROGRAMS =
253 pkglibexec_PROGRAMS =
254 dist_bashcompletion_DATA =
255 dist_zshcompletion_DATA =
256
257 dist_doc_DATA = \
258         README \
259         NEWS \
260         LICENSE.LGPL2.1 \
261         LICENSE.GPL2 \
262         LICENSE.MIT \
263         src/libelogind/sd-bus/PORTING-DBUS1 \
264         src/libelogind/sd-bus/DIFFERENCES \
265         src/libelogind/sd-bus/GVARIANT-SERIALIZATION
266
267 @INTLTOOL_POLICY_RULE@
268
269 # ------------------------------------------------------------------------------
270
271 MANPAGES =
272 MANPAGES_ALIAS =
273
274 include Makefile-man.am
275
276 .PHONY: man update-man-list
277 man: $(MANPAGES) $(MANPAGES_ALIAS) $(HTML_FILES) $(HTML_ALIAS)
278
279 XML_FILES = \
280         ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}}
281 HTML_FILES = \
282         ${XML_FILES:.xml=.html}
283 HTML_ALIAS = \
284         ${patsubst %.1,%.html,${patsubst %.3,%.html,${patsubst %.5,%.html,${patsubst %.7,%.html,${patsubst %.8,%.html,$(MANPAGES_ALIAS)}}}}}
285
286 if ENABLE_MANPAGES
287 man_MANS = \
288         $(MANPAGES) \
289         $(MANPAGES_ALIAS)
290
291 noinst_DATA += \
292         $(HTML_FILES) \
293         $(HTML_ALIAS)
294
295 CLEANFILES += \
296         $(man_MANS) \
297         $(HTML_FILES) \
298         $(HTML_ALIAS)
299
300 docs/html/man:
301         $(AM_V_at)$(MKDIR_P) $(dir $@)
302         $(AM_V_LN)$(LN_S) -f ../../man $@
303
304 noinst_DATA += \
305         docs/html/man
306
307 CLEANFILES += \
308         docs/html/man
309
310 endif
311
312 EXTRA_DIST += \
313         $(XML_FILES) \
314         $(HTML_FILES) \
315         $(HTML_ALIAS) \
316         $(man_MANS) \
317         tools/make-man-index.py \
318         tools/make-directive-index.py \
319         tools/xml_helper.py
320
321 # ------------------------------------------------------------------------------
322 noinst_LTLIBRARIES += \
323         libelogind-shared.la
324
325 libelogind_shared_la_SOURCES = \
326         src/shared/capability.c \
327         src/shared/capability.h \
328         src/shared/linux/auto_dev-ioctl.h \
329         src/shared/ioprio.h \
330         src/shared/missing.h \
331         src/shared/initreq.h \
332         src/shared/securebits.h \
333         src/shared/special.h \
334         src/shared/list.h \
335         src/shared/unaligned.h \
336         src/shared/macro.h \
337         src/shared/def.h \
338         src/shared/sparse-endian.h \
339         src/shared/refcnt.h \
340         src/shared/udev-util.h \
341         src/shared/device-nodes.c \
342         src/shared/device-nodes.h \
343         src/shared/util.c \
344         src/shared/util.h \
345         src/shared/virt.c \
346         src/shared/virt.h \
347         src/shared/architecture.c \
348         src/shared/architecture.h \
349         src/shared/fstab-util.c \
350         src/shared/fstab-util.h \
351         src/shared/path-util.c \
352         src/shared/path-util.h \
353         src/shared/time-util.c \
354         src/shared/time-util.h \
355         src/shared/locale-util.c \
356         src/shared/locale-util.h \
357         src/shared/mempool.c \
358         src/shared/mempool.h \
359         src/shared/hashmap.c \
360         src/shared/hashmap.h \
361         src/shared/siphash24.c \
362         src/shared/siphash24.h \
363         src/shared/set.h \
364         src/shared/fdset.c \
365         src/shared/fdset.h \
366         src/shared/prioq.c \
367         src/shared/prioq.h \
368         src/shared/sleep-config.c \
369         src/shared/sleep-config.h \
370         src/shared/strv.c \
371         src/shared/strv.h \
372         src/shared/env-util.c \
373         src/shared/env-util.h \
374         src/shared/strbuf.c \
375         src/shared/strbuf.h \
376         src/shared/strxcpyx.c \
377         src/shared/strxcpyx.h \
378         src/shared/conf-parser.c \
379         src/shared/conf-parser.h \
380         src/shared/log.c \
381         src/shared/log.h \
382         src/shared/ratelimit.h \
383         src/shared/ratelimit.c \
384         src/shared/exit-status.c \
385         src/shared/exit-status.h \
386         src/shared/utf8.c \
387         src/shared/utf8.h \
388         src/shared/gunicode.c \
389         src/shared/gunicode.h \
390         src/shared/pager.c \
391         src/shared/pager.h \
392         src/shared/socket-util.c \
393         src/shared/socket-util.h \
394         src/shared/in-addr-util.c \
395         src/shared/in-addr-util.h \
396         src/shared/ether-addr-util.h \
397         src/shared/conf-files.c \
398         src/shared/conf-files.h \
399         src/shared/cgroup-util.c \
400         src/shared/cgroup-util.h \
401         src/shared/cgroup-show.c \
402         src/shared/cgroup-show.h \
403         src/shared/logs-show.h \
404         src/shared/unit-name.c \
405         src/shared/unit-name.h \
406         src/shared/watchdog.c \
407         src/shared/watchdog.h \
408         src/shared/replace-var.c \
409         src/shared/replace-var.h \
410         src/shared/spawn-polkit-agent.c \
411         src/shared/spawn-polkit-agent.h \
412         src/shared/clock-util.c \
413         src/shared/clock-util.h \
414         src/shared/calendarspec.c \
415         src/shared/calendarspec.h \
416         src/shared/fileio.c \
417         src/shared/fileio.h \
418         src/shared/output-mode.h \
419         src/shared/MurmurHash2.c \
420         src/shared/MurmurHash2.h \
421         src/shared/acpi-fpdt.h \
422         src/shared/acpi-fpdt.c \
423         src/shared/mkdir.c \
424         src/shared/mkdir.h \
425         src/shared/smack-util.c \
426         src/shared/smack-util.h \
427         src/shared/apparmor-util.c \
428         src/shared/apparmor-util.h \
429         src/shared/ima-util.c \
430         src/shared/ima-util.h \
431         src/shared/ptyfwd.c \
432         src/shared/ptyfwd.h \
433         src/shared/errno-list.c \
434         src/shared/errno-list.h \
435         src/shared/af-list.c \
436         src/shared/af-list.h \
437         src/shared/arphrd-list.c \
438         src/shared/arphrd-list.h \
439         src/shared/cap-list.c \
440         src/shared/cap-list.h \
441         src/shared/audit.c \
442         src/shared/audit.h \
443         src/shared/xml.c \
444         src/shared/xml.h \
445         src/shared/json.c \
446         src/shared/json.h \
447         src/shared/selinux-util.c \
448         src/shared/selinux-util.h \
449         src/shared/label.c \
450         src/shared/label.h \
451         src/shared/socket-label.c \
452         src/shared/mkdir-label.c \
453         src/shared/fileio-label.h \
454         src/shared/fileio-label.c \
455         src/shared/bus-label.c \
456         src/shared/bus-label.h \
457         src/shared/gpt.h \
458         src/shared/clean-ipc.h \
459         src/shared/clean-ipc.c \
460         src/shared/login-shared.c \
461         src/shared/login-shared.h \
462         src/shared/ring.c \
463         src/shared/ring.h \
464         src/shared/barrier.c \
465         src/shared/barrier.h \
466         src/shared/pty.c \
467         src/shared/pty.h \
468         src/shared/async.c \
469         src/shared/async.h \
470         src/shared/base-filesystem.c \
471         src/shared/base-filesystem.h \
472         src/shared/memfd-util.c \
473         src/shared/memfd-util.h \
474         src/shared/uid-range.c \
475         src/shared/uid-range.h \
476         src/shared/nss-util.h \
477         src/shared/verbs.c \
478         src/shared/verbs.h \
479         src/shared/sigbus.c \
480         src/shared/sigbus.h \
481         src/shared/build.h \
482         src/shared/import-util.c \
483         src/shared/import-util.h \
484         src/shared/sysctl-util.c \
485         src/shared/sysctl-util.h
486
487 nodist_libelogind_shared_la_SOURCES = \
488         src/shared/errno-from-name.h \
489         src/shared/errno-to-name.h \
490         src/shared/af-from-name.h \
491         src/shared/af-to-name.h \
492         src/shared/arphrd-from-name.h \
493         src/shared/arphrd-to-name.h \
494         src/shared/cap-from-name.h \
495         src/shared/cap-to-name.h
496
497 libelogind_shared_la_CFLAGS = \
498         $(AM_CFLAGS) \
499         $(CAP_CFLAGS) \
500         $(SECCOMP_CFLAGS) \
501         -pthread
502
503 libelogind_shared_la_LIBADD = \
504         $(CAP_LIBS) \
505         -lm
506
507 libelogind_shared_la_LDFLAGS = \
508         $(CAP_LDFLAGS)
509
510 # ------------------------------------------------------------------------------
511 if HAVE_ACL
512 noinst_LTLIBRARIES += \
513         libelogind-acl.la
514
515 libelogind_acl_la_SOURCES = \
516         src/shared/acl-util.c \
517         src/shared/acl-util.h
518
519 libelogind_acl_la_CFLAGS = \
520         $(AM_CFLAGS) \
521         $(ACL_CFLAGS)
522
523 libelogind_acl_la_LIBADD = \
524         $(ACL_LIBS)
525 endif
526
527 gperf_txt_sources = \
528         src/shared/errno-list.txt \
529         src/shared/af-list.txt \
530         src/shared/arphrd-list.txt \
531         src/shared/cap-list.txt
532
533 BUILT_SOURCES += \
534         $(gperf_gperf_sources:-gperf.gperf=-gperf.c) \
535         $(gperf_txt_sources:-list.txt=-from-name.h) \
536         $(gperf_txt_sources:-list.txt=-to-name.h)
537
538 CLEANFILES += \
539         $(gperf_txt_sources:-list.txt=-from-name.gperf)
540 DISTCLEANFILES = \
541         $(gperf_txt_sources)
542
543 EXTRA_DIST += \
544         $(gperf_gperf_m4_sources) \
545         $(gperf_gperf_sources) \
546         $(gperf_txt_sources:-list.txt=-from-name.gperf)
547
548 CLEANFILES += \
549         $(gperf_txt_sources)
550
551 %-from-name.gperf: %-list.txt
552         $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct $(notdir $*)_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
553
554 %-from-name.h: %-from-name.gperf
555         $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_$(notdir $*) -H hash_$(notdir $*)_name -p -C <$< >$@
556
557
558 src/shared/errno-list.txt:
559         $(AM_V_at)$(MKDIR_P) $(dir $@)
560         $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include errno.h - </dev/null | $(AWK) '/^#define[ \t]+E[^ _]+[ \t]+/ { print $$2; }' >$@
561
562 src/shared/errno-to-name.h: src/shared/errno-list.txt
563         $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const errno_names[] = { "} !/EDEADLOCK/ && !/EWOULDBLOCK/ && !/ENOTSUP/ { printf "[%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
564
565
566 src/shared/af-list.txt:
567         $(AM_V_at)$(MKDIR_P) $(dir $@)
568         $(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; }' >$@
569
570 src/shared/af-to-name.h: src/shared/af-list.txt
571         $(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 "};"}' <$< >$@
572
573
574 src/shared/arphrd-list.txt:
575         $(AM_V_at)$(MKDIR_P) $(dir $@)
576         $(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_//' >$@
577
578 src/shared/arphrd-to-name.h: src/shared/arphrd-list.txt
579         $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const arphrd_names[] = { "} !/CISCO/ { printf "[ARPHRD_%s] = \"%s\",\n", $$1, $$1 } END{print "};"}' <$< >$@
580
581 src/shared/arphrd-from-name.gperf: src/shared/arphrd-list.txt
582         $(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 }' <$< >$@
583
584
585 src/shared/cap-list.txt:
586         $(AM_V_at)$(MKDIR_P) $(dir $@)
587         $(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 >$@
588
589 src/shared/cap-to-name.h: src/shared/cap-list.txt
590         $(AM_V_GEN)$(AWK) 'BEGIN{ print "static const char* const capability_names[] = { "} { printf "[%s] = \"%s\",\n", $$1, tolower($$1) } END{print "};"}' <$< >$@
591
592 src/shared/cap-from-name.gperf: src/shared/cap-list.txt
593         $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct capability_name { const char* name; int id; };"; print "%null-strings"; print "%%";} { printf "%s, %s\n", $$1, $$1 }' <$< >$@
594
595 src/shared/cap-from-name.h: src/shared/cap-from-name.gperf
596         $(AM_V_GPERF)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_capability -H hash_capability_name -p -C <$< >$@
597
598 # ------------------------------------------------------------------------------
599 dist_factory_etc_DATA =
600
601 if HAVE_PAM
602 dist_factory_pam_DATA = \
603         factory/etc/pam.d/system-auth \
604         factory/etc/pam.d/other
605 endif
606
607 # ------------------------------------------------------------------------------
608 noinst_LTLIBRARIES += \
609         libelogind-internal.la
610
611 libelogind_internal_la_SOURCES = \
612         src/systemd/sd-bus.h \
613         src/systemd/sd-bus-protocol.h \
614         src/systemd/sd-bus-vtable.h \
615         src/systemd/sd-utf8.h \
616         src/systemd/sd-event.h \
617         src/systemd/sd-rtnl.h \
618         src/systemd/sd-resolve.h \
619         src/systemd/sd-login.h \
620         src/systemd/sd-id128.h \
621         src/systemd/sd-daemon.h \
622         src/systemd/sd-network.h \
623         src/systemd/sd-device.h \
624         src/libelogind/sd-bus/sd-bus.c \
625         src/libelogind/sd-bus/bus-control.c \
626         src/libelogind/sd-bus/bus-control.h \
627         src/libelogind/sd-bus/bus-error.c \
628         src/libelogind/sd-bus/bus-error.h \
629         src/libelogind/sd-bus/bus-common-errors.h \
630         src/libelogind/sd-bus/bus-common-errors.c \
631         src/libelogind/sd-bus/bus-internal.c \
632         src/libelogind/sd-bus/bus-internal.h \
633         src/libelogind/sd-bus/bus-socket.c \
634         src/libelogind/sd-bus/bus-socket.h \
635         src/libelogind/sd-bus/bus-kernel.c \
636         src/libelogind/sd-bus/bus-kernel.h \
637         src/libelogind/sd-bus/bus-container.c \
638         src/libelogind/sd-bus/bus-container.h \
639         src/libelogind/sd-bus/bus-message.c \
640         src/libelogind/sd-bus/bus-message.h \
641         src/libelogind/sd-bus/bus-creds.c \
642         src/libelogind/sd-bus/bus-creds.h \
643         src/libelogind/sd-bus/bus-signature.c \
644         src/libelogind/sd-bus/bus-signature.h \
645         src/libelogind/sd-bus/bus-type.c \
646         src/libelogind/sd-bus/bus-type.h \
647         src/libelogind/sd-bus/bus-match.c \
648         src/libelogind/sd-bus/bus-match.h \
649         src/libelogind/sd-bus/bus-bloom.c \
650         src/libelogind/sd-bus/bus-bloom.h \
651         src/libelogind/sd-bus/bus-introspect.c \
652         src/libelogind/sd-bus/bus-introspect.h \
653         src/libelogind/sd-bus/bus-objects.c \
654         src/libelogind/sd-bus/bus-objects.h \
655         src/libelogind/sd-bus/bus-gvariant.c \
656         src/libelogind/sd-bus/bus-gvariant.h \
657         src/libelogind/sd-bus/bus-convenience.c \
658         src/libelogind/sd-bus/bus-track.c \
659         src/libelogind/sd-bus/bus-track.h \
660         src/libelogind/sd-bus/bus-util.c \
661         src/libelogind/sd-bus/bus-util.h \
662         src/libelogind/sd-bus/bus-slot.c \
663         src/libelogind/sd-bus/bus-slot.h \
664         src/libelogind/sd-bus/bus-protocol.h \
665         src/libelogind/sd-bus/kdbus.h \
666         src/libelogind/sd-utf8/sd-utf8.c \
667         src/libelogind/sd-event/sd-event.c \
668         src/libelogind/sd-event/event-util.h \
669         src/libelogind/sd-rtnl/sd-rtnl.c \
670         src/libelogind/sd-rtnl/rtnl-internal.h \
671         src/libelogind/sd-rtnl/rtnl-message.c \
672         src/libelogind/sd-rtnl/rtnl-types.h \
673         src/libelogind/sd-rtnl/rtnl-types.c \
674         src/libelogind/sd-rtnl/rtnl-util.h \
675         src/libelogind/sd-rtnl/rtnl-util.c \
676         src/libelogind/sd-rtnl/local-addresses.h \
677         src/libelogind/sd-rtnl/local-addresses.c \
678         src/libelogind/sd-id128/sd-id128.c \
679         src/libelogind/sd-daemon/sd-daemon.c \
680         src/libelogind/sd-login/sd-login.c \
681         src/libelogind/sd-network/sd-network.c \
682         src/libelogind/sd-network/network-util.h \
683         src/libelogind/sd-network/network-util.c \
684         src/libelogind/sd-device/device-internal.h \
685         src/libelogind/sd-device/device-util.h \
686         src/libelogind/sd-device/sd-device.c \
687         src/libelogind/sd-device/device-private.c \
688         src/libelogind/sd-device/device-private.h
689
690 nodist_libelogind_internal_la_SOURCES = \
691         src/libelogind/libelogind.sym
692
693 libelogind_internal_la_CFLAGS = \
694         $(AM_CFLAGS) \
695         -pthread
696
697 BUILT_SOURCES += \
698        src/libelogind/libelogind.sym
699
700
701 libelogind_internal_la_LIBADD = \
702         libelogind-shared.la
703
704 libelogind_internal_la_LDFLAGS = \
705         $(AM_LDFLAGS)
706
707 lib_LTLIBRARIES += \
708         libelogind.la
709
710 libelogind_la_SOURCES =
711
712 libelogind_la_CFLAGS = \
713         $(AM_CFLAGS)
714
715 libelogind_la_LDFLAGS = \
716         $(AM_LDFLAGS) \
717         -version-info $(LIBELOGIND_CURRENT):$(LIBELOGIND_REVISION):$(LIBELOGIND_AGE) \
718         -Wl,--version-script=src/libelogind/libelogind.sym
719
720 libelogind_la_LIBADD = \
721         libelogind-internal.la
722
723 pkgconfiglib_DATA += \
724         src/libelogind/libelogind.pc
725
726 pkginclude_HEADERS += \
727         src/systemd/sd-login.h \
728         src/systemd/sd-messages.h \
729         src/systemd/sd-journal.h \
730         src/systemd/_sd-common.h
731
732 EXTRA_DIST += \
733         src/libelogind/libelogind.sym.m4 \
734         src/libelogind/libelogind.pc.in \
735         src/libelogind/sd-bus/DIFFERENCES \
736         src/libelogind/sd-bus/GVARIANT-SERIALIZATION
737
738 CLEANFILES += \
739         src/libelogind/libelogind.sym
740
741 BUILT_SOURCES += \
742         src/libelogind/libelogind.sym
743
744
745 # ------------------------------------------------------------------------------
746 elogind_SOURCES = \
747         src/login/logind.c \
748         src/login/logind.h
749
750 nodist_elogind_SOURCES = \
751         src/login/logind-gperf.c
752
753 elogind_LDADD = \
754         libelogind-core.la
755
756 libelogind_core_la_SOURCES = \
757         src/login/logind-core.c \
758         src/login/logind-device.c \
759         src/login/logind-device.h \
760         src/login/logind-button.c \
761         src/login/logind-button.h \
762         src/login/logind-action.c \
763         src/login/logind-action.h \
764         src/login/logind-seat.c \
765         src/login/logind-seat.h \
766         src/login/logind-session.c \
767         src/login/logind-session.h \
768         src/login/logind-session-device.c \
769         src/login/logind-session-device.h \
770         src/login/logind-user.c \
771         src/login/logind-user.h \
772         src/login/logind-inhibit.c \
773         src/login/logind-inhibit.h \
774         src/login/logind-dbus.c \
775         src/login/logind-session-dbus.c \
776         src/login/logind-seat-dbus.c \
777         src/login/logind-user-dbus.c \
778         src/login/logind-acl.h
779
780 libelogind_core_la_LIBADD = \
781         $(UDEV_LIBS) \
782         libelogind-internal.la
783
784 if HAVE_ACL
785 libelogind_core_la_SOURCES += \
786         src/login/logind-acl.c
787
788 libelogind_core_la_LIBADD += \
789         libelogind-acl.la
790 endif
791
792 noinst_LTLIBRARIES += \
793         libelogind-core.la
794
795 pkglibexec_PROGRAMS += elogind
796
797 loginctl_SOURCES = \
798         src/login/loginctl.c \
799         src/login/sysfs-show.h \
800         src/login/sysfs-show.c
801
802 loginctl_LDADD = \
803         $(UDEV_LIBS) \
804         libelogind-internal.la \
805         libelogind-shared.la
806
807 bin_PROGRAMS += \
808         loginctl
809
810 logind_cgroups_agent_SOURCES = \
811         src/cgroups-agent/cgroups-agent.c
812
813 logind_cgroups_agent_LDADD = \
814         libelogind-internal.la \
815         libelogind-shared.la
816
817 pkglibexec_PROGRAMS += \
818         logind-cgroups-agent
819
820 dist_bashcompletion_DATA += \
821         shell-completion/bash/loginctl
822
823 dist_zshcompletion_DATA += \
824         shell-completion/zsh/_loginctl
825
826 systemd_inhibit_SOURCES = \
827         src/login/inhibit.c
828
829 systemd_inhibit_LDADD = \
830         libelogind-internal.la \
831         libelogind-shared.la
832
833 bin_PROGRAMS += \
834         systemd-inhibit
835
836 test_login_SOURCES = \
837         src/libelogind/sd-login/test-login.c
838
839 test_login_LDADD = \
840         libelogind-internal.la \
841         libelogind-shared.la
842
843 test_login_shared_SOURCES = \
844         src/login/test-login-shared.c
845
846 test_login_shared_LDADD = \
847         libelogind-internal.la \
848         libelogind-shared.la
849
850 test_inhibit_SOURCES = \
851         src/login/test-inhibit.c
852
853 test_inhibit_LDADD = \
854         libelogind-internal.la \
855         libelogind-shared.la
856
857 test_login_tables_SOURCES = \
858         src/login/test-login-tables.c \
859         src/shared/test-tables.h
860
861 test_login_tables_LDADD = \
862         libelogind-core.la
863
864 manual_tests += \
865         test-login \
866         test-inhibit
867
868 tests += \
869         test-login-tables \
870         test-login-shared
871
872 if HAVE_PAM
873 pam_elogind_la_SOURCES = \
874         src/login/pam_elogind.sym \
875         src/login/pam_elogind.c
876
877 pam_elogind_la_CFLAGS = \
878         $(AM_CFLAGS) \
879         $(PAM_CFLAGS) \
880         -fvisibility=hidden
881
882 pam_elogind_la_LDFLAGS = \
883         $(AM_LDFLAGS) \
884         -module \
885         -export-dynamic \
886         -avoid-version \
887         -shared \
888         -Wl,--version-script=$(top_srcdir)/src/login/pam_elogind.sym
889
890 pam_elogind_la_LIBADD = \
891         libelogind-internal.la \
892         $(PAM_LIBS)
893
894 pamlib_LTLIBRARIES = \
895         pam_elogind.la
896
897 dist_pamconf_DATA = \
898         src/login/elogind-user
899
900 endif
901
902 dist_dbussystemservice_DATA += \
903         src/login/org.freedesktop.login1.service
904
905 dist_dbuspolicy_DATA += \
906         src/login/org.freedesktop.login1.conf
907
908 dist_pkgsysconf_DATA += \
909         src/login/logind.conf
910
911 polkitpolicy_files += \
912         src/login/org.freedesktop.login1.policy
913
914 SYSTEM_UNIT_ALIASES += \
915         elogind.service dbus-org.freedesktop.login1.service
916
917 dist_udevrules_DATA = \
918         src/login/70-uaccess.rules \
919         src/login/70-power-switch.rules
920
921 nodist_udevrules_DATA = \
922         src/login/71-seat.rules \
923         src/login/73-seat-late.rules
924
925 polkitpolicy_in_files += \
926         src/login/org.freedesktop.login1.policy.in
927
928 gperf_gperf_sources = \
929         src/login/logind-gperf.gperf
930
931 EXTRA_DIST += \
932         src/login/71-seat.rules.in \
933         src/login/73-seat-late.rules.in
934
935 # ------------------------------------------------------------------------------
936 substitutions = \
937        '|bindir=$(bindir)|' \
938        '|udevbindir=$(udevbindir)|' \
939        '|pkgsysconfdir=$(pkgsysconfdir)|' \
940        '|pkgdatadir=$(pkgdatadir)|' \
941        '|PACKAGE_VERSION=$(PACKAGE_VERSION)|' \
942        '|PACKAGE_NAME=$(PACKAGE_NAME)|' \
943        '|PACKAGE_URL=$(PACKAGE_URL)|' \
944        '|prefix=$(prefix)|' \
945        '|exec_prefix=$(exec_prefix)|' \
946        '|libdir=$(libdir)|' \
947        '|includedir=$(includedir)|' \
948        '|VERSION=$(VERSION)|' \
949        '|rootprefix=$(rootprefix)|' \
950        '|MKDIR_P=$(MKDIR_P)|' \
951        '|systemuidmax=$(SYSTEM_UID_MAX)|' \
952        '|systemgidmax=$(SYSTEM_GID_MAX)|'
953
954 SED_PROCESS = \
955         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
956         $(SED) $(subst '|,-e 's|@,$(subst =,\@|,$(subst |',|g',$(substitutions)))) \
957                 < $< > $@
958
959 units/%: units/%.in
960         $(SED_PROCESS)
961
962 man/%: man/%.in
963         $(SED_PROCESS)
964
965 sysctl.d/%: sysctl.d/%.in
966         $(SED_PROCESS)
967
968 %.pc: %.pc.in
969         $(SED_PROCESS)
970
971 %.conf: %.conf.in
972         $(SED_PROCESS)
973
974 src/%.policy.in: src/%.policy.in.in
975         $(SED_PROCESS)
976
977 shell-completion/%: shell-completion/%.in
978         $(SED_PROCESS)
979
980 %.rules: %.rules.in
981         $(SED_PROCESS)
982
983 %.conf: %.conf.in
984         $(SED_PROCESS)
985
986 %.sh: %.sh.in
987         $(SED_PROCESS)
988         $(AM_V_GEN)chmod +x $@
989
990 src/%.c: src/%.gperf
991         $(AM_V_at)$(MKDIR_P) $(dir $@)
992         $(AM_V_GPERF)$(GPERF) < $< > $@
993
994 src/%: src/%.m4
995         $(AM_V_at)$(MKDIR_P) $(dir $@)
996         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
997
998 sysusers.d/%: sysusers.d/%.m4
999         $(AM_V_at)$(MKDIR_P) $(dir $@)
1000         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
1001
1002 tmpfiles.d/%: tmpfiles.d/%.m4
1003         $(AM_V_at)$(MKDIR_P) $(dir $@)
1004         $(AM_V_M4)$(M4) -P $(M4_DEFINES) < $< > $@
1005
1006
1007 units/%: units/%.m4
1008         $(AM_V_at)$(MKDIR_P) $(dir $@)
1009         $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_SYSTEM=1 < $< > $@
1010
1011 units/user/%: units/user/%.m4
1012         $(AM_V_at)$(MKDIR_P) $(dir $@)
1013         $(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
1014
1015 if ENABLE_POLKIT
1016 nodist_polkitpolicy_DATA = \
1017         $(polkitpolicy_files) \
1018         $(polkitpolicy_in_in_files:.policy.in.in=.policy)
1019 endif
1020
1021 EXTRA_DIST += \
1022         $(polkitpolicy_in_files) \
1023         $(polkitpolicy_in_in_files)
1024
1025 # ------------------------------------------------------------------------------
1026 if ENABLE_MANPAGES
1027 man/custom-entities.ent: configure.ac
1028         $(AM_V_GEN)$(MKDIR_P) $(dir $@)
1029         $(AM_V_GEN)(echo '<?xml version="1.0" encoding="utf-8" ?>' && \
1030          printf '$(subst '|,<!ENTITY ,$(subst =, ",$(subst |',">\n,$(substitutions))))') \
1031          > $@ # '
1032
1033 DISTCLEANFILES += \
1034         man/custom-entities.ent
1035
1036 XSLTPROC_FLAGS = \
1037         --nonet \
1038         --xinclude \
1039         --stringparam man.output.quietly 1 \
1040         --stringparam funcsynopsis.style ansi \
1041         --stringparam man.authors.section.enabled 0 \
1042         --stringparam man.copyright.section.enabled 0 \
1043         --stringparam elogind.version $(VERSION) \
1044         --path '$(builddir)/man:$(srcdir)/man'
1045
1046 XSLTPROC_PROCESS_MAN = \
1047         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-man.xsl $<
1048
1049 XSLTPROC_PROCESS_HTML = \
1050         $(AM_V_XSLT)$(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(srcdir)/man/custom-html.xsl $<
1051
1052 man/%.1: man/%.xml man/custom-man.xsl man/custom-entities.ent
1053         $(XSLTPROC_PROCESS_MAN)
1054
1055 man/%.3: man/%.xml man/custom-man.xsl man/custom-entities.ent
1056         $(XSLTPROC_PROCESS_MAN)
1057
1058 man/%.5: man/%.xml man/custom-man.xsl man/custom-entities.ent
1059         $(XSLTPROC_PROCESS_MAN)
1060
1061 man/%.7: man/%.xml man/custom-man.xsl man/custom-entities.ent
1062         $(XSLTPROC_PROCESS_MAN)
1063
1064 man/%.8: man/%.xml man/custom-man.xsl man/custom-entities.ent
1065         $(XSLTPROC_PROCESS_MAN)
1066
1067 man/%.html: man/%.xml man/custom-html.xsl man/custom-entities.ent
1068         $(XSLTPROC_PROCESS_HTML)
1069
1070 define html-alias
1071         $(AM_V_LN)$(LN_S) -f $(notdir $<) $@
1072 endef
1073
1074 endif
1075
1076 EXTRA_DIST += \
1077         man/custom-html.xsl \
1078         man/custom-man.xsl
1079
1080 install-exec-hook: $(INSTALL_EXEC_HOOKS)
1081
1082 uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
1083
1084 install-data-hook: $(INSTALL_DATA_HOOKS)
1085
1086 distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
1087
1088 clean-local: $(CLEAN_LOCAL_HOOKS)
1089         rm -rf $(abs_srcdir)/install-tree
1090
1091 DISTCHECK_CONFIGURE_FLAGS = \
1092         --with-dbuspolicydir=$$dc_install_base/$(dbuspolicydir) \
1093         --with-dbussessionservicedir=$$dc_install_base/$(dbussessionservicedir) \
1094         --with-dbussystemservicedir=$$dc_install_base/$(dbussystemservicedir) \
1095         --with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir) \
1096         --with-zshcompletiondir=$$dc_install_base/$(zshcompletiondir) \
1097         --with-pamlibdir=$$dc_install_base/$(pamlibdir) \
1098         --with-pamconfdir=$$dc_install_base/$(pamconfdir) \
1099         --enable-kdbus \
1100         --with-udevrulesdir=$$dc_install_base/$(udevrulesdir)
1101
1102 if ENABLE_GTK_DOC
1103 DISTCHECK_CONFIGURE_FLAGS += \
1104         --enable-gtk-doc
1105 endif