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