Correctly implement -fPIC and -fPIE
[platform/upstream/dbus.git] / bus / Makefile.am
1
2 configdir=$(sysconfdir)/dbus-1
3
4 INCLUDES=-I$(top_srcdir) $(DBUS_BUS_CFLAGS) @PIE_CFLAGS@                \
5         -DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\"        \
6         -DDAEMON_NAME=\"dbus-daemon\"  -DDBUS_COMPILATION
7
8 EFENCE=
9
10 CONFIG_IN_FILES=                                \
11         session.conf.in                         \
12         system.conf.in
13
14 config_DATA=                                    \
15         session.conf                            \
16         system.conf
17
18 if DBUS_USE_LIBXML
19 XML_SOURCES=config-loader-libxml.c
20 endif
21 if DBUS_USE_EXPAT
22 XML_SOURCES=config-loader-expat.c
23 endif
24
25 if DBUS_BUS_ENABLE_KQUEUE
26 DIR_WATCH_SOURCE=dir-watch-kqueue.c
27 else
28 if DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX
29 DIR_WATCH_SOURCE=dir-watch-dnotify.c
30 else
31 DIR_WATCH_SOURCE=dir-watch-default.c
32 endif
33 endif
34
35 BUS_SOURCES=                                    \
36         activation.c                            \
37         activation.h                            \
38         activation-exit-codes.h                 \
39         bus.c                                   \
40         bus.h                                   \
41         config-parser.c                         \
42         config-parser.h                         \
43         config-parser-common.c                  \
44         config-parser-common.h                  \
45         connection.c                            \
46         connection.h                            \
47         desktop-file.c                          \
48         desktop-file.h                          \
49         $(DIR_WATCH_SOURCE)                     \
50         dir-watch.h                             \
51         dispatch.c                              \
52         dispatch.h                              \
53         driver.c                                \
54         driver.h                                \
55         expirelist.c                            \
56         expirelist.h                            \
57         policy.c                                \
58         policy.h                                \
59         selinux.h                               \
60         selinux.c                               \
61         services.c                              \
62         services.h                              \
63         signals.c                               \
64         signals.h                               \
65         test.c                                  \
66         test.h                                  \
67         utils.c                                 \
68         utils.h                                 \
69         $(XML_SOURCES)
70
71 dbus_daemon_SOURCES=                            \
72         $(BUS_SOURCES)                          \
73         main.c                                  
74
75 dbus_daemon_LDADD=                                      \
76         $(EFENCE)                                       \
77         $(DBUS_BUS_LIBS)                                \
78         $(top_builddir)/dbus/libdbus-convenience.la
79
80 dbus_daemon_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ @PIE_LDFLAGS@
81
82 LAUNCH_HELPER_SOURCES=                          \
83         $(XML_SOURCES)                          \
84         config-parser-common.c                  \
85         config-parser-common.h                  \
86         config-parser-trivial.c                 \
87         config-parser-trivial.h                 \
88         desktop-file.c                          \
89         desktop-file.h                          \
90         utils.c                                 \
91         utils.h                                 \
92         activation-exit-codes.h                 \
93         activation-helper.h                     \
94         activation-helper.c
95
96 ## This is the installed launch helper with the setuid checks
97 dbus_daemon_launch_helper_SOURCES=              \
98         activation-helper-bin.c                 \
99         $(LAUNCH_HELPER_SOURCES)
100
101 dbus_daemon_launch_helper_LDADD=                \
102         $(DBUS_LAUNCHER_LIBS)                   \
103         $(top_builddir)/dbus/libdbus-convenience.la
104
105 dbus_daemon_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
106
107 ## we build another binary so we can do the launch testing without root privs.
108 ## DO NOT INSTALL THIS FILE
109 dbus_daemon_launch_helper_test_SOURCES=         \
110         activation-helper-bin.c                 \
111         $(LAUNCH_HELPER_SOURCES)
112
113 dbus_daemon_launch_helper_test_LDADD=           \
114         $(DBUS_LAUNCHER_LIBS)                   \
115         $(top_builddir)/dbus/libdbus-convenience.la
116
117 dbus_daemon_launch_helper_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
118 dbus_daemon_launch_helper_test_CPPFLAGS=        \
119         -DACTIVATION_LAUNCHER_TEST
120
121 ## we build yet another binary so we can do the OOM tests
122 ## DO NOT INSTALL THIS FILE
123 bus_test_launch_helper_SOURCES=         \
124         test-launch-helper.c            \
125         $(LAUNCH_HELPER_SOURCES)
126
127 bus_test_launch_helper_LDADD=           \
128         $(DBUS_LAUNCHER_LIBS)                   \
129         $(top_builddir)/dbus/libdbus-convenience.la
130
131 bus_test_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@
132 bus_test_launch_helper_CPPFLAGS=        \
133         -DACTIVATION_LAUNCHER_TEST      \
134         -DACTIVATION_LAUNCHER_DO_OOM
135
136 ## note that TESTS has special meaning (stuff to use in make check)
137 ## so if adding tests not to be run in make check, don't add them to 
138 ## TESTS
139 if DBUS_BUILD_TESTS
140 TESTS_ENVIRONMENT=DBUS_TEST_DATA=$(top_builddir)/test/data DBUS_TEST_HOMEDIR=$(top_builddir)/dbus DBUS_FATAL_WARNINGS=1 DBUS_BLOCK_ON_ABORT=1
141 TESTS=bus-test bus-test-system bus-test-launch-helper
142 else
143 TESTS=
144 endif
145
146 ## we use noinst_PROGRAMS not check_PROGRAMS so that we build 
147 ## even when not doing "make check"
148 noinst_PROGRAMS=$(TESTS) dbus-daemon dbus-daemon-launch-helper-test dbus-daemon-launch-helper
149
150 bus_test_system_SOURCES=                        \
151         $(XML_SOURCES)                          \
152         config-parser-common.c                  \
153         config-parser-common.h                  \
154         config-parser-trivial.c                 \
155         config-parser-trivial.h                 \
156         utils.c                                 \
157         utils.h                                 \
158         test-system.c
159
160 bus_test_system_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_BUS_LIBS)
161 bus_test_system_LDFLAGS=@R_DYNAMIC_LDFLAG@
162
163 bus_test_SOURCES=                               \
164         $(BUS_SOURCES)                          \
165         test-main.c
166
167 bus_test_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_BUS_LIBS)
168 bus_test_LDFLAGS=@R_DYNAMIC_LDFLAG@
169
170 ## mop up the gcov files
171 clean-local:
172         /bin/rm *.bb *.bbg *.da *.gcov || true
173
174 uninstall-hook:
175         rm -f $(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon
176         rm -f $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper
177
178 install-data-hook:
179         if test '!' -d $(DESTDIR)$(DBUS_DAEMONDIR); then \
180                 $(mkinstalldirs) $(DESTDIR)$(DBUS_DAEMONDIR); \
181                 chmod 755 $(DESTDIR)$(DBUS_DAEMONDIR); \
182         fi
183         $(INSTALL_PROGRAM) dbus-daemon $(DESTDIR)$(DBUS_DAEMONDIR)
184         $(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
185         $(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
186         $(mkinstalldirs) $(DESTDIR)$(configdir)/session.d
187         $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services
188         $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/system-services
189         $(mkinstalldirs) $(DESTDIR)$(libexecdir)/dbus-1
190         $(INSTALL_PROGRAM) dbus-daemon-launch-helper $(DESTDIR)$(libexecdir)
191         if test `id -u` -eq 0; then \
192                 chown root:$(DBUS_USER) $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \
193                 chmod 4750 $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \
194         else \
195                 echo "Not installing $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper binary setuid!"; \
196                 echo "You'll need to manually set permissions to root:$(DBUS_USER) and permissions 4750"; \
197         fi
198
199 #### Init scripts fun
200 SCRIPT_IN_FILES=messagebus.in \
201                 rc.messagebus.in
202
203 ## Red Hat start
204 if DBUS_INIT_SCRIPTS_RED_HAT
205
206 initddir=$(sysconfdir)/rc.d/init.d
207
208 initd_SCRIPTS=  \
209         messagebus
210
211 endif
212  ## Red Hat end
213
214 ## Slackware start
215 if DBUS_INIT_SCRIPTS_SLACKWARE
216
217 initddir=$(sysconfdir)/rc.d/
218
219 initd_SCRIPTS=  \
220         rc.messagebus
221
222 endif
223 ## Slackware end
224
225 MAN_IN_FILES=dbus-daemon.1.in
226 man_MANS = dbus-daemon.1
227
228 #### Extra dist 
229
230 EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) $(man_MANS) $(MAN_IN_FILES)