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