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