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