lib: Correctly pass collected AM_LDFLAGS to linker
[cascardo/ovs.git] / lib / automake.mk
1 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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
12 if WIN32
13 lib_libopenvswitch_la_LIBADD += ${PTHREAD_LIBS}
14 endif
15
16 lib_libopenvswitch_la_LDFLAGS = \
17         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
18         -Wl,--version-script=$(top_builddir)/lib/libopenvswitch.sym \
19         $(AM_LDFLAGS)
20
21 lib_libopenvswitch_la_SOURCES = \
22         lib/aes128.c \
23         lib/aes128.h \
24         lib/async-append.h \
25         lib/backtrace.c \
26         lib/backtrace.h \
27         lib/bfd.c \
28         lib/bfd.h \
29         lib/bitmap.h \
30         lib/bundle.c \
31         lib/bundle.h \
32         lib/byte-order.h \
33         lib/byteq.c \
34         lib/byteq.h \
35         lib/cfm.c \
36         lib/cfm.h \
37         lib/classifier.c \
38         lib/classifier.h \
39         lib/classifier-private.h \
40         lib/cmap.c \
41         lib/cmap.h \
42         lib/command-line.c \
43         lib/command-line.h \
44         lib/compiler.h \
45         lib/connectivity.c \
46         lib/connectivity.h \
47         lib/coverage.c \
48         lib/coverage.h \
49         lib/crc32c.c \
50         lib/crc32c.h \
51         lib/csum.c \
52         lib/csum.h \
53         lib/daemon.c \
54         lib/daemon.h \
55         lib/daemon-private.h \
56         lib/dhcp.h \
57         lib/dummy.c \
58         lib/dummy.h \
59         lib/dhparams.h \
60         lib/dirs.h \
61         lib/dpctl.c \
62         lib/dpctl.h \
63         lib/dpif-netdev.c \
64         lib/dpif-netdev.h \
65         lib/dpif-provider.h \
66         lib/dpif.c \
67         lib/dpif.h \
68         lib/heap.c \
69         lib/heap.h \
70         lib/dynamic-string.c \
71         lib/dynamic-string.h \
72         lib/entropy.c \
73         lib/entropy.h \
74         lib/fat-rwlock.c \
75         lib/fat-rwlock.h \
76         lib/fatal-signal.c \
77         lib/fatal-signal.h \
78         lib/flow.c \
79         lib/flow.h \
80         lib/guarded-list.c \
81         lib/guarded-list.h \
82         lib/hash.c \
83         lib/hash.h \
84         lib/hindex.c \
85         lib/hindex.h \
86         lib/hmap.c \
87         lib/hmap.h \
88         lib/hmapx.c \
89         lib/hmapx.h \
90         lib/id-pool.c \
91         lib/id-pool.h \
92         lib/jhash.c \
93         lib/jhash.h \
94         lib/json.c \
95         lib/json.h \
96         lib/jsonrpc.c \
97         lib/jsonrpc.h \
98         lib/lacp.c \
99         lib/lacp.h \
100         lib/latch.h \
101         lib/learn.c \
102         lib/learn.h \
103         lib/learning-switch.c \
104         lib/learning-switch.h \
105         lib/list.h \
106         lib/lockfile.c \
107         lib/lockfile.h \
108         lib/mac-learning.c \
109         lib/mac-learning.h \
110         lib/match.c \
111         lib/match.h \
112         lib/mcast-snooping.c \
113         lib/mcast-snooping.h \
114         lib/memory.c \
115         lib/memory.h \
116         lib/meta-flow.c \
117         lib/meta-flow.h \
118         lib/multipath.c \
119         lib/multipath.h \
120         lib/netdev-dummy.c \
121         lib/netdev-provider.h \
122         lib/netdev-vport.c \
123         lib/netdev-vport.h \
124         lib/netdev.c \
125         lib/netdev.h \
126         lib/netflow.h \
127         lib/netlink.c \
128         lib/netlink.h \
129         lib/nx-match.c \
130         lib/nx-match.h \
131         lib/odp-execute.c \
132         lib/odp-execute.h \
133         lib/odp-util.c \
134         lib/odp-util.h \
135         lib/ofp-actions.c \
136         lib/ofp-actions.h \
137         lib/ofp-errors.c \
138         lib/ofp-errors.h \
139         lib/ofp-msgs.c \
140         lib/ofp-msgs.h \
141         lib/ofp-parse.c \
142         lib/ofp-parse.h \
143         lib/ofp-print.c \
144         lib/ofp-print.h \
145         lib/ofp-util.c \
146         lib/ofp-util.h \
147         lib/ofp-version-opt.h \
148         lib/ofp-version-opt.c \
149         lib/ofpbuf.c \
150         lib/ofpbuf.h \
151         lib/ovs-atomic-c11.h \
152         lib/ovs-atomic-clang.h \
153         lib/ovs-atomic-flag-gcc4.7+.h \
154         lib/ovs-atomic-gcc4+.h \
155         lib/ovs-atomic-gcc4.7+.h \
156         lib/ovs-atomic-i586.h \
157         lib/ovs-atomic-locked.c \
158         lib/ovs-atomic-locked.h \
159         lib/ovs-atomic-msvc.h \
160         lib/ovs-atomic-pthreads.h \
161         lib/ovs-atomic-x86_64.h \
162         lib/ovs-atomic.h \
163         lib/ovs-rcu.c \
164         lib/ovs-rcu.h \
165         lib/ovs-router.h \
166         lib/ovs-thread.c \
167         lib/ovs-thread.h \
168         lib/ovsdb-data.c \
169         lib/ovsdb-data.h \
170         lib/ovsdb-error.c \
171         lib/ovsdb-error.h \
172         lib/ovsdb-idl-provider.h \
173         lib/ovsdb-idl.c \
174         lib/ovsdb-idl.h \
175         lib/ovsdb-parser.c \
176         lib/ovsdb-parser.h \
177         lib/ovsdb-types.c \
178         lib/ovsdb-types.h \
179         lib/packet-dpif.c \
180         lib/packet-dpif.h \
181         lib/packets.c \
182         lib/packets.h \
183         lib/pcap-file.c \
184         lib/pcap-file.h \
185         lib/poll-loop.c \
186         lib/poll-loop.h \
187         lib/process.c \
188         lib/process.h \
189         lib/pvector.c \
190         lib/pvector.h \
191         lib/random.c \
192         lib/random.h \
193         lib/rconn.c \
194         lib/rconn.h \
195         lib/rculist.c \
196         lib/rculist.h \
197         lib/reconnect.c \
198         lib/reconnect.h \
199         lib/rstp.c \
200         lib/rstp.h \
201         lib/rstp-common.h \
202         lib/rstp-state-machines.c \
203         lib/rstp-state-machines.h \
204         lib/sat-math.h \
205         lib/seq.c \
206         lib/seq.h \
207         lib/sha1.c \
208         lib/sha1.h \
209         lib/shash.c \
210         lib/shash.h \
211         lib/simap.c \
212         lib/simap.h \
213         lib/smap.c \
214         lib/smap.h \
215         lib/socket-util.c \
216         lib/socket-util.h \
217         lib/sort.c \
218         lib/sort.h \
219         lib/sset.c \
220         lib/sset.h \
221         lib/stp.c \
222         lib/stp.h \
223         lib/stream-fd.c \
224         lib/stream-fd.h \
225         lib/stream-provider.h \
226         lib/stream-ssl.h \
227         lib/stream-tcp.c \
228         lib/stream.c \
229         lib/stream.h \
230         lib/stdio.c \
231         lib/string.c \
232         lib/svec.c \
233         lib/svec.h \
234         lib/table.c \
235         lib/table.h \
236         lib/tag.c \
237         lib/tag.h \
238         lib/timer.c \
239         lib/timer.h \
240         lib/timeval.c \
241         lib/timeval.h \
242         lib/token-bucket.c \
243         lib/token-bucket.h \
244         lib/type-props.h \
245         lib/unaligned.h \
246         lib/unicode.c \
247         lib/unicode.h \
248         lib/unixctl.c \
249         lib/unixctl.h \
250         lib/util.c \
251         lib/util.h \
252         lib/uuid.c \
253         lib/uuid.h \
254         lib/valgrind.h \
255         lib/vconn-provider.h \
256         lib/vconn-stream.c \
257         lib/vconn.c \
258         lib/vconn.h \
259         lib/vlan-bitmap.c \
260         lib/vlan-bitmap.h \
261         lib/vlandev.c \
262         lib/vlandev.h \
263         lib/vlog.c \
264         lib/vlog.h \
265         lib/vswitch-idl.c \
266         lib/vswitch-idl.h \
267         lib/vtep-idl.c \
268         lib/vtep-idl.h
269
270 if WIN32
271 lib_libopenvswitch_la_SOURCES += \
272         lib/daemon-windows.c \
273         lib/getopt_long.c \
274         lib/getrusage-windows.c \
275         lib/latch-windows.c \
276         lib/route-table-stub.c \
277         lib/strsep.c
278 else
279 lib_libopenvswitch_la_SOURCES += \
280         lib/daemon-unix.c \
281         lib/latch-unix.c \
282         lib/signals.c \
283         lib/signals.h \
284         lib/socket-util-unix.c \
285         lib/stream-unix.c
286 endif
287
288 EXTRA_DIST += \
289         lib/stdio.h.in \
290         lib/string.h.in
291
292 nodist_lib_libopenvswitch_la_SOURCES = \
293         lib/dirs.c
294 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
295
296 lib_LTLIBRARIES += lib/libsflow.la
297 lib_libsflow_la_LDFLAGS = \
298         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
299         -Wl,--version-script=$(top_builddir)/lib/libsflow.sym \
300         $(AM_LDFLAGS)
301 lib_libsflow_la_SOURCES = \
302         lib/sflow_api.h \
303         lib/sflow.h \
304         lib/sflow_agent.c \
305         lib/sflow_sampler.c \
306         lib/sflow_poller.c \
307         lib/sflow_receiver.c
308 lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
309 lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
310 if HAVE_WNO_UNUSED
311 lib_libsflow_la_CFLAGS += -Wno-unused
312 endif
313 if HAVE_WNO_UNUSED_PARAMETER
314 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
315 endif
316
317 if LINUX
318 lib_libopenvswitch_la_SOURCES += \
319         lib/dpif-netlink.c \
320         lib/dpif-netlink.h \
321         lib/netdev-linux.c \
322         lib/netdev-linux.h \
323         lib/netlink-notifier.c \
324         lib/netlink-notifier.h \
325         lib/netlink-protocol.h \
326         lib/netlink-socket.c \
327         lib/netlink-socket.h \
328         lib/ovs-numa.c \
329         lib/ovs-numa.h \
330         lib/ovs-router.c \
331         lib/ovs-router-linux.h \
332         lib/rtnetlink-link.c \
333         lib/rtnetlink-link.h \
334         lib/route-table.c \
335         lib/route-table.h
336 endif
337
338 if DPDK_NETDEV
339 lib_libopenvswitch_la_SOURCES += \
340        lib/netdev-dpdk.c \
341        lib/netdev-dpdk.h
342 endif
343
344 if WIN32
345 lib_libopenvswitch_la_SOURCES += \
346         lib/dpif-netlink.c \
347         lib/dpif-netlink.h \
348         lib/netdev-windows.c \
349         lib/netlink-notifier.c \
350         lib/netlink-notifier.h \
351         lib/netlink-protocol.h \
352         lib/netlink-socket.c \
353         lib/netlink-socket.h
354 endif
355
356 if HAVE_POSIX_AIO
357 lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
358 else
359 lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
360 endif
361
362 if ESX
363 lib_libopenvswitch_la_SOURCES += \
364         lib/route-table-stub.c
365 endif
366
367 if HAVE_IF_DL
368 lib_libopenvswitch_la_SOURCES += \
369         lib/netdev-bsd.c \
370         lib/rtbsd.c \
371         lib/rtbsd.h \
372         lib/route-table-bsd.c
373 endif
374
375 if HAVE_OPENSSL
376 lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
377 nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
378 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
379         $(AM_V_GEN)(echo '#include "lib/dhparams.h"' &&                 \
380          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
381          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
382          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
383         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp &&  \
384         mv lib/dhparams.c.tmp lib/dhparams.c
385 else
386 lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
387 endif
388
389 EXTRA_DIST += \
390         lib/dh1024.pem \
391         lib/dh2048.pem \
392         lib/dh4096.pem \
393         lib/dirs.c.in
394
395 MAN_FRAGMENTS += \
396         lib/common.man \
397         lib/common-syn.man \
398         lib/coverage-unixctl.man \
399         lib/daemon.man \
400         lib/daemon-syn.man \
401         lib/dpctl.man \
402         lib/memory-unixctl.man \
403         lib/ofp-version.man \
404         lib/ovs.tmac \
405         lib/service.man \
406         lib/service-syn.man \
407         lib/ssl-bootstrap.man \
408         lib/ssl-bootstrap-syn.man \
409         lib/ssl-peer-ca-cert.man \
410         lib/ssl.man \
411         lib/ssl-syn.man \
412         lib/table.man \
413         lib/unixctl.man \
414         lib/unixctl-syn.man \
415         lib/vconn-active.man \
416         lib/vconn-passive.man \
417         lib/vlog-unixctl.man \
418         lib/vlog-syn.man \
419         lib/vlog.man
420
421 # vswitch IDL
422 OVSIDL_BUILT += \
423         $(srcdir)/lib/vswitch-idl.c \
424         $(srcdir)/lib/vswitch-idl.h \
425         $(srcdir)/lib/vswitch-idl.ovsidl \
426         $(srcdir)/lib/vtep-idl.c \
427         $(srcdir)/lib/vtep-idl.h \
428         $(srcdir)/lib/vtep-idl.ovsidl
429
430 EXTRA_DIST += $(srcdir)/lib/vswitch-idl.ann
431 VSWITCH_IDL_FILES = \
432         $(srcdir)/vswitchd/vswitch.ovsschema \
433         $(srcdir)/lib/vswitch-idl.ann
434 $(srcdir)/lib/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES)
435         $(AM_V_GEN)$(OVSDB_IDLC) annotate $(VSWITCH_IDL_FILES) > $@.tmp && \
436         mv $@.tmp $@
437
438 EXTRA_DIST += $(srcdir)/lib/vtep-idl.ann
439 VTEP_IDL_FILES = \
440         $(srcdir)/vtep/vtep.ovsschema \
441         $(srcdir)/lib/vtep-idl.ann
442 $(srcdir)/lib/vtep-idl.ovsidl: $(VTEP_IDL_FILES)
443         $(AM_V_GEN)$(OVSDB_IDLC) annotate $(VTEP_IDL_FILES) > $@.tmp && \
444         mv $@.tmp $@
445
446 lib/dirs.c: lib/dirs.c.in Makefile
447         $(AM_V_GEN)($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
448                 -e 's,[@]srcdir[@],$(srcdir),g' \
449                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
450                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
451                 -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
452                 -e 's,[@]bindir[@],"$(bindir)",g' \
453                 -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
454                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
455              > lib/dirs.c.tmp && \
456         mv lib/dirs.c.tmp lib/dirs.c
457
458 lib/meta-flow.inc: $(srcdir)/build-aux/extract-ofp-fields lib/meta-flow.h
459         $(AM_V_GEN)$(run_python) $^ --meta-flow > $@.tmp && mv $@.tmp $@
460 lib/meta-flow.lo: lib/meta-flow.inc
461 lib/nx-match.inc: $(srcdir)/build-aux/extract-ofp-fields lib/meta-flow.h
462         $(AM_V_GEN)$(run_python) $^ --nx-match > $@.tmp && mv $@.tmp $@
463 lib/nx-match.lo: lib/nx-match.inc
464 CLEANFILES += lib/meta-flow.inc lib/nx-match.inc
465 EXTRA_DIST += build-aux/extract-ofp-fields
466
467 lib/ofp-actions.inc1: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
468         $(AM_V_GEN)$(run_python) $^ --prototypes > $@.tmp && mv $@.tmp $@
469 lib/ofp-actions.inc2: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
470         $(AM_V_GEN)$(run_python) $^ --definitions > $@.tmp && mv $@.tmp $@
471 lib/ofp-actions.lo: lib/ofp-actions.inc1 lib/ofp-actions.inc2
472 CLEANFILES += lib/ofp-actions.inc1 lib/ofp-actions.inc2
473 EXTRA_DIST += build-aux/extract-ofp-actions
474
475 $(srcdir)/lib/ofp-errors.inc: \
476         lib/ofp-errors.h include/openflow/openflow-common.h \
477         $(srcdir)/build-aux/extract-ofp-errors
478         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-errors \
479                 $(srcdir)/lib/ofp-errors.h \
480                 $(srcdir)/include/openflow/openflow-common.h > $@.tmp && \
481         mv $@.tmp $@
482 $(srcdir)/lib/ofp-errors.c: $(srcdir)/lib/ofp-errors.inc
483 EXTRA_DIST += build-aux/extract-ofp-errors lib/ofp-errors.inc
484
485 $(srcdir)/lib/ofp-msgs.inc: \
486         lib/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
487         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
488                 $(srcdir)/lib/ofp-msgs.h $@ > $@.tmp && mv $@.tmp $@
489 $(srcdir)/lib/ofp-msgs.c: $(srcdir)/lib/ofp-msgs.inc
490 EXTRA_DIST += build-aux/extract-ofp-msgs lib/ofp-msgs.inc
491
492 INSTALL_DATA_LOCAL += lib-install-data-local
493 lib-install-data-local:
494         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
495         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
496         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
497         $(MKDIR_P) $(DESTDIR)$(DBDIR)
498