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