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