[lib-opt] library optimalization and clean-up
[platform/upstream/dbus.git] / dbus / Makefile.am
1
2 configdir=$(sysconfdir)/dbus-1
3
4 AM_CPPFLAGS = \
5         -I$(top_builddir) \
6         -I$(top_srcdir) \
7         $(SYSTEMD_CFLAGS) \
8         $(VALGRIND_CFLAGS) \
9         -DDBUS_COMPILATION \
10         -DDBUS_MACHINE_UUID_FILE=\""$(localstatedir)/lib/dbus/machine-id"\" \
11         -DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\" \
12         -DDBUS_SESSION_CONFIG_FILE=\""$(configdir)/session.conf"\" \
13         $(NULL)
14
15 # On Linux with glibc 2.17, sd-daemon.c support for POSIX message queues
16 # results in an otherwise unnecessary dependency on librt. Disable it.
17 AM_CPPFLAGS += -DSD_DAEMON_DISABLE_MQ
18
19 # if assertions are enabled, improve backtraces
20 AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
21
22 dbusincludedir=$(includedir)/dbus-1.0/dbus
23 dbusarchincludedir=$(libdir)/dbus-1.0/include/dbus
24
25 lib_LTLIBRARIES=libdbus-1.la
26
27 #
28 # Deal with W32 .def and version-info.rc stuff
29 #
30 if DBUS_WIN
31
32 SUFFIXES = rc
33
34 .rc.o:
35         $(WINDRES) $< -o $@
36
37 dbus_res = versioninfo.o
38 dbus_res_ldflag = -Wl,$(dbus_res)
39 no_undefined = -no-undefined
40 export_symbols =
41
42 EXTRA_libdbus_1_la_DEPENDENCIES = $(dbus_res)
43 intllibs =
44
45 else
46 dbus_res =
47 dbus_res_ldflag =
48 no_undefined =
49 ## don't export symbols that start with "_" (we use this
50 ## convention for internal symbols)
51 export_symbols = -export-symbols-regex "^[^_].*"
52
53 intllibs = @LTLIBINTL@
54
55 endif
56
57
58 #
59 # Platform-dependent sources:
60 #
61 if DBUS_WIN
62 DBUS_LIB_arch_sources =                         \
63         dbus-server-win.c                       \
64         dbus-server-win.h
65
66 if DBUS_WINCE
67 wince_source = dbus-sysdeps-wince-glue.h dbus-sysdeps-wince-glue.c
68 else
69 wince_source =
70 endif
71
72 DBUS_SHARED_arch_sources =                      \
73         $(wince_source)                         \
74         dbus-file-win.c                         \
75         dbus-pipe-win.c                         \
76         dbus-sockets-win.h                      \
77         dbus-sysdeps-win.c                      \
78         dbus-sysdeps-win.h                      \
79         dbus-sysdeps-thread-win.c               \
80         dbus-transport-win.c                    \
81         dbus-transport-win.h
82
83 DBUS_UTIL_arch_sources =                        \
84         dbus-sysdeps-util-win.c                 \
85         dbus-spawn-win.c
86 else
87
88 if DBUS_ENABLE_LAUNCHD
89 launchd_source = dbus-server-launchd.h dbus-server-launchd.c
90 else
91 launchd_source =
92 endif
93
94 DBUS_LIB_arch_sources =                         \
95         dbus-uuidgen.c                          \
96         dbus-uuidgen.h                          \
97         dbus-server-unix.c                      \
98         dbus-server-unix.h
99
100 DBUS_SHARED_arch_sources =                      \
101         $(launchd_source)                       \
102         dbus-file-unix.c                        \
103         dbus-pipe-unix.c                        \
104         dbus-sysdeps-unix.c                     \
105         dbus-sysdeps-unix.h                     \
106         dbus-sysdeps-pthread.c                  \
107         dbus-transport-unix.c                   \
108         dbus-transport-unix.h                   \
109         dbus-userdb.c                           \
110         dbus-userdb.h                           \
111         sd-daemon.c                             \
112         sd-daemon.h
113
114 if ENABLE_KDBUS_TRANSPORT
115 DBUS_SHARED_arch_sources += \
116     dbus-transport-kdbus.c  \
117     dbus-transport-kdbus.h  \
118     kdbus-common.c          \
119     kdbus-common.h
120 endif
121
122 DBUS_UTIL_arch_sources =                        \
123         dbus-sysdeps-util-unix.c                \
124         dbus-userdb-util.c                      \
125         dbus-spawn.c
126 endif
127
128 if HAVE_LINUX_EPOLL
129 DBUS_UTIL_arch_sources += dbus-socket-set-epoll.c
130 endif
131
132 dbusinclude_HEADERS=                            \
133         dbus.h                                  \
134         dbus-address.h                          \
135         dbus-bus.h                              \
136         dbus-connection.h                       \
137         dbus-errors.h                           \
138         dbus-macros.h                           \
139         dbus-memory.h                           \
140         dbus-message.h                          \
141         dbus-misc.h                             \
142         dbus-pending-call.h                     \
143         dbus-protocol.h                         \
144         dbus-server.h                           \
145         dbus-shared.h                           \
146         dbus-signature.h                        \
147         dbus-syntax.h                           \
148         dbus-threads.h                          \
149         dbus-types.h
150
151
152 nodist_dbusarchinclude_HEADERS=                 \
153         dbus-arch-deps.h
154
155 ### source code that goes in the installed client library
156 ### and is specific to library functionality
157 DBUS_LIB_SOURCES=                               \
158         dbus-address.c                          \
159         dbus-auth.c                             \
160         dbus-auth.h                             \
161         dbus-bus.c                              \
162         dbus-connection.c                       \
163         dbus-connection-internal.h              \
164         dbus-credentials.c                      \
165         dbus-credentials.h                      \
166         dbus-errors.c                           \
167         dbus-keyring.c                          \
168         dbus-keyring.h                          \
169         dbus-marshal-header.c                   \
170         dbus-marshal-header.h                   \
171         dbus-marshal-byteswap.c                 \
172         dbus-marshal-byteswap.h                 \
173         dbus-marshal-recursive.c                \
174         dbus-marshal-recursive.h                \
175         dbus-marshal-validate.c                 \
176         dbus-marshal-validate.h                 \
177         dbus-message.c                          \
178         dbus-message-internal.h                 \
179         dbus-message-private.h                  \
180         dbus-misc.c                             \
181         dbus-nonce.h                            \
182         dbus-nonce.c                            \
183         dbus-object-tree.c                      \
184         dbus-object-tree.h                      \
185         dbus-pending-call.c                     \
186         dbus-pending-call-internal.h            \
187         dbus-resources.c                        \
188         dbus-resources.h                        \
189         dbus-server.c                           \
190         dbus-server-debug-pipe.c                \
191         dbus-server-debug-pipe.h                \
192         dbus-server-protected.h                 \
193         dbus-server-socket.c                    \
194         dbus-server-socket.h                    \
195         $(DBUS_LIB_arch_sources)                \
196         dbus-sha.c                              \
197         dbus-sha.h                              \
198         dbus-signature.c                        \
199         dbus-syntax.c                           \
200         dbus-timeout.c                          \
201         dbus-timeout.h                          \
202         dbus-threads-internal.h                 \
203         dbus-threads.c                          \
204         dbus-transport.c                        \
205         dbus-transport.h                        \
206         dbus-transport-protected.h              \
207         dbus-transport-socket.c                 \
208         dbus-transport-socket.h                 \
209         dbus-watch.c                            \
210         dbus-watch.h
211
212 ### source code that goes in the installed client library
213 ### AND is generic utility functionality used by the
214 ### daemon or test programs (all symbols in here should
215 ### be underscore-prefixed)
216 DBUS_SHARED_SOURCES=                            \
217         dbus-dataslot.c                         \
218         dbus-dataslot.h                         \
219         dbus-file.c                 \
220         dbus-file.h                 \
221         dbus-hash.c                             \
222         dbus-hash.h                             \
223         dbus-internals.c                        \
224         dbus-internals.h                        \
225         dbus-list.c                             \
226         dbus-list.h                             \
227         dbus-marshal-basic.c                    \
228         dbus-marshal-basic.h                    \
229         dbus-memory.c                           \
230         dbus-mempool.c                          \
231         dbus-mempool.h                          \
232         dbus-pipe.c                 \
233         dbus-pipe.h                 \
234         dbus-string.c                           \
235         dbus-string.h                           \
236         dbus-string-private.h                   \
237         $(DBUS_SHARED_arch_sources)             \
238         dbus-sysdeps.c                          \
239         dbus-sysdeps.h                          \
240         dbus-valgrind-internal.h
241
242 ### source code that is generic utility functionality used
243 ### by the bus daemon or test apps, but is NOT included
244 ### in the D-Bus client library (all symbols in here
245 ### should be underscore-prefixed but don't really need
246 ### to be unless they move to DBUS_SHARED_SOURCES later)
247 DBUS_UTIL_SOURCES=                              \
248         dbus-asv-util.c                         \
249         dbus-asv-util.h                         \
250         dbus-auth-script.c                      \
251         dbus-auth-script.h                      \
252         dbus-auth-util.c                        \
253         dbus-credentials-util.c                 \
254         dbus-mainloop.c                         \
255         dbus-mainloop.h                         \
256         dbus-marshal-byteswap-util.c            \
257         dbus-marshal-recursive-util.c           \
258         dbus-marshal-validate-util.c            \
259         dbus-message-factory.c                  \
260         dbus-message-factory.h                  \
261         dbus-message-util.c                     \
262         dbus-shell.c                            \
263         dbus-shell.h                            \
264         $(DBUS_UTIL_arch_sources)               \
265         dbus-socket-set.h                       \
266         dbus-socket-set.c                       \
267         dbus-socket-set-poll.c                  \
268         dbus-spawn.h                            \
269         dbus-string-util.c                      \
270         dbus-sysdeps-util.c                     \
271         dbus-test.c                             \
272         dbus-test.h
273
274 libdbus_1_la_SOURCES=                           \
275         $(DBUS_LIB_SOURCES)                     \
276         $(DBUS_SHARED_SOURCES)
277
278 libdbus_internal_la_SOURCES=                    \
279         $(DBUS_LIB_SOURCES)                     \
280         $(DBUS_SHARED_SOURCES)                  \
281         $(DBUS_UTIL_SOURCES)
282
283 BUILT_SOURCES=$(nodist_dbusarchinclude_HEADERS)
284 EXTRA_DIST=dbus-arch-deps.h.in
285
286 ## this library is the same as libdbus, but exports all the symbols
287 ## and is only used for static linking within the dbus package.
288 noinst_LTLIBRARIES=libdbus-internal.la
289
290 libdbus_1_la_CPPFLAGS = \
291         $(AM_CPPFLAGS) \
292         -Ddbus_1_EXPORTS \
293         $(NULL)
294 libdbus_1_la_LIBADD= $(LIBDBUS_LIBS)
295 libdbus_1_la_LDFLAGS = \
296         $(AM_LDFLAGS) \
297         $(export_symbols) \
298         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
299         -no-undefined \
300         $(NULL)
301
302 libdbus_internal_la_CPPFLAGS = \
303         $(AM_CPPFLAGS) \
304         -DDBUS_STATIC_BUILD \
305         $(NULL)
306 libdbus_internal_la_LIBADD=$(LIBDBUS_LIBS) $(SYSTEMD_LIBS)
307
308 if DBUS_WIN
309 # This must be a separate convenience library, otherwise libtool notices
310 # that libdbus-1 might contain C++, links it with g++ and links in libstdc++,
311 # even on Unix where in fact it doesn't contain any C++. For Windows, where
312 # this code is used, we don't actually need libstdc++.
313 noinst_LTLIBRARIES += libdbus-init-win.la
314 libdbus_init_win_la_SOURCES = dbus-init-win.cpp
315 libdbus_1_la_LIBADD += libdbus-init-win.la
316 libdbus_internal_la_LIBADD += libdbus-init-win.la
317 endif
318
319 noinst_PROGRAMS =
320
321 if DBUS_ENABLE_EMBEDDED_TESTS
322 # We can't actually run this til we've reached test/
323 noinst_PROGRAMS += dbus-test
324 endif
325
326 dbus_test_SOURCES=                              \
327         dbus-test-main.c
328
329 dbus_test_LDADD = libdbus-internal.la
330
331 ## mop up the gcov files
332 clean-local:
333         /bin/rm *.bb *.bbg *.da *.gcov .libs/*.da .libs/*.bbg || true
334
335 update-systemd:
336         curl http://cgit.freedesktop.org/systemd/systemd/plain/src/libsystemd-daemon/sd-daemon.c > $(srcdir)/sd-daemon.c
337         curl http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h > $(srcdir)/sd-daemon.h