Fix some plugin build system details
[platform/upstream/connman.git] / plugins / Makefile.am
1
2 plugindir = $(libdir)/connman/plugins
3
4 plugin_LTLIBRARIES =
5
6 builtin_modules =
7 builtin_sources =
8 builtin_libadd =
9 builtin_cflags =
10
11 if LOOPBACK
12 if LOOPBACK_BUILTIN
13 builtin_modules += loopback
14 builtin_sources += loopback.c
15 else
16 plugin_LTLIBRARIES += loopback.la
17 endif
18 endif
19
20 if ETHERNET
21 if ETHERNET_BUILTIN
22 builtin_modules += ethernet
23 builtin_sources += ethernet.c
24 else
25 plugin_LTLIBRARIES += ethernet.la
26 endif
27 endif
28
29 if WIFI
30 if WIFI_BUILTIN
31 builtin_modules += wifi
32 builtin_sources += wifi.c supplicant.h supplicant.c
33 else
34 plugin_LTLIBRARIES += wifi.la
35 wifi_la_SOURCES = wifi.c supplicant.h supplicant.c
36 wifi_la_LIBADD = @GDBUS_LIBS@
37 endif
38 endif
39
40 if BLUETOOTH
41 if BLUETOOTH_BUILTIN
42 builtin_modules += bluetooth
43 builtin_sources += bluetooth.c
44 else
45 plugin_LTLIBRARIES += bluetooth.la
46 bluetooth_la_LIBADD = @GDBUS_LIBS@
47 endif
48 endif
49
50 if OFONO
51 if OFONO_BUILTIN
52 builtin_modules += ofono
53 builtin_sources += ofono.c
54 else
55 plugin_LTLIBRARIES += ofono.la
56 ofono_la_LIBADD = @GDBUS_LIBS@
57 endif
58 endif
59
60 if MODEMMGR
61 if MODEMMGR_BUILTIN
62 builtin_modules += modemmgr
63 builtin_sources += modemmgr.c
64 else
65 plugin_LTLIBRARIES += modemmgr.la
66 modemmgr_la_LIBADD = @GDBUS_LIBS@
67 endif
68 endif
69
70 if NOVATEL
71 plugin_LTLIBRARIES += novatel.la
72 novatel_la_SOURCES = novatel.c modem.h modem.c
73 endif
74
75 if HUAWEI
76 plugin_LTLIBRARIES += huawei.la
77 huawei_la_SOURCES = huawei.c modem.h modem.c
78 endif
79
80 if HSO
81 if HSO_BUILTIN
82 builtin_modules += hso
83 builtin_sources += hso.c modem.h modem.c
84 builtin_libadd += @GATCHAT_LIBS@
85 builtin_cflags += @GATCHAT_CFLAGS@
86 else
87 plugin_LTLIBRARIES += hso.la
88 hso_la_SOURCES = hso.c modem.h modem.c
89 hso_la_LIBADD = @GATCHAT_LIBS@
90 hso_la_CFLAGS = $(AM_CFLAGS) @GATCHAT_CFLAGS@
91 endif
92 endif
93
94 if MBM
95 if MBM_BUILTIN
96 builtin_modules += mbm
97 builtin_sources += mbm.c
98 builtin_libadd += @GATCHAT_LIBS@
99 builtin_cflags += @GATCHAT_CFLAGS@
100 else
101 plugin_LTLIBRARIES += mbm.la
102 mbm_la_LIBADD = @GATCHAT_LIBS@
103 mbm_la_CFLAGS = $(AM_CFLAGS) @GATCHAT_CFLAGS@
104 endif
105 endif
106
107 if UDHCP
108 if UDHCP_BUILTIN
109 builtin_modules += udhcp
110 builtin_sources += udhcp.c task.h task.c
111 builtin_cflags += -DUDHCPC=\"@UDHCPC@\"
112 else
113 plugin_LTLIBRARIES += udhcp.la
114 udhcp_la_SOURCES = udhcp.c task.h task.c
115 udhcp_la_CFLAGS = $(AM_CFLAGS) -DUDHCPC=\"@UDHCPC@\" \
116                 -DSTATEDIR=\""$(statedir)"\" -DSCRIPTDIR=\""$(scriptdir)"\"
117 endif
118 endif
119
120 if DHCLIENT
121 if DHCLIENT_BUILTIN
122 builtin_modules += dhclient
123 builtin_sources += dhclient.c
124 builtin_cflags += -DDHCLIENT=\"@DHCLIENT@\"
125 else
126 plugin_LTLIBRARIES += dhclient.la
127 dhclient_la_CFLAGS = $(AM_CFLAGS) -DDHCLIENT=\"@DHCLIENT@\" \
128                 -DSTATEDIR=\""$(statedir)"\" -DSCRIPTDIR=\""$(scriptdir)"\"
129 endif
130 endif
131
132 if PPPD
133 plugin_LTLIBRARIES += pppd.la
134 pppd_la_CFLAGS = $(AM_CFLAGS) -DPPPD=\"@PPPD@\"
135 endif
136
137 if RESOLVCONF
138 if RESOLVCONF_BUILTIN
139 builtin_modules += resolvconf
140 builtin_sources += resolvconf.c
141 builtin_cflags += -DRESOLVCONF=\"@RESOLVCONF@\"
142 else
143 plugin_LTLIBRARIES += resolvconf.la
144 resolvconf_la_CFLAGS = $(AM_CFLAGS) -DRESOLVCONF=\"@RESOLVCONF@\"
145 endif
146 endif
147
148 if DNSPROXY
149 if DNSPROXY_BUILTIN
150 builtin_modules += dnsproxy
151 builtin_sources += dnsproxy.c
152 else
153 plugin_LTLIBRARIES += dnsproxy.la
154 endif
155 endif
156
157 if POLKIT
158 if POLKIT_BUILTIN
159 builtin_modules += polkit
160 builtin_sources += polkit.c
161 builtin_libadd += @POLKIT_LIBS@
162 builtin_cflags += @POLKIT_CFLAGS@
163 else
164 plugin_LTLIBRARIES += polkit.la
165 polkit_la_LIBADD = @POLKIT_LIBS@ @GLIB_LIBS@
166 polkit_la_CFLAGS = $(AM_CFLAGS) @POLKIT_CFLAGS@
167 endif
168
169 if DATAFILES
170 policydir = @POLKIT_DATADIR@
171
172 policy_DATA = connman.policy
173 endif
174 endif
175
176 if IWMX
177 plugin_LTLIBRARIES += iwmxsdk.la
178 iwmxsdk_la_SOURCES = iwmx.h iwmx.c iwmxsdk.c
179 iwmxsdk_la_LIBADD = @IWMXSDK_LIBS@ @GLIB_LIBS@
180 iwmxsdk_la_CFLAGS = $(AM_CFLAGS) @IWMXSDK_CFLAGS@
181 endif
182
183 if IOSPM
184 plugin_LTLIBRARIES += iospm.la
185 endif
186
187 if FAKE
188 plugin_LTLIBRARIES += fake.la
189 endif
190
191 noinst_LTLIBRARIES = libbuiltin.la
192
193 libbuiltin_la_SOURCES = $(builtin_sources)
194 libbuiltin_la_LIBADD = $(builtin_libadd)
195 libbuiltin_la_CFLAGS = $(AM_CFLAGS) \
196                 $(builtin_cflags) -DCONNMAN_PLUGIN_BUILTIN \
197                 -DSTATEDIR=\""$(statedir)"\" -DSCRIPTDIR=\""$(scriptdir)"\"
198
199 BUILT_SOURCES = builtin.h
200
201 nodist_libbuiltin_la_SOURCES = $(BUILT_SOURCES)
202
203 AM_LDFLAGS = -no-undefined -module -avoid-version
204
205 statedir = $(localstatedir)/run/connman
206
207 if MAINTAINER_MODE
208 scriptdir = $(abs_top_srcdir)/scripts
209 else
210 scriptdir = $(libdir)/connman/scripts
211 endif
212
213 AM_CFLAGS = -fvisibility=hidden @GLIB_CFLAGS@ @GDBUS_CFLAGS@
214
215 INCLUDES = -I$(top_builddir)/include
216
217 CLEANFILES = $(BUILT_SOURCES) connman.policy
218
219 EXTRA_DIST = polkit.policy
220
221 MAINTAINERCLEANFILES = Makefile.in
222
223 builtin.h:
224         echo "" > $@
225         list='$(builtin_modules)'; for i in $$list; \
226           do echo "extern struct connman_plugin_desc __connman_builtin_$$i;" >> $@; done
227         echo "" >> $@
228         echo "static struct connman_plugin_desc *__connman_builtin[] = {" >> $@
229         list='$(builtin_modules)'; for i in $$list; \
230           do echo "&__connman_builtin_$$i," >> $@; done
231         echo "NULL };" >> $@
232
233 connman.policy: polkit.policy
234         cp $< $@