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