openvswitch: Use libtool and allow building shared libs
[sliver-openvswitch.git] / lib / automake.mk
1 # Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
2 #
3 # Copying and distribution of this file, with or without modification,
4 # are permitted in any medium without royalty provided the copyright
5 # notice and this notice are preserved.  This file is offered as-is,
6 # without warranty of any kind.
7
8 lib_LTLIBRARIES += lib/libopenvswitch.la
9
10 lib_libopenvswitch_la_LIBADD = $(SSL_LIBS)
11 lib_libopenvswitch_la_LDFLAGS = -release $(VERSION)
12
13 lib_libopenvswitch_la_SOURCES = \
14         lib/aes128.c \
15         lib/aes128.h \
16         lib/async-append.h \
17         lib/backtrace.c \
18         lib/backtrace.h \
19         lib/bfd.c \
20         lib/bfd.h \
21         lib/bitmap.c \
22         lib/bitmap.h \
23         lib/bundle.c \
24         lib/bundle.h \
25         lib/byte-order.h \
26         lib/byteq.c \
27         lib/byteq.h \
28         lib/cfm.c \
29         lib/cfm.h \
30         lib/classifier.c \
31         lib/classifier.h \
32         lib/command-line.c \
33         lib/command-line.h \
34         lib/compiler.h \
35         lib/connectivity.c \
36         lib/connectivity.h \
37         lib/coverage.c \
38         lib/coverage.h \
39         lib/crc32c.c \
40         lib/crc32c.h \
41         lib/csum.c \
42         lib/csum.h \
43         lib/daemon.c \
44         lib/daemon.h \
45         lib/dhcp.h \
46         lib/dummy.c \
47         lib/dummy.h \
48         lib/dhparams.h \
49         lib/dirs.h \
50         lib/dpif-netdev.c \
51         lib/dpif-provider.h \
52         lib/dpif.c \
53         lib/dpif.h \
54         lib/heap.c \
55         lib/heap.h \
56         lib/dynamic-string.c \
57         lib/dynamic-string.h \
58         lib/entropy.c \
59         lib/entropy.h \
60         lib/fatal-signal.c \
61         lib/fatal-signal.h \
62         lib/flow.c \
63         lib/flow.h \
64         lib/guarded-list.c \
65         lib/guarded-list.h \
66         lib/hash.c \
67         lib/hash.h \
68         lib/hindex.c \
69         lib/hindex.h \
70         lib/hmap.c \
71         lib/hmap.h \
72         lib/hmapx.c \
73         lib/hmapx.h \
74         lib/jhash.c \
75         lib/jhash.h \
76         lib/json.c \
77         lib/json.h \
78         lib/jsonrpc.c \
79         lib/jsonrpc.h \
80         lib/lacp.c \
81         lib/lacp.h \
82         lib/latch.c \
83         lib/latch.h \
84         lib/learn.c \
85         lib/learn.h \
86         lib/learning-switch.c \
87         lib/learning-switch.h \
88         lib/list.c \
89         lib/list.h \
90         lib/lockfile.c \
91         lib/lockfile.h \
92         lib/mac-learning.c \
93         lib/mac-learning.h \
94         lib/match.c \
95         lib/match.h \
96         lib/memory.c \
97         lib/memory.h \
98         lib/meta-flow.c \
99         lib/meta-flow.h \
100         lib/multipath.c \
101         lib/multipath.h \
102         lib/netdev-dummy.c \
103         lib/netdev-provider.h \
104         lib/netdev-vport.c \
105         lib/netdev-vport.h \
106         lib/netdev.c \
107         lib/netdev.h \
108         lib/netflow.h \
109         lib/netlink.c \
110         lib/netlink.h \
111         lib/nx-match.c \
112         lib/nx-match.h \
113         lib/odp-execute.c \
114         lib/odp-execute.h \
115         lib/odp-util.c \
116         lib/odp-util.h \
117         lib/ofp-actions.c \
118         lib/ofp-actions.h \
119         lib/ofp-errors.c \
120         lib/ofp-errors.h \
121         lib/ofp-msgs.c \
122         lib/ofp-msgs.h \
123         lib/ofp-parse.c \
124         lib/ofp-parse.h \
125         lib/ofp-print.c \
126         lib/ofp-print.h \
127         lib/ofp-util.c \
128         lib/ofp-util.def \
129         lib/ofp-util.h \
130         lib/ofp-version-opt.h \
131         lib/ofp-version-opt.c \
132         lib/ofpbuf.c \
133         lib/ofpbuf.h \
134         lib/ovs-atomic-c11.h \
135         lib/ovs-atomic-clang.h \
136         lib/ovs-atomic-flag-gcc4.7+.h \
137         lib/ovs-atomic-gcc4+.c \
138         lib/ovs-atomic-gcc4+.h \
139         lib/ovs-atomic-gcc4.7+.h \
140         lib/ovs-atomic-pthreads.c \
141         lib/ovs-atomic-pthreads.h \
142         lib/ovs-atomic.h \
143         lib/ovs-thread.c \
144         lib/ovs-thread.h \
145         lib/ovsdb-data.c \
146         lib/ovsdb-data.h \
147         lib/ovsdb-error.c \
148         lib/ovsdb-error.h \
149         lib/ovsdb-idl-provider.h \
150         lib/ovsdb-idl.c \
151         lib/ovsdb-idl.h \
152         lib/ovsdb-parser.c \
153         lib/ovsdb-parser.h \
154         lib/ovsdb-types.c \
155         lib/ovsdb-types.h \
156         lib/packets.c \
157         lib/packets.h \
158         lib/pcap-file.c \
159         lib/pcap-file.h \
160         lib/poll-loop.c \
161         lib/poll-loop.h \
162         lib/process.c \
163         lib/process.h \
164         lib/random.c \
165         lib/random.h \
166         lib/rconn.c \
167         lib/rconn.h \
168         lib/reconnect.c \
169         lib/reconnect.h \
170         lib/sat-math.h \
171         lib/seq.c \
172         lib/seq.h \
173         lib/sha1.c \
174         lib/sha1.h \
175         lib/shash.c \
176         lib/shash.h \
177         lib/simap.c \
178         lib/simap.h \
179         lib/signals.c \
180         lib/signals.h \
181         lib/smap.c \
182         lib/smap.h \
183         lib/socket-util.c \
184         lib/socket-util.h \
185         lib/sort.c \
186         lib/sort.h \
187         lib/sset.c \
188         lib/sset.h \
189         lib/stp.c \
190         lib/stp.h \
191         lib/stream-fd.c \
192         lib/stream-fd.h \
193         lib/stream-provider.h \
194         lib/stream-ssl.h \
195         lib/stream-tcp.c \
196         lib/stream-unix.c \
197         lib/stream.c \
198         lib/stream.h \
199         lib/string.c \
200         lib/svec.c \
201         lib/svec.h \
202         lib/table.c \
203         lib/table.h \
204         lib/tag.c \
205         lib/tag.h \
206         lib/timer.c \
207         lib/timer.h \
208         lib/timeval.c \
209         lib/timeval.h \
210         lib/token-bucket.c \
211         lib/token-bucket.h \
212         lib/type-props.h \
213         lib/unaligned.h \
214         lib/unicode.c \
215         lib/unicode.h \
216         lib/unixctl.c \
217         lib/unixctl.h \
218         lib/util.c \
219         lib/util.h \
220         lib/uuid.c \
221         lib/uuid.h \
222         lib/valgrind.h \
223         lib/vconn-provider.h \
224         lib/vconn-stream.c \
225         lib/vconn.c \
226         lib/vconn.h \
227         lib/vlan-bitmap.c \
228         lib/vlan-bitmap.h \
229         lib/vlandev.c \
230         lib/vlandev.h \
231         lib/vlog.c \
232         lib/vlog.h \
233         lib/vswitch-idl.c \
234         lib/vswitch-idl.h \
235         lib/vtep-idl.c \
236         lib/vtep-idl.h
237 EXTRA_DIST += lib/string.h.in
238
239 nodist_lib_libopenvswitch_la_SOURCES = \
240         lib/dirs.c
241 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
242
243 lib_LTLIBRARIES += lib/libsflow.la
244 lib_libsflow_la_LDFLAGS = -release $(VERSION)
245 lib_libsflow_la_SOURCES = \
246         lib/sflow_api.h \
247         lib/sflow.h \
248         lib/sflow_agent.c \
249         lib/sflow_sampler.c \
250         lib/sflow_poller.c \
251         lib/sflow_receiver.c
252 lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
253 lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
254 if HAVE_WNO_UNUSED
255 lib_libsflow_la_CFLAGS += -Wno-unused
256 endif
257 if HAVE_WNO_UNUSED_PARAMETER
258 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
259 endif
260
261 if LINUX_DATAPATH
262 lib_libopenvswitch_la_SOURCES += \
263         lib/dpif-linux.c \
264         lib/dpif-linux.h \
265         lib/netdev-linux.c \
266         lib/netdev-linux.h \
267         lib/netlink-notifier.c \
268         lib/netlink-notifier.h \
269         lib/netlink-protocol.h \
270         lib/netlink-socket.c \
271         lib/netlink-socket.h \
272         lib/rtnetlink-link.c \
273         lib/rtnetlink-link.h \
274         lib/route-table.c \
275         lib/route-table.h
276 endif
277
278 if HAVE_POSIX_AIO
279 lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
280 else
281 lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
282 endif
283
284 if ESX
285 lib_libopenvswitch_la_SOURCES += \
286         lib/route-table-stub.c
287 endif
288
289 if HAVE_IF_DL
290 lib_libopenvswitch_la_SOURCES += \
291         lib/netdev-bsd.c \
292         lib/rtbsd.c \
293         lib/rtbsd.h \
294         lib/route-table-bsd.c
295 endif
296
297 if HAVE_OPENSSL
298 lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
299 nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
300 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
301         (echo '#include "lib/dhparams.h"' &&                            \
302          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
303          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
304          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
305         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp
306         mv lib/dhparams.c.tmp lib/dhparams.c
307 else
308 lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
309 endif
310
311 EXTRA_DIST += \
312         lib/dh1024.pem \
313         lib/dh2048.pem \
314         lib/dh4096.pem \
315         lib/dirs.c.in
316
317 MAN_FRAGMENTS += \
318         lib/common.man \
319         lib/common-syn.man \
320         lib/coverage-unixctl.man \
321         lib/daemon.man \
322         lib/daemon-syn.man \
323         lib/memory-unixctl.man \
324         lib/ofp-version.man \
325         lib/ovs.tmac \
326         lib/ssl-bootstrap.man \
327         lib/ssl-bootstrap-syn.man \
328         lib/ssl-peer-ca-cert.man \
329         lib/ssl.man \
330         lib/ssl-syn.man \
331         lib/table.man \
332         lib/unixctl.man \
333         lib/unixctl-syn.man \
334         lib/vconn-active.man \
335         lib/vconn-passive.man \
336         lib/vlog-unixctl.man \
337         lib/vlog-syn.man \
338         lib/vlog.man
339
340 # vswitch IDL
341 OVSIDL_BUILT += \
342         $(srcdir)/lib/vswitch-idl.c \
343         $(srcdir)/lib/vswitch-idl.h \
344         $(srcdir)/lib/vswitch-idl.ovsidl \
345         $(srcdir)/lib/vtep-idl.c \
346         $(srcdir)/lib/vtep-idl.h \
347         $(srcdir)/lib/vtep-idl.ovsidl
348
349 EXTRA_DIST += $(srcdir)/lib/vswitch-idl.ann
350 VSWITCH_IDL_FILES = \
351         $(srcdir)/vswitchd/vswitch.ovsschema \
352         $(srcdir)/lib/vswitch-idl.ann
353 $(srcdir)/lib/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES)
354         $(OVSDB_IDLC) annotate $(VSWITCH_IDL_FILES) > $@.tmp
355         mv $@.tmp $@
356
357 EXTRA_DIST += $(srcdir)/lib/vtep-idl.ann
358 VTEP_IDL_FILES = \
359         $(srcdir)/vtep/vtep.ovsschema \
360         $(srcdir)/lib/vtep-idl.ann
361 $(srcdir)/lib/vtep-idl.ovsidl: $(VTEP_IDL_FILES)
362         $(OVSDB_IDLC) annotate $(VTEP_IDL_FILES) > $@.tmp
363         mv $@.tmp $@
364
365 lib/dirs.c: lib/dirs.c.in Makefile
366         ($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
367                 -e 's,[@]srcdir[@],$(srcdir),g' \
368                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
369                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
370                 -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
371                 -e 's,[@]bindir[@],"$(bindir)",g' \
372                 -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
373                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
374              > lib/dirs.c.tmp
375         mv lib/dirs.c.tmp lib/dirs.c
376
377 $(srcdir)/lib/ofp-errors.inc: \
378         lib/ofp-errors.h include/openflow/openflow-common.h \
379         $(srcdir)/build-aux/extract-ofp-errors
380         $(run_python) $(srcdir)/build-aux/extract-ofp-errors \
381                 $(srcdir)/lib/ofp-errors.h \
382                 $(srcdir)/include/openflow/openflow-common.h > $@.tmp
383         mv $@.tmp $@
384 $(srcdir)/lib/ofp-errors.c: $(srcdir)/lib/ofp-errors.inc
385 EXTRA_DIST += build-aux/extract-ofp-errors lib/ofp-errors.inc
386
387 $(srcdir)/lib/ofp-msgs.inc: \
388         lib/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
389         $(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
390                 $(srcdir)/lib/ofp-msgs.h $@ > $@.tmp && mv $@.tmp $@
391 $(srcdir)/lib/ofp-msgs.c: $(srcdir)/lib/ofp-msgs.inc
392 EXTRA_DIST += build-aux/extract-ofp-msgs lib/ofp-msgs.inc
393
394 INSTALL_DATA_LOCAL += lib-install-data-local
395 lib-install-data-local:
396         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
397         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
398         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
399         $(MKDIR_P) $(DESTDIR)$(DBDIR)
400