chiark / gitweb /
sd-daemon: fix listening socket verification
[elogind.git] / Makefile.am
1 #  This file is part of systemd.
2 #
3 #  Copyright 2010 Lennart Poettering
4 #
5 #  systemd is free software; you can redistribute it and/or modify it
6 #  under the terms of the GNU General Public License as published by
7 #  the Free Software Foundation; either version 2 of the License, or
8 #  (at your option) any later version.
9 #
10 #  systemd is distributed in the hope that it will be useful, but
11 #  WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 #  General Public License for more details.
14 #
15 #  You should have received a copy of the GNU General Public License
16 #  along with systemd; If not, see <http://www.gnu.org/licenses/>.
17
18 ACLOCAL_AMFLAGS = -I m4
19
20 dbuspolicydir=$(sysconfdir)/dbus-1/system.d
21 udevrulesdir=@udevrulesdir@
22
23 pkgsysconfdir=$(sysconfdir)/systemd
24 systemunitdir=$(pkgdatadir)/system
25 sessionunitdir=$(pkgdatadir)/session
26
27 AM_CPPFLAGS = \
28         -include $(top_builddir)/config.h \
29         -DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \
30         -DSYSTEM_DATA_UNIT_PATH=\"$(systemunitdir)\" \
31         -DSYSTEM_SYSVINIT_PATH=\"$(SYSTEM_SYSVINIT_PATH)\" \
32         -DSYSTEM_SYSVRCND_PATH=\"$(SYSTEM_SYSVRCND_PATH)\" \
33         -DSESSION_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/session\" \
34         -DSESSION_DATA_UNIT_PATH=\"$(sessionunitdir)\" \
35         -DCGROUP_AGENT_PATH=\"$(pkglibexecdir)/systemd-cgroups-agent\" \
36         -DSYSTEMD_BINARY_PATH=\"$(sbindir)/systemd\" \
37         -I $(top_srcdir)/src
38
39 sbin_PROGRAMS = \
40         systemd
41
42 bin_PROGRAMS = \
43         systemctl
44
45 if HAVE_GTK
46 bin_PROGRAMS += \
47         systemadm
48 endif
49
50 pkglibexec_PROGRAMS = \
51         systemd-logger \
52         systemd-cgroups-agent \
53         systemd-initctl
54
55 noinst_PROGRAMS = \
56         test-engine \
57         test-job-type \
58         test-ns \
59         test-loopback
60
61 dist_dbuspolicy_DATA = \
62         src/org.freedesktop.systemd1.conf
63
64 dist_udevrules_DATA = \
65         src/99-systemd.rules
66
67 dist_systemunit_DATA = \
68         units/emergency.service \
69         units/getty.target \
70         units/halt.target \
71         units/local-fs.target \
72         units/network.target \
73         units/nss-lookup.target \
74         units/poweroff.target \
75         units/reboot.target \
76         units/remote-fs.target \
77         units/rescue.target \
78         units/rpcbind.target \
79         units/rtc-set.target \
80         units/shutdown.target \
81         units/sigpwr.target \
82         units/sockets.target \
83         units/swap.target \
84         units/systemd-initctl.socket \
85         units/systemd-logger.socket \
86         units/dev-hugepages.automount \
87         units/dev-hugepages.mount \
88         units/dev-mqueue.automount \
89         units/dev-mqueue.mount \
90         units/proc-sys-fs-binfmt_misc.automount \
91         units/proc-sys-fs-binfmt_misc.mount \
92         units/sys-kernel-debug.automount \
93         units/sys-kernel-debug.mount \
94         units/var-run.mount
95
96 systemunit_DATA = \
97         units/basic.target \
98         units/getty@.service \
99         units/graphical.target \
100         units/multi-user.target \
101         units/systemd-initctl.service \
102         units/systemd-logger.service \
103         units/syslog.target
104
105 dist_sessionunit_DATA = \
106         units/session/default.target
107
108 sessionunit_DATA = \
109         units/session/remote-fs.target
110
111 EXTRA_DIST = \
112         units/basic.target.m4 \
113         units/getty@.service.m4 \
114         units/graphical.target.m4 \
115         units/multi-user.target.m4 \
116         units/remote-fs.target.m4 \
117         units/systemd-initctl.service.in \
118         units/systemd-logger.service.in \
119         units/syslog.target.in \
120         LICENSE \
121         README \
122         DISTRO_PORTING
123
124 if TARGET_FEDORA
125 dist_systemunit_DATA += \
126         units/fedora/halt.service \
127         units/fedora/killall.service \
128         units/fedora/poweroff.service \
129         units/fedora/prefdm.service \
130         units/fedora/rc-local.service \
131         units/fedora/reboot.service \
132         units/fedora/sysinit.service
133 endif
134
135 if TARGET_GENTOO
136 dist_systemunit_DATA += \
137         units/gentoo/halt.service \
138         units/gentoo/killall.service \
139         units/gentoo/poweroff.service \
140         units/gentoo/reboot.service \
141         units/gentoo/xdm.service
142 endif
143
144 # This is needed because automake is buggy in how it generates the
145 # rules for C programs, but not Vala programs.  We therefore can't
146 # list the .h files as dependencies if we want make dist to work.
147 BASIC_SOURCES = \
148         src/util.c \
149         src/hashmap.c \
150         src/set.c \
151         src/strv.c \
152         src/conf-parser.c \
153         src/socket-util.c \
154         src/log.c \
155         src/ratelimit.c
156
157 COMMON_SOURCES = \
158         $(BASIC_SOURCES) \
159         src/unit.c \
160         src/job.c \
161         src/manager.c \
162         src/load-fragment.c \
163         src/service.c \
164         src/automount.c \
165         src/mount.c \
166         src/swap.c \
167         src/device.c \
168         src/target.c \
169         src/snapshot.c \
170         src/socket.c \
171         src/timer.c \
172         src/load-dropin.c \
173         src/execute.c \
174         src/dbus.c \
175         src/dbus-manager.c \
176         src/dbus-unit.c \
177         src/dbus-job.c \
178         src/dbus-service.c \
179         src/dbus-socket.c \
180         src/dbus-target.c \
181         src/dbus-mount.c \
182         src/dbus-automount.c \
183         src/dbus-swap.c \
184         src/dbus-snapshot.c \
185         src/dbus-device.c \
186         src/dbus-execute.c \
187         src/cgroup.c \
188         src/mount-setup.c \
189         src/hostname-setup.c \
190         src/loopback-setup.c \
191         src/utmp-wtmp.c \
192         src/specifier.c \
193         src/unit-name.c \
194         src/fdset.c \
195         src/namespace.c
196
197 EXTRA_DIST += \
198         ${COMMON_SOURCES:.c=.h} \
199         src/macro.h \
200         src/ioprio.h \
201         src/missing.h \
202         src/list.h \
203         src/securebits.h \
204         src/linux/auto_dev-ioctl.h \
205         src/initreq.h \
206         src/sd-daemon.h
207
208 dist_man_MANS = \
209         man/systemd.unit.5 \
210         man/systemd.service.5
211
212 nodist_man_MANS = \
213         man/systemd.special.7
214
215 dist_noinst_DATA = \
216         man/systemd.unit.html \
217         man/systemd.service.html
218
219 nodist_noinst_DATA = \
220         man/systemd.special.html
221
222 EXTRA_DIST += \
223         man/systemd.unit.xml \
224         man/systemd.service.xml \
225         man/systemd.special.xml.in \
226         man/systemd.special.7.in \
227         man/systemd.special.html.in
228
229 systemd_SOURCES = \
230         $(COMMON_SOURCES) \
231         src/main.c
232
233 systemd_CPPFLAGS = \
234         $(AM_CPPFLAGS) \
235         $(DBUS_CFLAGS) \
236         $(UDEV_CFLAGS) \
237         $(CGROUP_CFLAGS)
238
239 systemd_LDADD = \
240         $(DBUS_LIBS) \
241         $(UDEV_LIBS) \
242         $(CGROUP_LIBS)
243
244 test_engine_SOURCES = \
245         $(COMMON_SOURCES) \
246         src/test-engine.c
247
248 test_engine_CPPFLAGS = $(systemd_CPPFLAGS)
249 test_engine_LDADD = $(systemd_LDADD)
250
251 test_job_type_SOURCES = \
252         $(COMMON_SOURCES) \
253         src/test-engine.c
254
255 test_job_type_CPPFLAGS = $(systemd_CPPFLAGS)
256 test_job_type_LDADD = $(systemd_LDADD)
257
258 test_ns_SOURCES = \
259         $(BASIC_SOURCES) \
260         src/test-ns.c \
261         src/namespace.c
262
263 test_ns_CPPFLAGS = $(systemd_CPPFLAGS)
264 test_ns_LDADD = $(systemd_LDADD)
265
266 test_loopback_SOURCES = \
267         $(BASIC_SOURCES) \
268         src/test-loopback.c \
269         src/loopback-setup.c
270
271 test_loopback_CPPFLAGS = $(systemd_CPPFLAGS)
272 test_loopback_LDADD = $(systemd_LDADD)
273
274 systemd_logger_SOURCES = \
275         $(BASIC_SOURCES) \
276         src/logger.c \
277         src/sd-daemon.c
278
279 systemd_initctl_SOURCES = \
280         $(BASIC_SOURCES) \
281         src/initctl.c \
282         src/sd-daemon.c
283
284 systemd_initctl_CPPFLAGS = \
285         $(AM_CPPFLAGS) \
286         $(DBUS_CFLAGS)
287
288 systemd_initctl_LDADD = \
289         $(DBUS_LIBS)
290
291 systemd_cgroups_agent_SOURCES = \
292         $(BASIC_SOURCES) \
293         src/cgroups-agent.c
294
295 systemd_cgroups_agent_CPPFLAGS = \
296         $(AM_CPPFLAGS) \
297         $(DBUS_CFLAGS)
298
299 systemd_cgroups_agent_LDADD = \
300         $(DBUS_LIBS)
301
302 VALAFLAGS = \
303         -g \
304         --save-temps \
305         --pkg=dbus-glib-1 \
306         --pkg=posix
307
308 if HAVE_GTK
309 VALAFLAGS += \
310         --pkg=gtk+-2.0
311 endif
312
313 VALA_CFLAGS = \
314         -Wno-unused-variable \
315         -Wno-unused-function
316
317 systemctl_SOURCES = \
318         src/systemctl.vala \
319         src/systemd-interfaces.vala
320
321 systemctl_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(VALA_CFLAGS)
322 systemctl_LDADD = $(DBUSGLIB_LIBS)
323
324 systemadm_SOURCES = \
325         src/systemadm.vala \
326         src/systemd-interfaces.vala
327
328 systemadm_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(GTK_CFLAGS) $(VALA_CFLAGS)
329 systemadm_LDADD = $(DBUSGLIB_LIBS) $(GTK_LIBS)
330
331 SED_PROCESS = \
332         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
333         $(SED)  -e 's,@libexecdir\@,$(libexecdir),g' \
334                 -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
335                 -e 's,@SPECIAL_SYSLOG_SERVICE\@,$(SPECIAL_SYSLOG_SERVICE),g' \
336                 < $< > $@
337
338 units/%: units/%.in Makefile
339         $(SED_PROCESS)
340
341 man/%: man/%.in Makefile
342         $(SED_PROCESS)
343
344 M4_PROCESS_SYSTEM = \
345         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
346         $(M4) -P $(M4_DISTRO_FLAG) -DFOR_SYSTEM=1 < $< > $@
347
348 M4_PROCESS_SESSION = \
349         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
350         $(M4) -P $(M4_DISTRO_FLAG) -DFOR_SESSION=1 < $< > $@
351
352 units/%: units/%.m4 Makefile
353         $(M4_PROCESS_SYSTEM)
354
355 units/session/%: units/%.m4 Makefile
356         $(M4_PROCESS_SESSION)
357
358 CLEANFILES = \
359         units/systemd-initctl.service \
360         units/systemd-logger.service \
361         units/syslog.target \
362         units/basic.target \
363         units/getty@.service \
364         units/graphical.target \
365         units/multi-user.target \
366         units/remote-fs.target \
367         units/session/remote-fs.target \
368         man/systemd.special.7 \
369         man/systemd.special.html
370
371 if HAVE_VALAC
372 CLEANFILES += \
373         src/systemd-interfaces.c \
374         src/systemctl.c \
375         src/systemadm.c
376 endif
377
378 if HAVE_XSLTPROC
379 XSLTPROC_PROCESS_MAN = \
380         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
381         $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
382
383 XSLTPROC_PROCESS_MAN_IN = \
384         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
385         $(XSLTPROC) -o ${@:.in=} -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< && \
386         mv ${@:.in=} $@
387
388 XSLTPROC_PROCESS_HTML = \
389         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
390         $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $<
391
392 XSLTPROC_PROCESS_HTML_IN = \
393         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
394         $(XSLTPROC) -o ${@:.in=} -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $< && \
395         mv ${@:.in=} $@
396
397 man/%.5: man/%.xml
398         $(XSLTPROC_PROCESS_MAN)
399
400 man/%.5.in: man/%.xml.in
401         $(XSLTPROC_PROCESS_MAN)
402
403 man/%.7: man/%.xml
404         $(XSLTPROC_PROCESS_MAN)
405
406 man/%.7.in: man/%.xml.in
407         $(XSLTPROC_PROCESS_MAN_IN)
408
409 man/%.html: man/%.xml
410         $(XSLTPROC_PROCESS_HTML)
411
412 man/%.html.in: man/%.xml.in
413         $(XSLTPROC_PROCESS_HTML_IN)
414
415 CLEANFILES += \
416         $(dist_man_MANS) \
417         man/systemd.special.7.in \
418         man/systemd.unit.html \
419         man/systemd.service.html \
420         man/systemd.special.html.in
421 endif
422
423 install-data-hook:
424         $(MKDIR_P) -m 0755 \
425                 $(DESTDIR)$(systemunitdir) \
426                 $(DESTDIR)$(sessionunitdir) \
427                 $(DESTDIR)$(systemunitdir)/sockets.target.wants \
428                 $(DESTDIR)$(systemunitdir)/basic.target.wants \
429                 $(DESTDIR)$(pkgsysconfdir)/system \
430                 $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants \
431                 $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants \
432                 $(DESTDIR)$(pkgsysconfdir)/system/graphical.target.wants \
433                 $(DESTDIR)$(pkgsysconfdir)/session \
434                 $(DESTDIR)$(sysconfdir)/xdg/systemd
435         $(MKDIR_P) -m 0755 $(DESTDIR)/cgroup/systemd || \
436                 echo "Don't forget to create /cgroup/systemd! Couldn't create it for you, continuing anyway."
437         ( cd $(DESTDIR)$(sysconfdir)/xdg/systemd/ && \
438                 rm -f session && \
439                 $(LN_S) $(pkgsysconfdir)/session session )
440         ( cd $(DESTDIR)$(systemunitdir)/sockets.target.wants && \
441                 rm -f systemd-initctl.socket systemd-logger.socket && \
442                 $(LN_S) ../systemd-logger.socket systemd-logger.socket && \
443                 $(LN_S) ../systemd-initctl.socket systemd-initctl.socket )
444         ( cd $(DESTDIR)$(sessionunitdir) && \
445                 rm -f shutdown.target sockets.target local-fs.target swap.target && \
446                 $(LN_S) ../system/shutdown.target shutdown.target && \
447                 $(LN_S) ../system/sockets.target sockets.target && \
448                 $(LN_S) ../system/local-fs.target local-fs.target && \
449                 $(LN_S) ../system/swap.target swap.target )
450         ( cd $(DESTDIR)$(systemunitdir) && \
451                 rm -f runlevel0.target runlevel1.target runlevel6.target && \
452                 $(LN_S) poweroff.target runlevel0.target && \
453                 $(LN_S) rescue.target runlevel1.target && \
454                 $(LN_S) reboot.target runlevel6.target )
455         ( cd $(DESTDIR)$(pkgsysconfdir)/system && \
456                 rm -f default.target ctrl-alt-del.target kbrequest.target && \
457                 $(LN_S) $(systemunitdir)/graphical.target default.target && \
458                 $(LN_S) $(systemunitdir)/reboot.target ctrl-alt-del.target && \
459                 $(LN_S) $(systemunitdir)/rescue.target kbrequest.target && \
460                 rm -f runlevel2.target runlevel3.target runlevel4.target runlevel5.target && \
461                 $(LN_S) $(systemunitdir)/multi-user.target runlevel2.target && \
462                 $(LN_S) $(systemunitdir)/multi-user.target runlevel3.target && \
463                 $(LN_S) $(systemunitdir)/multi-user.target runlevel4.target && \
464                 $(LN_S) $(systemunitdir)/graphical.target runlevel5.target )
465         ( cd $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants && \
466                 rm -f getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service && \
467                 $(LN_S) $(systemunitdir)/getty@.service getty@tty1.service && \
468                 $(LN_S) $(systemunitdir)/getty@.service getty@tty2.service && \
469                 $(LN_S) $(systemunitdir)/getty@.service getty@tty3.service && \
470                 $(LN_S) $(systemunitdir)/getty@.service getty@tty4.service && \
471                 $(LN_S) $(systemunitdir)/getty@.service getty@tty5.service && \
472                 $(LN_S) $(systemunitdir)/getty@.service getty@tty6.service )
473         ( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
474                 rm -f getty.target && \
475                 $(LN_S) $(systemunitdir)/getty.target getty.target )
476         ( cd $(DESTDIR)$(systemunitdir)/basic.target.wants && \
477                 rm -f dev-hugepages.automount dev-mqueue.automount proc-sys-fs-binfmt_misc.automount sys-kernel-debug.automount && \
478                 $(LN_S) ../dev-hugepages.automount dev-hugepages.automount && \
479                 $(LN_S) ../dev-mqueue.automount dev-mqueue.automount && \
480                 $(LN_S) ../proc-sys-fs-binfmt_misc.automount proc-sys-fs-binfmt_misc.automount && \
481                 $(LN_S) ../sys-kernel-debug.automount sys-kernel-debug.automount )
482 if TARGET_FEDORA
483         ( cd $(DESTDIR)$(pkgsysconfdir)/system/graphical.target.wants && \
484                 rm -f prefdm.service && \
485                 $(LN_S) $(systemunitdir)/prefdm.service prefdm.service )
486         ( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
487                 rm -f rc-local.service && \
488                 $(LN_S) $(systemunitdir)/rc-local.service rc-local.service )
489         ( cd $(DESTDIR)$(systemunitdir) && \
490                 rm -f local.service && \
491                 $(LN_S) rc-local.service local.service )
492         ( cd $(DESTDIR)/etc/init.d && \
493                 $(LN_S) halt reboot > /dev/null 2>&1 || true )
494 endif
495
496 DISTCHECK_CONFIGURE_FLAGS = \
497         --with-udevrulesdir=$$dc_install_base/$(udevrulesdir)