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