1
2configdir=$(sysconfdir)/dbus-1
3
4INCLUDES=-I$(top_srcdir) $(DBUS_BUS_CFLAGS) @PIE_CFLAGS@		\
5	-DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\"	\
6	-DDBUS_COMPILATION
7
8EFENCE=
9
10CONFIG_IN_FILES=				\
11	session.conf.in				\
12	system.conf.in
13
14config_DATA=					\
15	session.conf				\
16	system.conf
17
18if DBUS_USE_LIBXML
19XML_SOURCES=config-loader-libxml.c
20endif
21if DBUS_USE_EXPAT
22XML_SOURCES=config-loader-expat.c
23endif
24
25if DBUS_BUS_ENABLE_KQUEUE
26DIR_WATCH_SOURCE=dir-watch-kqueue.c
27else
28if DBUS_BUS_ENABLE_INOTIFY
29DIR_WATCH_SOURCE=dir-watch-inotify.c
30else
31if DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
32DIR_WATCH_SOURCE=dir-watch-dnotify.c
33else
34DIR_WATCH_SOURCE=dir-watch-default.c
35endif
36endif
37endif
38
39BUS_SOURCES=					\
40	activation.c				\
41	activation.h				\
42	activation-exit-codes.h			\
43	bus.c					\
44	bus.h					\
45	config-parser.c				\
46	config-parser.h				\
47	config-parser-common.c			\
48	config-parser-common.h			\
49	connection.c				\
50	connection.h				\
51	desktop-file.c				\
52	desktop-file.h				\
53	$(DIR_WATCH_SOURCE)			\
54	dir-watch.h				\
55	dispatch.c				\
56	dispatch.h				\
57	driver.c				\
58	driver.h				\
59	expirelist.c				\
60	expirelist.h				\
61	policy.c				\
62	policy.h				\
63	selinux.h				\
64	selinux.c				\
65	services.c				\
66	services.h				\
67	signals.c				\
68	signals.h				\
69	test.c					\
70	test.h					\
71	utils.c					\
72	utils.h					\
73	$(XML_SOURCES)
74
75dbus_daemon_SOURCES=				\
76	$(BUS_SOURCES)				\
77	main.c
78
79dbus_daemon_CPPFLAGS = -DDBUS_STATIC_BUILD
80dbus_daemon_LDADD=					\
81	$(top_builddir)/dbus/libdbus-internal.la	\
82	$(EFENCE)					\
83	$(DBUS_BUS_LIBS)
84
85dbus_daemon_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ @PIE_LDFLAGS@
86
87LAUNCH_HELPER_SOURCES=				\
88	$(XML_SOURCES)				\
89	config-parser-common.c			\
90	config-parser-common.h			\
91	config-parser-trivial.c			\
92	config-parser-trivial.h			\
93	desktop-file.c				\
94	desktop-file.h				\
95	utils.c					\
96	utils.h					\
97	activation-exit-codes.h			\
98	activation-helper.h	  		\
99	activation-helper.c
100
101## This is the installed launch helper with the setuid checks
102dbus_daemon_launch_helper_SOURCES=		\
103	activation-helper-bin.c			\
104	$(LAUNCH_HELPER_SOURCES)
105
106dbus_daemon_launch_helper_CPPFLAGS = -DDBUS_STATIC_BUILD
107dbus_daemon_launch_helper_LDADD=		\
108	$(top_builddir)/dbus/libdbus-internal.la \
109	$(DBUS_LAUNCHER_LIBS)
110
111dbus_daemon_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
112
113## we build another binary so we can do the launch testing without root privs.
114## DO NOT INSTALL THIS FILE
115dbus_daemon_launch_helper_test_SOURCES=		\
116	activation-helper-bin.c			\
117	$(LAUNCH_HELPER_SOURCES)
118
119dbus_daemon_launch_helper_test_LDADD=		\
120	$(top_builddir)/dbus/libdbus-internal.la \
121	$(DBUS_LAUNCHER_LIBS)
122
123dbus_daemon_launch_helper_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
124dbus_daemon_launch_helper_test_CPPFLAGS= -DDBUS_STATIC_BUILD	\
125	-DACTIVATION_LAUNCHER_TEST
126
127## we build yet another binary so we can do the OOM tests
128## DO NOT INSTALL THIS FILE
129bus_test_launch_helper_SOURCES=		\
130	test-launch-helper.c   		\
131	$(LAUNCH_HELPER_SOURCES)
132
133bus_test_launch_helper_LDADD=		\
134	$(top_builddir)/dbus/libdbus-internal.la \
135	$(DBUS_LAUNCHER_LIBS)
136
137bus_test_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
138bus_test_launch_helper_CPPFLAGS= -DDBUS_STATIC_BUILD	\
139	-DACTIVATION_LAUNCHER_TEST	\
140	-DACTIVATION_LAUNCHER_DO_OOM
141
142extra_tests=
143extra_noinst_programs=
144extra_inst_programs=
145if DBUS_UNIX
146extra_tests+=bus-test-launch-helper
147extra_noinst_programs+=dbus-daemon-launch-helper dbus-daemon-launch-helper-test dbus-daemon
148endif
149if DBUS_WIN
150extra_inst_programs+=dbus-daemon
151endif
152
153## note that TESTS has special meaning (stuff to use in make check)
154## so if adding tests not to be run in make check, don't add them to
155## TESTS
156if DBUS_BUILD_TESTS
157TESTS_ENVIRONMENT=DBUS_TEST_DATA=$(top_builddir)/test/data DBUS_TEST_HOMEDIR=$(top_builddir)/dbus DBUS_FATAL_WARNINGS=1 DBUS_BLOCK_ON_ABORT=1
158TESTS=bus-test bus-test-system $(extra_tests)
159else
160TESTS=
161endif
162
163## we use noinst_PROGRAMS not check_PROGRAMS so that we build
164## even when not doing "make check"
165noinst_PROGRAMS=$(TESTS) $(extra_noinst_programs)
166bin_PROGRAMS=$(extra_inst_programs)
167
168bus_test_system_SOURCES=			\
169	$(XML_SOURCES)				\
170	config-parser-common.c			\
171	config-parser-common.h			\
172	config-parser-trivial.c			\
173	config-parser-trivial.h			\
174	utils.c					\
175	utils.h					\
176	test-system.c
177
178bus_test_system_CPPFLAGS = -DDBUS_STATIC_BUILD
179bus_test_system_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_BUS_LIBS)
180bus_test_system_LDFLAGS=@R_DYNAMIC_LDFLAG@
181
182bus_test_SOURCES=				\
183	$(BUS_SOURCES)				\
184	test-main.c
185
186bus_test_CPPFLAGS = -DDBUS_STATIC_BUILD
187bus_test_LDADD=$(top_builddir)/dbus/libdbus-internal.la $(DBUS_BUS_LIBS)
188bus_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
189
190## mop up the gcov files
191clean-local:
192	/bin/rm *.bb *.bbg *.da *.gcov || true
193
194uninstall-hook:
195	rm -f $(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT)
196	rm -f $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper$(EXEEXT)
197
198install-data-hook:
199	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
200	$(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
201	$(mkinstalldirs) $(DESTDIR)$(configdir)/session.d
202	$(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services
203	$(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/system-services
204if DBUS_UNIX
205	if test '!' -d $(DESTDIR)$(DBUS_DAEMONDIR); then \
206		$(mkinstalldirs) $(DESTDIR)$(DBUS_DAEMONDIR); \
207		chmod 755 $(DESTDIR)$(DBUS_DAEMONDIR); \
208	fi
209	$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) dbus-daemon$(EXEEXT) $(DESTDIR)$(DBUS_DAEMONDIR)
210	$(mkinstalldirs) $(DESTDIR)$(libexecdir)/dbus-1
211	if test -f dbus-daemon-launch-helper$(EXEEXT) ; then \
212	$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) dbus-daemon-launch-helper$(EXEEXT) $(DESTDIR)$(libexecdir); \
213	if test `id -u` -eq 0; then \
214		chown root:$(DBUS_USER) $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper$(EXEEXT); \
215		chmod 4750 $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper$(EXEEXT); \
216	else \
217		echo "Not installing $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper binary setuid!"; \
218		echo "You'll need to manually set permissions to root:$(DBUS_USER) and permissions 4750"; \
219	fi \
220	fi
221endif
222if HAVE_SYSTEMD
223# Install dbus.socket as default implementation of a D-Bus stack
224	$(mkinstalldirs) $(DESTDIR)$(systemdsystemunitdir)/dbus.target.wants
225	$(LN_S) ../dbus.socket $(DESTDIR)$(systemdsystemunitdir)/dbus.target.wants/dbus.socket
226# Unconditionally enable D-Bus on systemd installations
227	$(mkinstalldirs) $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants
228	$(LN_S) ../dbus.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/dbus.socket
229	$(mkinstalldirs) $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants
230	$(LN_S) ../dbus.service $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants/dbus.service
231endif
232
233#### Init scripts fun
234SCRIPT_IN_FILES=messagebus.in \
235		messagebus-config.in \
236		rc.messagebus.in
237
238## Red Hat start
239if DBUS_INIT_SCRIPTS_RED_HAT
240
241initddir=$(sysconfdir)/rc.d/init.d
242
243initd_SCRIPTS= 	\
244	messagebus
245
246endif
247 ## Red Hat end
248
249## Slackware start
250if DBUS_INIT_SCRIPTS_SLACKWARE
251
252initddir=$(sysconfdir)/rc.d/
253
254initd_SCRIPTS= 	\
255	rc.messagebus
256
257endif
258## Slackware end
259
260## Cygwin start
261if DBUS_INIT_SCRIPTS_CYGWIN
262
263bin_SCRIPTS= 	\
264	messagebus-config
265
266endif
267## Cygwin end
268
269if HAVE_SYSTEMD
270SCRIPT_IN_FILES += \
271	dbus.service.in \
272	dbus.socket.in
273
274systemdsystemunit_DATA = \
275	dbus.service \
276	dbus.socket
277endif
278
279MAN_IN_FILES=dbus-daemon.1.in
280man_MANS = dbus-daemon.1
281
282#### Extra dist
283
284EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) $(man_MANS) $(MAN_IN_FILES)
285