chiark / gitweb /
build-sys: generate intermediate files in subdirs
[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/systemd-initctl.socket \
70         units/systemd-logger.socket
71
72 systemunit_DATA = \
73         units/systemd-initctl.service \
74         units/systemd-logger.service
75
76 EXTRA_DIST = \
77         units/systemd-initctl.service.in \
78         units/systemd-logger.service.in \
79         LICENSE \
80         README
81
82 # This is needed because automake is buggy in how it generates the
83 # rules for C programs, but not Vala programs.  We therefore can't
84 # list the .h files as dependencies if we want make dist to work.
85 BASIC_SOURCES = \
86         src/util.c \
87         src/hashmap.c \
88         src/set.c \
89         src/strv.c \
90         src/conf-parser.c \
91         src/socket-util.c \
92         src/log.c \
93         src/ratelimit.c
94
95 COMMON_SOURCES = \
96         $(BASIC_SOURCES) \
97         src/unit.c \
98         src/job.c \
99         src/manager.c \
100         src/load-fragment.c \
101         src/service.c \
102         src/automount.c \
103         src/mount.c \
104         src/swap.c \
105         src/device.c \
106         src/target.c \
107         src/snapshot.c \
108         src/socket.c \
109         src/timer.c \
110         src/load-dropin.c \
111         src/execute.c \
112         src/dbus.c \
113         src/dbus-manager.c \
114         src/dbus-unit.c \
115         src/dbus-job.c \
116         src/dbus-service.c \
117         src/dbus-socket.c \
118         src/dbus-target.c \
119         src/dbus-mount.c \
120         src/dbus-automount.c \
121         src/dbus-swap.c \
122         src/dbus-snapshot.c \
123         src/dbus-device.c \
124         src/dbus-execute.c \
125         src/cgroup.c \
126         src/mount-setup.c \
127         src/hostname-setup.c \
128         src/loopback-setup.c \
129         src/utmp-wtmp.c \
130         src/specifier.c \
131         src/unit-name.c \
132         src/fdset.c \
133         src/namespace.c
134
135 EXTRA_DIST += \
136         ${COMMON_SOURCES:.c=.h} \
137         src/macro.h \
138         src/ioprio.h \
139         src/missing.h \
140         src/list.h \
141         src/securebits.h \
142         src/linux/auto_dev-ioctl.h \
143         src/initreq.h \
144         src/sd-daemon.h
145
146 dist_man_MANS = \
147         man/systemd.unit.5 \
148         man/systemd.service.5
149
150 HTMLMANS = \
151         man/systemd.unit.html \
152         man/systemd.service.html
153
154 dist_noinst_DATA = \
155         $(HTMLMANS)
156
157 EXTRA_DIST += \
158         man/systemd.unit.xml \
159         man/systemd.service.xml
160
161 systemd_SOURCES = \
162         $(COMMON_SOURCES) \
163         src/main.c
164
165 systemd_CPPFLAGS = \
166         $(AM_CPPFLAGS) \
167         $(DBUS_CFLAGS) \
168         $(UDEV_CFLAGS) \
169         $(CGROUP_CFLAGS)
170
171 systemd_LDADD = \
172         $(DBUS_LIBS) \
173         $(UDEV_LIBS) \
174         $(CGROUP_LIBS)
175
176 test_engine_SOURCES = \
177         $(COMMON_SOURCES) \
178         src/test-engine.c
179
180 test_engine_CPPFLAGS = $(systemd_CPPFLAGS)
181 test_engine_LDADD = $(systemd_LDADD)
182
183 test_job_type_SOURCES = \
184         $(COMMON_SOURCES) \
185         src/test-engine.c
186
187 test_job_type_CPPFLAGS = $(systemd_CPPFLAGS)
188 test_job_type_LDADD = $(systemd_LDADD)
189
190 test_ns_SOURCES = \
191         $(BASIC_SOURCES) \
192         src/test-ns.c \
193         src/namespace.c
194
195 test_ns_CPPFLAGS = $(systemd_CPPFLAGS)
196 test_ns_LDADD = $(systemd_LDADD)
197
198 test_loopback_SOURCES = \
199         $(BASIC_SOURCES) \
200         src/test-loopback.c \
201         src/loopback-setup.c
202
203 test_loopback_CPPFLAGS = $(systemd_CPPFLAGS)
204 test_loopback_LDADD = $(systemd_LDADD)
205
206 systemd_logger_SOURCES = \
207         $(BASIC_SOURCES) \
208         src/logger.c \
209         src/sd-daemon.c
210
211 systemd_initctl_SOURCES = \
212         $(BASIC_SOURCES) \
213         src/initctl.c \
214         src/sd-daemon.c
215
216 systemd_initctl_CPPFLAGS = \
217         $(AM_CPPFLAGS) \
218         $(DBUS_CFLAGS)
219
220 systemd_initctl_LDADD = \
221         $(DBUS_LIBS)
222
223 systemd_cgroups_agent_SOURCES = \
224         $(BASIC_SOURCES) \
225         src/cgroups-agent.c
226
227 systemd_cgroups_agent_CPPFLAGS = \
228         $(AM_CPPFLAGS) \
229         $(DBUS_CFLAGS)
230
231 systemd_cgroups_agent_LDADD = \
232         $(DBUS_LIBS)
233
234 VALAFLAGS = \
235         -g \
236         --save-temps \
237         --pkg=dbus-glib-1 \
238         --pkg=posix
239
240 if HAVE_GTK
241 VALAFLAGS += \
242         --pkg=gtk+-2.0
243 endif
244
245 VALA_CFLAGS = \
246         -Wno-unused-variable \
247         -Wno-unused-function
248
249 systemctl_SOURCES = \
250         src/systemctl.vala \
251         src/systemd-interfaces.vala
252
253 systemctl_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(VALA_CFLAGS)
254 systemctl_LDADD = $(DBUSGLIB_LIBS)
255
256 systemadm_SOURCES = \
257         src/systemadm.vala \
258         src/systemd-interfaces.vala
259
260 systemadm_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(GTK_CFLAGS) $(VALA_CFLAGS)
261 systemadm_LDADD = $(DBUSGLIB_LIBS) $(GTK_LIBS)
262
263 units/systemd-initctl.service: units/systemd-initctl.service.in Makefile
264         $(MKDIR_P) units
265         $(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
266                 -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
267                 < $< > $@
268
269 units/systemd-logger.service: units/systemd-logger.service.in Makefile
270         $(MKDIR_P) units
271         $(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
272                 -e 's,@pkglibexecdir\@,$(pkglibexecdir),g' \
273                 < $< > $@
274
275 CLEANFILES = \
276         src/systemd-interfaces.c \
277         src/systemctl.c \
278         src/systemadm.c \
279         units/systemd-initctl.service \
280         units/systemd-logger.service
281
282 if HAVE_XSLTPROC
283 man/%.5: man/%.xml
284         $(MKDIR_P) man
285         $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
286
287 man/%.html: man/%.xml
288         $(MKDIR_P) man
289         $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $<
290
291 CLEANFILES += \
292         $(dist_man_MANS) \
293         $(HTMLMANS)
294 endif
295
296 install-data-hook:
297         $(MKDIR_P) -m 0755 \
298                 $(DESTDIR)$(systemunitdir) \
299                 $(DESTDIR)$(sessionunitdir) \
300                 $(DESTDIR)$(pkgsysconfdir)/system \
301                 $(DESTDIR)$(pkgsysconfdir)/session \
302                 $(DESTDIR)$(sysconfdir)/xdg/systemd \
303                 $(DESTDIR)/cgroup/debug
304         ( cd $(DESTDIR)$(sysconfdir)/xdg/systemd/ && \
305                 rm -f session && \
306                 $(LN_S) $(DESTDIR)$(pkgsysconfdir)/session session )
307
308 DISTCHECK_CONFIGURE_FLAGS = \
309         --with-udevrulesdir=$$dc_install_base/$(udevrulesdir)