4d4ee01db75fdc502a3e99e509e9f596c8b2bc2b
[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-numa.c \
168         lib/ovs-numa.h \
169         lib/ovs-rcu.c \
170         lib/ovs-rcu.h \
171         lib/ovs-router.h \
172         lib/ovs-router.c \
173         lib/ovs-thread.c \
174         lib/ovs-thread.h \
175         lib/ovsdb-data.c \
176         lib/ovsdb-data.h \
177         lib/ovsdb-error.c \
178         lib/ovsdb-error.h \
179         lib/ovsdb-idl-provider.h \
180         lib/ovsdb-idl.c \
181         lib/ovsdb-idl.h \
182         lib/ovsdb-map-op.c \
183         lib/ovsdb-map-op.h \
184         lib/ovsdb-parser.c \
185         lib/ovsdb-parser.h \
186         lib/ovsdb-types.c \
187         lib/ovsdb-types.h \
188         lib/packets.c \
189         lib/packets.h \
190         lib/pcap-file.c \
191         lib/pcap-file.h \
192         lib/perf-counter.h \
193         lib/perf-counter.c \
194         lib/pktbuf.c \
195         lib/pktbuf.h \
196         lib/poll-loop.c \
197         lib/poll-loop.h \
198         lib/process.c \
199         lib/process.h \
200         lib/pvector.c \
201         lib/pvector.h \
202         lib/random.c \
203         lib/random.h \
204         lib/rconn.c \
205         lib/rconn.h \
206         lib/rculist.h \
207         lib/reconnect.c \
208         lib/reconnect.h \
209         lib/rstp.c \
210         lib/rstp.h \
211         lib/rstp-common.h \
212         lib/rstp-state-machines.c \
213         lib/rstp-state-machines.h \
214         lib/sat-math.h \
215         lib/seq.c \
216         lib/seq.h \
217         lib/sha1.c \
218         lib/sha1.h \
219         lib/shash.c \
220         lib/shash.h \
221         lib/simap.c \
222         lib/simap.h \
223         lib/smap.c \
224         lib/smap.h \
225         lib/socket-util.c \
226         lib/socket-util.h \
227         lib/sort.c \
228         lib/sort.h \
229         lib/sset.c \
230         lib/sset.h \
231         lib/stp.c \
232         lib/stp.h \
233         lib/stream-fd.c \
234         lib/stream-fd.h \
235         lib/stream-provider.h \
236         lib/stream-ssl.h \
237         lib/stream-tcp.c \
238         lib/stream.c \
239         lib/stream.h \
240         lib/stdio.c \
241         lib/string.c \
242         lib/svec.c \
243         lib/svec.h \
244         lib/syslog-direct.c \
245         lib/syslog-direct.h \
246         lib/syslog-libc.c \
247         lib/syslog-libc.h \
248         lib/syslog-provider.h \
249         lib/table.c \
250         lib/table.h \
251         lib/timer.c \
252         lib/timer.h \
253         lib/timeval.c \
254         lib/timeval.h \
255         lib/tnl-neigh-cache.c \
256         lib/tnl-neigh-cache.h \
257         lib/tnl-ports.c \
258         lib/tnl-ports.h \
259         lib/netdev-native-tnl.c \
260         lib/netdev-native-tnl.h \
261         lib/token-bucket.c \
262         lib/tun-metadata.c \
263         lib/tun-metadata.h \
264         lib/unaligned.h \
265         lib/unicode.c \
266         lib/unicode.h \
267         lib/unixctl.c \
268         lib/unixctl.h \
269         lib/util.c \
270         lib/util.h \
271         lib/uuid.c \
272         lib/uuid.h \
273         lib/valgrind.h \
274         lib/vconn-provider.h \
275         lib/vconn-stream.c \
276         lib/vconn.c \
277         lib/vlan-bitmap.c \
278         lib/vlan-bitmap.h \
279         lib/vlog.c \
280         lib/lldp/aa-structs.h \
281         lib/lldp/lldp.c \
282         lib/lldp/lldp-const.h \
283         lib/lldp/lldp-tlv.h \
284         lib/lldp/lldpd.c \
285         lib/lldp/lldpd.h \
286         lib/lldp/lldpd-structs.c \
287         lib/lldp/lldpd-structs.h
288
289 if WIN32
290 lib_libopenvswitch_la_SOURCES += \
291         lib/daemon-windows.c \
292         lib/getopt_long.c \
293         lib/getrusage-windows.c \
294         lib/latch-windows.c \
295         lib/route-table-stub.c \
296         lib/if-notifier-stub.c \
297         lib/strsep.c
298 else
299 lib_libopenvswitch_la_SOURCES += \
300         lib/daemon-unix.c \
301         lib/latch-unix.c \
302         lib/signals.c \
303         lib/signals.h \
304         lib/socket-util-unix.c \
305         lib/stream-unix.c
306 endif
307
308 EXTRA_DIST += \
309         lib/stdio.h.in \
310         lib/string.h.in
311
312 nodist_lib_libopenvswitch_la_SOURCES = \
313         lib/dirs.c \
314         lib/vswitch-idl.c \
315         lib/vswitch-idl.h
316 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
317
318 lib_LTLIBRARIES += lib/libsflow.la
319 lib_libsflow_la_LDFLAGS = \
320         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
321         -Wl,--version-script=$(top_builddir)/lib/libsflow.sym \
322         $(AM_LDFLAGS)
323 lib_libsflow_la_SOURCES = \
324         lib/sflow_api.h \
325         lib/sflow.h \
326         lib/sflow_agent.c \
327         lib/sflow_sampler.c \
328         lib/sflow_poller.c \
329         lib/sflow_receiver.c
330 lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
331 lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
332 if HAVE_WNO_UNUSED
333 lib_libsflow_la_CFLAGS += -Wno-unused
334 endif
335 if HAVE_WNO_UNUSED_PARAMETER
336 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
337 endif
338
339 if LINUX
340 lib_libopenvswitch_la_SOURCES += \
341         lib/dpif-netlink.c \
342         lib/dpif-netlink.h \
343         lib/if-notifier.c \
344         lib/if-notifier.h \
345         lib/netdev-linux.c \
346         lib/netdev-linux.h \
347         lib/netlink-conntrack.c \
348         lib/netlink-conntrack.h \
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         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-conntrack.c \
376         lib/netlink-conntrack.h \
377         lib/netlink-notifier.c \
378         lib/netlink-notifier.h \
379         lib/netlink-protocol.h \
380         lib/netlink-socket.c \
381         lib/netlink-socket.h
382 endif
383
384 if HAVE_POSIX_AIO
385 lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
386 else
387 lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
388 endif
389
390 if ESX
391 lib_libopenvswitch_la_SOURCES += \
392         lib/route-table-stub.c \
393         lib/if-notifier-stub.c
394 endif
395
396 if HAVE_IF_DL
397 lib_libopenvswitch_la_SOURCES += \
398         lib/if-notifier-bsd.c \
399         lib/netdev-bsd.c \
400         lib/rtbsd.c \
401         lib/rtbsd.h \
402         lib/route-table-bsd.c
403 endif
404
405 if HAVE_OPENSSL
406 lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
407 nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
408 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
409         $(AM_V_GEN)(echo '#include "lib/dhparams.h"' &&                 \
410          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
411          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
412          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
413         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp &&  \
414         mv lib/dhparams.c.tmp lib/dhparams.c
415 else
416 lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
417 endif
418
419 pkgconfig_DATA += \
420         $(srcdir)/lib/libopenvswitch.pc \
421         $(srcdir)/lib/libsflow.pc
422
423 EXTRA_DIST += \
424         lib/dh1024.pem \
425         lib/dh2048.pem \
426         lib/dh4096.pem \
427         lib/dirs.c.in \
428         lib/db-ctl-base.xml
429
430 MAN_FRAGMENTS += \
431         lib/colors.man \
432         lib/common.man \
433         lib/common-syn.man \
434         lib/coverage-unixctl.man \
435         lib/daemon.man \
436         lib/daemon-syn.man \
437         lib/db-ctl-base.man \
438         lib/dpctl.man \
439         lib/memory-unixctl.man \
440         lib/ofp-version.man \
441         lib/ovs.tmac \
442         lib/service.man \
443         lib/service-syn.man \
444         lib/ssl-bootstrap.man \
445         lib/ssl-bootstrap-syn.man \
446         lib/ssl-peer-ca-cert.man \
447         lib/ssl-peer-ca-cert-syn.man \
448         lib/ssl.man \
449         lib/ssl-syn.man \
450         lib/table.man \
451         lib/unixctl.man \
452         lib/unixctl-syn.man \
453         lib/vconn-active.man \
454         lib/vconn-passive.man \
455         lib/vlog-unixctl.man \
456         lib/vlog-syn.man \
457         lib/vlog.man
458
459 # vswitch IDL
460 OVSIDL_BUILT += lib/vswitch-idl.c lib/vswitch-idl.h lib/vswitch-idl.ovsidl
461
462 EXTRA_DIST += lib/vswitch-idl.ann
463 lib/vswitch-idl.ovsidl: vswitchd/vswitch.ovsschema lib/vswitch-idl.ann
464         $(AM_V_GEN)$(OVSDB_IDLC) annotate $(srcdir)/vswitchd/vswitch.ovsschema $(srcdir)/lib/vswitch-idl.ann > $@.tmp && mv $@.tmp $@
465
466 lib/dirs.c: lib/dirs.c.in Makefile
467         $(AM_V_GEN)($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
468                 -e 's,[@]srcdir[@],$(srcdir),g' \
469                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
470                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
471                 -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
472                 -e 's,[@]bindir[@],"$(bindir)",g' \
473                 -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
474                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
475              > lib/dirs.c.tmp && \
476         mv lib/dirs.c.tmp lib/dirs.c
477
478 lib/meta-flow.inc: $(srcdir)/build-aux/extract-ofp-fields include/openvswitch/meta-flow.h
479         $(AM_V_GEN)$(run_python) $^ --meta-flow > $@.tmp && mv $@.tmp $@
480 lib/meta-flow.lo: lib/meta-flow.inc
481 lib/nx-match.inc: $(srcdir)/build-aux/extract-ofp-fields include/openvswitch/meta-flow.h
482         $(AM_V_GEN)$(run_python) $^ --nx-match > $@.tmp && mv $@.tmp $@
483 lib/nx-match.lo: lib/nx-match.inc
484 CLEANFILES += lib/meta-flow.inc lib/nx-match.inc
485 EXTRA_DIST += build-aux/extract-ofp-fields
486
487 lib/ofp-actions.inc1: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
488         $(AM_V_GEN)$(run_python) $^ --prototypes > $@.tmp && mv $@.tmp $@
489 lib/ofp-actions.inc2: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
490         $(AM_V_GEN)$(run_python) $^ --definitions > $@.tmp && mv $@.tmp $@
491 lib/ofp-actions.lo: lib/ofp-actions.inc1 lib/ofp-actions.inc2
492 CLEANFILES += lib/ofp-actions.inc1 lib/ofp-actions.inc2
493 EXTRA_DIST += build-aux/extract-ofp-actions
494
495 lib/ofp-errors.inc: include/openvswitch/ofp-errors.h include/openflow/openflow-common.h \
496         $(srcdir)/build-aux/extract-ofp-errors
497         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-errors \
498                 $(srcdir)/include/openvswitch/ofp-errors.h \
499                 $(srcdir)/include/openflow/openflow-common.h > $@.tmp && \
500         mv $@.tmp $@
501 lib/ofp-errors.lo: lib/ofp-errors.inc
502 CLEANFILES += lib/ofp-errors.inc
503 EXTRA_DIST += build-aux/extract-ofp-errors
504
505 lib/ofp-msgs.inc: include/openvswitch/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
506         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
507                 $(srcdir)/include/openvswitch/ofp-msgs.h $@ > $@.tmp && mv $@.tmp $@
508 lib/ofp-msgs.lo: lib/ofp-msgs.inc
509 CLEANFILES += lib/ofp-msgs.inc
510 EXTRA_DIST += build-aux/extract-ofp-msgs
511
512 INSTALL_DATA_LOCAL += lib-install-data-local
513 lib-install-data-local:
514         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
515         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
516         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
517         $(MKDIR_P) $(DESTDIR)$(DBDIR)