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