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