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