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