chiark / gitweb /
units: synchronize with shutdown.target
[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
87 systemunit_DATA = \
88         units/basic.target \
89         units/getty@.service \
90         units/graphical.target \
91         units/multi-user.target \
92         units/systemd-initctl.service \
93         units/systemd-logger.service \
94         units/syslog.target
95
96 sessionunit_DATA = \
97         units/session/remote-fs.target
98
99 EXTRA_DIST = \
100         units/basic.target.m4 \
101         units/getty@.service.m4 \
102         units/graphical.target.m4 \
103         units/multi-user.target.m4 \
104         units/remote-fs.target.m4 \
105         units/systemd-initctl.service.in \
106         units/systemd-logger.service.in \
107         units/syslog.target.in \
108         LICENSE \
109         README \
110         DISTRO_PORTING
111
112 if TARGET_FEDORA
113 dist_systemunit_DATA += \
114         units/fedora/halt.service \
115         units/fedora/killall.service \
116         units/fedora/poweroff.service \
117         units/fedora/prefdm.service \
118         units/fedora/rc-local.service \
119         units/fedora/reboot.service \
120         units/fedora/sysinit.service
121 endif
122
123 # This is needed because automake is buggy in how it generates the
124 # rules for C programs, but not Vala programs.  We therefore can't
125 # list the .h files as dependencies if we want make dist to work.
126 BASIC_SOURCES = \
127         src/util.c \
128         src/hashmap.c \
129         src/set.c \
130         src/strv.c \
131         src/conf-parser.c \
132         src/socket-util.c \
133         src/log.c \
134         src/ratelimit.c
135
136 COMMON_SOURCES = \
137         $(BASIC_SOURCES) \
138         src/unit.c \
139         src/job.c \
140         src/manager.c \
141         src/load-fragment.c \
142         src/service.c \
143         src/automount.c \
144         src/mount.c \
145         src/swap.c \
146         src/device.c \
147         src/target.c \
148         src/snapshot.c \
149         src/socket.c \
150         src/timer.c \
151         src/load-dropin.c \
152         src/execute.c \
153         src/dbus.c \
154         src/dbus-manager.c \
155         src/dbus-unit.c \
156         src/dbus-job.c \
157         src/dbus-service.c \
158         src/dbus-socket.c \
159         src/dbus-target.c \
160         src/dbus-mount.c \
161         src/dbus-automount.c \
162         src/dbus-swap.c \
163         src/dbus-snapshot.c \
164         src/dbus-device.c \
165         src/dbus-execute.c \
166         src/cgroup.c \
167         src/mount-setup.c \
168         src/hostname-setup.c \
169         src/loopback-setup.c \
170         src/utmp-wtmp.c \
171         src/specifier.c \
172         src/unit-name.c \
173         src/fdset.c \
174         src/namespace.c
175
176 EXTRA_DIST += \
177         ${COMMON_SOURCES:.c=.h} \
178         src/macro.h \
179         src/ioprio.h \
180         src/missing.h \
181         src/list.h \
182         src/securebits.h \
183         src/linux/auto_dev-ioctl.h \
184         src/initreq.h \
185         src/sd-daemon.h
186
187 dist_man_MANS = \
188         man/systemd.unit.5 \
189         man/systemd.service.5
190
191 nodist_man_MANS = \
192         man/systemd.special.7
193
194 dist_noinst_DATA = \
195         man/systemd.unit.html \
196         man/systemd.service.html
197
198 nodist_noinst_DATA = \
199         man/systemd.special.html
200
201 EXTRA_DIST += \
202         man/systemd.unit.xml \
203         man/systemd.service.xml \
204         man/systemd.special.xml.in \
205         man/systemd.special.7.in \
206         man/systemd.special.html.in
207
208 systemd_SOURCES = \
209         $(COMMON_SOURCES) \
210         src/main.c
211
212 systemd_CPPFLAGS = \
213         $(AM_CPPFLAGS) \
214         $(DBUS_CFLAGS) \
215         $(UDEV_CFLAGS) \
216         $(CGROUP_CFLAGS)
217
218 systemd_LDADD = \
219         $(DBUS_LIBS) \
220         $(UDEV_LIBS) \
221         $(CGROUP_LIBS)
222
223 test_engine_SOURCES = \
224         $(COMMON_SOURCES) \
225         src/test-engine.c
226
227 test_engine_CPPFLAGS = $(systemd_CPPFLAGS)
228 test_engine_LDADD = $(systemd_LDADD)
229
230 test_job_type_SOURCES = \
231         $(COMMON_SOURCES) \
232         src/test-engine.c
233
234 test_job_type_CPPFLAGS = $(systemd_CPPFLAGS)
235 test_job_type_LDADD = $(systemd_LDADD)
236
237 test_ns_SOURCES = \
238         $(BASIC_SOURCES) \
239         src/test-ns.c \
240         src/namespace.c
241
242 test_ns_CPPFLAGS = $(systemd_CPPFLAGS)
243 test_ns_LDADD = $(systemd_LDADD)
244
245 test_loopback_SOURCES = \
246         $(BASIC_SOURCES) \
247         src/test-loopback.c \
248         src/loopback-setup.c
249
250 test_loopback_CPPFLAGS = $(systemd_CPPFLAGS)
251 test_loopback_LDADD = $(systemd_LDADD)
252
253 systemd_logger_SOURCES = \
254         $(BASIC_SOURCES) \
255         src/logger.c \
256         src/sd-daemon.c
257
258 systemd_initctl_SOURCES = \
259         $(BASIC_SOURCES) \
260         src/initctl.c \
261         src/sd-daemon.c
262
263 systemd_initctl_CPPFLAGS = \
264         $(AM_CPPFLAGS) \
265         $(DBUS_CFLAGS)
266
267 systemd_initctl_LDADD = \
268         $(DBUS_LIBS)
269
270 systemd_cgroups_agent_SOURCES = \
271         $(BASIC_SOURCES) \
272         src/cgroups-agent.c
273
274 systemd_cgroups_agent_CPPFLAGS = \
275         $(AM_CPPFLAGS) \
276         $(DBUS_CFLAGS)
277
278 systemd_cgroups_agent_LDADD = \
279         $(DBUS_LIBS)
280
281 VALAFLAGS = \
282         -g \
283         --save-temps \
284         --pkg=dbus-glib-1 \
285         --pkg=posix
286
287 if HAVE_GTK
288 VALAFLAGS += \
289         --pkg=gtk+-2.0
290 endif
291
292 VALA_CFLAGS = \
293         -Wno-unused-variable \
294         -Wno-unused-function
295
296 systemctl_SOURCES = \
297         src/systemctl.vala \
298         src/systemd-interfaces.vala
299
300 systemctl_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(VALA_CFLAGS)
301 systemctl_LDADD = $(DBUSGLIB_LIBS)
302
303 systemadm_SOURCES = \
304         src/systemadm.vala \
305         src/systemd-interfaces.vala
306
307 systemadm_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(GTK_CFLAGS) $(VALA_CFLAGS)
308 systemadm_LDADD = $(DBUSGLIB_LIBS) $(GTK_LIBS)
309
310 SED_PROCESS = \
311         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
312         $(SED)  -e 's,@libexecdir\@,$(libexecdir),g' \
313                 -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
314                 -e 's,@SPECIAL_SYSLOG_SERVICE\@,$(SPECIAL_SYSLOG_SERVICE),g' \
315                 < $< > $@
316
317 units/%: units/%.in Makefile
318         $(SED_PROCESS)
319
320 man/%: man/%.in Makefile
321         $(SED_PROCESS)
322
323 M4_PROCESS_SYSTEM = \
324         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
325         $(M4) -P $(M4_DISTRO_FLAG) -DFOR_SYSTEM=1 < $< > $@
326
327 M4_PROCESS_SESSION = \
328         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
329         $(M4) -P $(M4_DISTRO_FLAG) -DFOR_SESSION=1 < $< > $@
330
331 units/%: units/%.m4 Makefile
332         $(M4_PROCESS_SYSTEM)
333
334 units/session/%: units/%.m4 Makefile
335         $(M4_PROCESS_SESSION)
336
337 CLEANFILES = \
338         units/systemd-initctl.service \
339         units/systemd-logger.service \
340         units/syslog.target \
341         units/basic.target \
342         units/getty@.service \
343         units/graphical.target \
344         units/multi-user.target \
345         units/remote-fs.target \
346         units/session/remote-fs.target \
347         man/systemd.special.7 \
348         man/systemd.special.html
349
350 if HAVE_VALAC
351 CLEANFILES += \
352         src/systemd-interfaces.c \
353         src/systemctl.c \
354         src/systemadm.c
355 endif
356
357 if HAVE_XSLTPROC
358 XSLTPROC_PROCESS_MAN = \
359         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
360         $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
361
362 XSLTPROC_PROCESS_MAN_IN = \
363         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
364         $(XSLTPROC) -o ${@:.in=} -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< && \
365         mv ${@:.in=} $@
366
367 XSLTPROC_PROCESS_HTML = \
368         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
369         $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $<
370
371 XSLTPROC_PROCESS_HTML_IN = \
372         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
373         $(XSLTPROC) -o ${@:.in=} -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $< && \
374         mv ${@:.in=} $@
375
376 man/%.5: man/%.xml
377         $(XSLTPROC_PROCESS_MAN)
378
379 man/%.5.in: man/%.xml.in
380         $(XSLTPROC_PROCESS_MAN)
381
382 man/%.7: man/%.xml
383         $(XSLTPROC_PROCESS_MAN)
384
385 man/%.7.in: man/%.xml.in
386         $(XSLTPROC_PROCESS_MAN_IN)
387
388 man/%.html: man/%.xml
389         $(XSLTPROC_PROCESS_HTML)
390
391 man/%.html.in: man/%.xml.in
392         $(XSLTPROC_PROCESS_HTML_IN)
393
394 CLEANFILES += \
395         $(dist_man_MANS) \
396         man/systemd.special.7.in \
397         man/systemd.unit.html \
398         man/systemd.service.html \
399         man/systemd.special.html.in
400 endif
401
402 install-data-hook:
403         $(MKDIR_P) -m 0755 \
404                 $(DESTDIR)$(systemunitdir) \
405                 $(DESTDIR)$(sessionunitdir) \
406                 $(DESTDIR)$(systemunitdir)/sockets.target.wants \
407                 $(DESTDIR)$(pkgsysconfdir)/system \
408                 $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants \
409                 $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants \
410                 $(DESTDIR)$(pkgsysconfdir)/system/graphical.target.wants \
411                 $(DESTDIR)$(pkgsysconfdir)/session \
412                 $(DESTDIR)$(sysconfdir)/xdg/systemd
413         $(MKDIR_P) -m 0755 $(DESTDIR)/cgroup/systemd || \
414                 echo "Don't forget to create /cgroup/systemd! Couldn't create it for you, continuing anyway."
415         ( cd $(DESTDIR)$(sysconfdir)/xdg/systemd/ && \
416                 rm -f session && \
417                 $(LN_S) $(pkgsysconfdir)/session session )
418         ( cd $(DESTDIR)$(systemunitdir)/sockets.target.wants && \
419                 rm -f systemd-initctl.socket systemd-logger.socket && \
420                 $(LN_S) ../systemd-logger.socket systemd-logger.socket && \
421                 $(LN_S) ../systemd-initctl.socket systemd-initctl.socket )
422         ( cd $(DESTDIR)$(sessionunitdir) && \
423                 rm -f shutdown.target sockets.target local-fs.target swap.target && \
424                 $(LN_S) ../system/shutdown.target shutdown.target && \
425                 $(LN_S) ../system/sockets.target sockets.target && \
426                 $(LN_S) ../system/local-fs.target local-fs.target && \
427                 $(LN_S) ../system/swap.target swap.target )
428         ( cd $(DESTDIR)$(systemunitdir) && \
429                 rm -f runlevel0.target runlevel1.target runlevel6.target && \
430                 $(LN_S) poweroff.target runlevel0.target && \
431                 $(LN_S) rescue.target runlevel1.target && \
432                 $(LN_S) reboot.target runlevel6.target )
433         ( cd $(DESTDIR)$(pkgsysconfdir)/system && \
434                 rm -f default.target ctrl-alt-del.target kbrequest.target && \
435                 $(LN_S) $(systemunitdir)/graphical.target default.target && \
436                 $(LN_S) $(systemunitdir)/reboot.target ctrl-alt-del.target && \
437                 $(LN_S) $(systemunitdir)/rescue.target kbrequest.target && \
438                 rm -f runlevel2.target runlevel3.target runlevel4.target runlevel5.target && \
439                 $(LN_S) $(systemunitdir)/multi-user.target runlevel2.target && \
440                 $(LN_S) $(systemunitdir)/multi-user.target runlevel3.target && \
441                 $(LN_S) $(systemunitdir)/multi-user.target runlevel4.target && \
442                 $(LN_S) $(systemunitdir)/graphical.target runlevel5.target )
443         ( cd $(DESTDIR)$(pkgsysconfdir)/system/getty.target.wants && \
444                 rm -f getty@tty1.service getty@tty2.service getty@tty3.service getty@tty4.service getty@tty5.service getty@tty6.service && \
445                 $(LN_S) $(systemunitdir)/getty@.service getty@tty1.service && \
446                 $(LN_S) $(systemunitdir)/getty@.service getty@tty2.service && \
447                 $(LN_S) $(systemunitdir)/getty@.service getty@tty3.service && \
448                 $(LN_S) $(systemunitdir)/getty@.service getty@tty4.service && \
449                 $(LN_S) $(systemunitdir)/getty@.service getty@tty5.service && \
450                 $(LN_S) $(systemunitdir)/getty@.service getty@tty6.service )
451         ( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
452                 rm -f getty.target && \
453                 $(LN_S) $(systemunitdir)/getty.target getty.target )
454 if TARGET_FEDORA
455         ( cd $(DESTDIR)$(pkgsysconfdir)/system/graphical.target.wants && \
456                 rm -f prefdm.service && \
457                 $(LN_S) $(systemunitdir)/prefdm.service prefdm.service )
458         ( cd $(DESTDIR)$(pkgsysconfdir)/system/multi-user.target.wants && \
459                 rm -f rc-local.service && \
460                 $(LN_S) $(systemunitdir)/rc-local.service rc-local.service )
461         ( cd $(DESTDIR)$(systemunitdir) && \
462                 rm -f local.service && \
463                 $(LN_S) rc-local.service local.service )
464 endif
465
466 DISTCHECK_CONFIGURE_FLAGS = \
467         --with-udevrulesdir=$$dc_install_base/$(udevrulesdir)