1dbusdatadir=$(datadir)/dbus-1
2legacydbusdatadir=$(sysconfdir)/dbus-1
3dbus_daemon_execdir = $(DBUS_DAEMONDIR)
4# Always lib, even if ${libdir} is lib64 or lib/x86_64-linux-gnu
5systemdtmpfilesdir = $(prefix)/lib/tmpfiles.d
6systemdsysusersdir = $(prefix)/lib/sysusers.d
7
8DBUS_BUS_LIBS = \
9	$(CODE_COVERAGE_LIBS) \
10	$(EXPAT_LIBS) \
11	$(SELINUX_LIBS) \
12	$(APPARMOR_LIBS) \
13	$(THREAD_LIBS) \
14	$(ADT_LIBS) \
15	$(NETWORK_libs) \
16	$(NULL)
17
18DBUS_LAUNCHER_LIBS = \
19	$(CODE_COVERAGE_LIBS) \
20	$(EXPAT_LIBS) \
21	$(THREAD_LIBS) \
22	$(NETWORK_libs) \
23	$(NULL)
24
25AM_CPPFLAGS = \
26	$(CODE_COVERAGE_CPPFLAGS) \
27	-I$(top_srcdir) \
28	$(DBUS_STATIC_BUILD_CPPFLAGS) \
29	$(EXPAT_CFLAGS) \
30	$(APPARMOR_CFLAGS) \
31	-DDBUS_SYSTEM_CONFIG_FILE=\""$(dbusdatadir)/system.conf"\" \
32	-DDBUS_COMPILATION \
33	$(NULL)
34
35# if assertions are enabled, improve backtraces
36AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
37
38AM_CFLAGS = \
39	$(CODE_COVERAGE_CFLAGS) \
40	$(NULL)
41
42EFENCE=
43
44EXTRA_DIST =					\
45	session.conf.in				\
46	system.conf.in				\
47	legacy-config/session.conf.in		\
48	legacy-config/system.conf.in		\
49	org.freedesktop.dbus-session.plist.in	\
50	example-system-enable-stats.conf.in	\
51	example-session-disable-stats.conf.in	\
52	$(NULL)
53
54dbusdata_DATA = session.conf
55legacydbusdata_DATA = legacy-config/session.conf
56
57if DBUS_UNIX
58dbusdata_DATA += system.conf
59legacydbusdata_DATA += legacy-config/system.conf
60endif
61
62examplesdir = ${docdir}/examples
63examples_DATA = \
64	example-system-enable-stats.conf	\
65	example-session-disable-stats.conf	\
66	$(NULL)
67
68if DBUS_ENABLE_LAUNCHD
69agentdir=$(LAUNCHD_AGENT_DIR)
70agent_DATA=org.freedesktop.dbus-session.plist
71endif
72
73if DBUS_BUS_ENABLE_KQUEUE
74DIR_WATCH_SOURCE=dir-watch-kqueue.c
75else
76if DBUS_BUS_ENABLE_INOTIFY
77DIR_WATCH_SOURCE=dir-watch-inotify.c
78else
79DIR_WATCH_SOURCE=dir-watch-default.c
80endif
81endif
82
83BUS_SOURCES=					\
84	activation.c				\
85	activation.h				\
86	activation-exit-codes.h			\
87	apparmor.c				\
88	apparmor.h				\
89	audit.c					\
90	audit.h					\
91	bus.c					\
92	bus.h					\
93	config-loader-expat.c			\
94	config-parser.c				\
95	config-parser.h				\
96	config-parser-common.c			\
97	config-parser-common.h			\
98	connection.c				\
99	connection.h				\
100	desktop-file.c				\
101	desktop-file.h				\
102	$(DIR_WATCH_SOURCE)			\
103	dir-watch.h				\
104	dispatch.c				\
105	dispatch.h				\
106	driver.c				\
107	driver.h				\
108	expirelist.c				\
109	expirelist.h				\
110	policy.c				\
111	policy.h				\
112	selinux.h				\
113	selinux.c				\
114	services.c				\
115	services.h				\
116	signals.c				\
117	signals.h				\
118	stats.c					\
119	stats.h					\
120	test.c					\
121	test.h					\
122	utils.c					\
123	utils.h					\
124	$(NULL)
125
126dbus_daemon_SOURCES=				\
127	$(BUS_SOURCES)				\
128	main.c
129
130dbus_daemon_LDADD=					\
131	$(top_builddir)/dbus/libdbus-1.la	\
132	$(top_builddir)/dbus/libdbus-internal.la	\
133	$(EFENCE)					\
134	$(DBUS_BUS_LIBS)
135
136LAUNCH_HELPER_SOURCES=				\
137	config-loader-expat.c			\
138	config-parser-common.c			\
139	config-parser-common.h			\
140	config-parser-trivial.c			\
141	config-parser-trivial.h			\
142	desktop-file.c				\
143	desktop-file.h				\
144	utils.c					\
145	utils.h					\
146	activation-exit-codes.h			\
147	activation-helper.h	  		\
148	activation-helper.c
149
150## This is the installed launch helper with the setuid checks
151dbus_daemon_launch_helper_SOURCES=		\
152	activation-helper-bin.c			\
153	$(LAUNCH_HELPER_SOURCES)
154
155dbus_daemon_launch_helper_LDADD=		\
156	$(top_builddir)/dbus/libdbus-1.la \
157	$(top_builddir)/dbus/libdbus-internal.la	\
158	$(DBUS_LAUNCHER_LIBS)
159
160## we build another binary so we can do the launch testing without root privs.
161## DO NOT INSTALL THIS FILE
162dbus_daemon_launch_helper_test_SOURCES=		\
163	activation-helper-bin.c			\
164	$(LAUNCH_HELPER_SOURCES)
165
166dbus_daemon_launch_helper_test_LDADD=		\
167	$(top_builddir)/dbus/libdbus-1.la \
168	$(top_builddir)/dbus/libdbus-internal.la \
169	$(DBUS_LAUNCHER_LIBS)
170
171dbus_daemon_launch_helper_test_CPPFLAGS = \
172	$(AM_CPPFLAGS) \
173	-DACTIVATION_LAUNCHER_TEST
174
175## we build yet another binary so we can do the OOM tests
176## DO NOT INSTALL THIS FILE
177test_bus_launch_helper_SOURCES=		\
178	test-launch-helper.c   		\
179	$(LAUNCH_HELPER_SOURCES)
180
181test_bus_launch_helper_LDADD=		\
182	$(top_builddir)/dbus/libdbus-1.la \
183	$(top_builddir)/dbus/libdbus-internal.la \
184	$(DBUS_LAUNCHER_LIBS)
185	$(NULL)
186
187test_bus_launch_helper_CPPFLAGS = \
188	$(AM_CPPFLAGS) \
189	-DACTIVATION_LAUNCHER_TEST	\
190	-DACTIVATION_LAUNCHER_DO_OOM
191
192noinst_PROGRAMS =
193dbus_daemon_exec_PROGRAMS = dbus-daemon
194if DBUS_UNIX
195libexec_PROGRAMS = dbus-daemon-launch-helper
196endif DBUS_UNIX
197
198## Note that TESTS has special meaning (stuff to use in make check).
199## We don't actually want to run any of these tests until test/ has been
200## compiled, so we don't put them in TESTS here; we run them in test/
201## instead.
202
203if DBUS_ENABLE_EMBEDDED_TESTS
204## we use noinst_PROGRAMS not check_PROGRAMS so that we build
205## even when not doing "make check"
206
207# run as a test by test/Makefile.am
208noinst_PROGRAMS += test-bus
209
210if DBUS_UNIX
211# run as a test by test/Makefile.am
212noinst_PROGRAMS += test-bus-launch-helper test-bus-system
213# this is used by the tests but is not,itself, a test
214noinst_PROGRAMS += dbus-daemon-launch-helper-test
215endif DBUS_UNIX
216
217endif DBUS_ENABLE_EMBEDDED_TESTS
218
219test_bus_system_SOURCES=			\
220	config-loader-expat.c			\
221	config-parser-common.c			\
222	config-parser-common.h			\
223	config-parser-trivial.c			\
224	config-parser-trivial.h			\
225	utils.c					\
226	utils.h					\
227	test-system.c
228
229test_bus_system_LDADD = \
230	$(top_builddir)/dbus/libdbus-1.la \
231	$(top_builddir)/dbus/libdbus-internal.la \
232	$(DBUS_BUS_LIBS) \
233	$(NULL)
234
235test_bus_SOURCES=				\
236	$(BUS_SOURCES)				\
237	test-main.c
238
239test_bus_LDADD = \
240	$(top_builddir)/dbus/libdbus-1.la \
241	$(top_builddir)/dbus/libdbus-internal.la \
242	$(DBUS_BUS_LIBS) \
243	$(NULL)
244
245install-data-hook:
246	$(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/session.d
247	$(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/services
248if DBUS_UNIX
249	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
250	$(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/system.d
251	$(mkinstalldirs) $(DESTDIR)$(dbusdatadir)/system-services
252endif
253if HAVE_SYSTEMD
254# Install dbus.socket as default implementation of a D-Bus stack.
255# Deliberately not using $(LN_S) here: ln -fs is not universally portable,
256# but neither is systemd, so it's OK to assume here that ln complies with SUS.
257# Unconditionally enable D-Bus on systemd installations
258	$(mkinstalldirs) $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants
259	ln -fs ../dbus.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/dbus.socket
260	$(mkinstalldirs) $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants
261	ln -fs ../dbus.service $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants/dbus.service
262endif
263if DBUS_ENABLE_USER_SESSION
264	$(mkinstalldirs) $(DESTDIR)$(systemduserunitdir)/sockets.target.wants
265	ln -fs ../dbus.socket $(DESTDIR)$(systemduserunitdir)/sockets.target.wants/dbus.socket
266endif
267
268if DBUS_UNIX
269install-exec-hook:
270	if test `id -u` -eq 0; then \
271		chown root:$(DBUS_USER) $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper$(EXEEXT); \
272		chmod 4750 $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper$(EXEEXT); \
273	else \
274		echo "Not installing $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper binary setuid!"; \
275		echo "You'll need to manually set permissions to root:$(DBUS_USER) and permissions 4750"; \
276	fi
277endif
278
279EXTRA_DIST += \
280	dbus.service.in \
281	dbus.socket.in \
282	systemd-user/dbus.service.in \
283	systemd-user/dbus.socket.in \
284	sysusers.d/dbus.conf.in \
285	tmpfiles.d/dbus.conf.in \
286	$(NULL)
287
288if HAVE_SYSTEMD
289systemdsystemunit_DATA = \
290	dbus.service \
291	dbus.socket
292
293nodist_systemdsysusers_DATA = \
294	sysusers.d/dbus.conf
295
296nodist_systemdtmpfiles_DATA = \
297	tmpfiles.d/dbus.conf \
298	$(NULL)
299endif
300
301if DBUS_ENABLE_USER_SESSION
302systemduserunit_DATA = \
303	systemd-user/dbus.service \
304	systemd-user/dbus.socket \
305	$(NULL)
306endif
307
308# Add rules for code-coverage testing, as defined by AX_CODE_COVERAGE
309include $(top_srcdir)/aminclude_static.am
310