4ff9fc0a3ce1451891377c393ace1581599a450d
[cascardo/ovs.git] / lib / automake.mk
1 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 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/cmap.c \
42         lib/cmap.h \
43         lib/command-line.c \
44         lib/command-line.h \
45         lib/compiler.h \
46         lib/connectivity.c \
47         lib/connectivity.h \
48         lib/coverage.c \
49         lib/coverage.h \
50         lib/crc32c.c \
51         lib/crc32c.h \
52         lib/csum.c \
53         lib/csum.h \
54         lib/ct-dpif.c \
55         lib/ct-dpif.h \
56         lib/daemon.c \
57         lib/daemon.h \
58         lib/daemon-private.h \
59         lib/db-ctl-base.c \
60         lib/db-ctl-base.h \
61         lib/dhcp.h \
62         lib/dummy.c \
63         lib/dummy.h \
64         lib/dhparams.h \
65         lib/dirs.h \
66         lib/dpctl.c \
67         lib/dpctl.h \
68         lib/dp-packet.h \
69         lib/dp-packet.c \
70         lib/dpif-netdev.c \
71         lib/dpif-netdev.h \
72         lib/dpif-provider.h \
73         lib/dpif.c \
74         lib/dpif.h \
75         lib/heap.c \
76         lib/heap.h \
77         lib/dynamic-string.c \
78         lib/dynamic-string.h \
79         lib/entropy.c \
80         lib/entropy.h \
81         lib/fat-rwlock.c \
82         lib/fat-rwlock.h \
83         lib/fatal-signal.c \
84         lib/fatal-signal.h \
85         lib/flow.c \
86         lib/flow.h \
87         lib/geneve.h \
88         lib/guarded-list.c \
89         lib/guarded-list.h \
90         lib/hash.c \
91         lib/hash.h \
92         lib/hindex.c \
93         lib/hindex.h \
94         lib/hmap.c \
95         lib/hmap.h \
96         lib/hmapx.c \
97         lib/hmapx.h \
98         lib/id-pool.c \
99         lib/id-pool.h \
100         lib/jhash.c \
101         lib/jhash.h \
102         lib/json.c \
103         lib/json.h \
104         lib/jsonrpc.c \
105         lib/jsonrpc.h \
106         lib/lacp.c \
107         lib/lacp.h \
108         lib/latch.h \
109         lib/learn.c \
110         lib/learn.h \
111         lib/learning-switch.c \
112         lib/learning-switch.h \
113         lib/list.h \
114         lib/lockfile.c \
115         lib/lockfile.h \
116         lib/mac-learning.c \
117         lib/mac-learning.h \
118         lib/match.c \
119         lib/match.h \
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/meta-flow.h \
126         lib/multipath.c \
127         lib/multipath.h \
128         lib/netdev-dummy.c \
129         lib/netdev-provider.h \
130         lib/netdev-vport.c \
131         lib/netdev-vport.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-actions.h \
145         lib/ofp-errors.c \
146         lib/ofp-errors.h \
147         lib/ofp-msgs.c \
148         lib/ofp-msgs.h \
149         lib/ofp-parse.c \
150         lib/ofp-parse.h \
151         lib/ofp-print.c \
152         lib/ofp-print.h \
153         lib/ofp-util.c \
154         lib/ofp-util.h \
155         lib/ofp-version-opt.h \
156         lib/ofp-version-opt.c \
157         lib/ofpbuf.c \
158         lib/ofpbuf.h \
159         lib/ovs-atomic-c11.h \
160         lib/ovs-atomic-clang.h \
161         lib/ovs-atomic-flag-gcc4.7+.h \
162         lib/ovs-atomic-gcc4+.h \
163         lib/ovs-atomic-gcc4.7+.h \
164         lib/ovs-atomic-i586.h \
165         lib/ovs-atomic-locked.c \
166         lib/ovs-atomic-locked.h \
167         lib/ovs-atomic-msvc.h \
168         lib/ovs-atomic-pthreads.h \
169         lib/ovs-atomic-x86_64.h \
170         lib/ovs-atomic.h \
171         lib/ovs-lldp.c \
172         lib/ovs-lldp.h \
173         lib/ovs-rcu.c \
174         lib/ovs-rcu.h \
175         lib/ovs-router.h \
176         lib/ovs-router.c \
177         lib/ovs-thread.c \
178         lib/ovs-thread.h \
179         lib/ovsdb-data.c \
180         lib/ovsdb-data.h \
181         lib/ovsdb-error.c \
182         lib/ovsdb-error.h \
183         lib/ovsdb-idl-provider.h \
184         lib/ovsdb-idl.c \
185         lib/ovsdb-idl.h \
186         lib/ovsdb-parser.c \
187         lib/ovsdb-parser.h \
188         lib/ovsdb-types.c \
189         lib/ovsdb-types.h \
190         lib/packets.c \
191         lib/packets.h \
192         lib/pcap-file.c \
193         lib/pcap-file.h \
194         lib/perf-counter.h \
195         lib/perf-counter.c \
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/token-bucket.c \
260         lib/tun-metadata.c \
261         lib/tun-metadata.h \
262         lib/type-props.h \
263         lib/unaligned.h \
264         lib/unicode.c \
265         lib/unicode.h \
266         lib/unixctl.c \
267         lib/unixctl.h \
268         lib/util.c \
269         lib/util.h \
270         lib/uuid.c \
271         lib/uuid.h \
272         lib/valgrind.h \
273         lib/vconn-provider.h \
274         lib/vconn-stream.c \
275         lib/vconn.c \
276         lib/vlan-bitmap.c \
277         lib/vlan-bitmap.h \
278         lib/vlandev.c \
279         lib/vlandev.h \
280         lib/vlog.c \
281         lib/lldp/aa-structs.h \
282         lib/lldp/lldp.c \
283         lib/lldp/lldp-const.h \
284         lib/lldp/lldp-tlv.h \
285         lib/lldp/lldpd.c \
286         lib/lldp/lldpd.h \
287         lib/lldp/lldpd-structs.c \
288         lib/lldp/lldpd-structs.h
289
290 if WIN32
291 lib_libopenvswitch_la_SOURCES += \
292         lib/daemon-windows.c \
293         lib/getopt_long.c \
294         lib/getrusage-windows.c \
295         lib/latch-windows.c \
296         lib/route-table-stub.c \
297         lib/if-notifier-stub.c \
298         lib/strsep.c
299 else
300 lib_libopenvswitch_la_SOURCES += \
301         lib/daemon-unix.c \
302         lib/latch-unix.c \
303         lib/signals.c \
304         lib/signals.h \
305         lib/socket-util-unix.c \
306         lib/stream-unix.c
307 endif
308
309 EXTRA_DIST += \
310         lib/stdio.h.in \
311         lib/string.h.in
312
313 nodist_lib_libopenvswitch_la_SOURCES = \
314         lib/dirs.c \
315         lib/vswitch-idl.c \
316         lib/vswitch-idl.h
317 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
318
319 lib_LTLIBRARIES += lib/libsflow.la
320 lib_libsflow_la_LDFLAGS = \
321         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
322         -Wl,--version-script=$(top_builddir)/lib/libsflow.sym \
323         $(AM_LDFLAGS)
324 lib_libsflow_la_SOURCES = \
325         lib/sflow_api.h \
326         lib/sflow.h \
327         lib/sflow_agent.c \
328         lib/sflow_sampler.c \
329         lib/sflow_poller.c \
330         lib/sflow_receiver.c
331 lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
332 lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
333 if HAVE_WNO_UNUSED
334 lib_libsflow_la_CFLAGS += -Wno-unused
335 endif
336 if HAVE_WNO_UNUSED_PARAMETER
337 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
338 endif
339
340 if LINUX
341 lib_libopenvswitch_la_SOURCES += \
342         lib/dpif-netlink.c \
343         lib/dpif-netlink.h \
344         lib/if-notifier.c \
345         lib/if-notifier.h \
346         lib/netdev-linux.c \
347         lib/netdev-linux.h \
348         lib/netlink-conntrack.c \
349         lib/netlink-conntrack.h \
350         lib/netlink-notifier.c \
351         lib/netlink-notifier.h \
352         lib/netlink-protocol.h \
353         lib/netlink-socket.c \
354         lib/netlink-socket.h \
355         lib/ovs-numa.c \
356         lib/ovs-numa.h \
357         lib/rtnetlink.c \
358         lib/rtnetlink.h \
359         lib/route-table.c \
360         lib/route-table.h
361 endif
362
363 if DPDK_NETDEV
364 lib_libopenvswitch_la_SOURCES += \
365        lib/netdev-dpdk.c \
366        lib/netdev-dpdk.h
367 endif
368
369 if WIN32
370 lib_libopenvswitch_la_SOURCES += \
371         lib/dpif-netlink.c \
372         lib/dpif-netlink.h \
373         lib/netdev-windows.c \
374         lib/netlink-notifier.c \
375         lib/netlink-notifier.h \
376         lib/netlink-protocol.h \
377         lib/netlink-socket.c \
378         lib/netlink-socket.h
379 endif
380
381 if HAVE_POSIX_AIO
382 lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
383 else
384 lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
385 endif
386
387 if ESX
388 lib_libopenvswitch_la_SOURCES += \
389         lib/route-table-stub.c \
390         lib/if-notifier-stub.c
391 endif
392
393 if HAVE_IF_DL
394 lib_libopenvswitch_la_SOURCES += \
395         lib/if-notifier-bsd.c \
396         lib/netdev-bsd.c \
397         lib/rtbsd.c \
398         lib/rtbsd.h \
399         lib/route-table-bsd.c
400 endif
401
402 if HAVE_OPENSSL
403 lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
404 nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
405 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
406         $(AM_V_GEN)(echo '#include "lib/dhparams.h"' &&                 \
407          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
408          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
409          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
410         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp &&  \
411         mv lib/dhparams.c.tmp lib/dhparams.c
412 else
413 lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
414 endif
415
416 pkgconfig_DATA += \
417         $(srcdir)/lib/libopenvswitch.pc \
418         $(srcdir)/lib/libsflow.pc
419
420 EXTRA_DIST += \
421         lib/dh1024.pem \
422         lib/dh2048.pem \
423         lib/dh4096.pem \
424         lib/dirs.c.in \
425         lib/db-ctl-base.xml
426
427 MAN_FRAGMENTS += \
428         lib/common.man \
429         lib/common-syn.man \
430         lib/coverage-unixctl.man \
431         lib/daemon.man \
432         lib/daemon-syn.man \
433         lib/db-ctl-base.man \
434         lib/dpctl.man \
435         lib/memory-unixctl.man \
436         lib/ofp-version.man \
437         lib/ovs.tmac \
438         lib/service.man \
439         lib/service-syn.man \
440         lib/ssl-bootstrap.man \
441         lib/ssl-bootstrap-syn.man \
442         lib/ssl-peer-ca-cert.man \
443         lib/ssl-peer-ca-cert-syn.man \
444         lib/ssl.man \
445         lib/ssl-syn.man \
446         lib/table.man \
447         lib/unixctl.man \
448         lib/unixctl-syn.man \
449         lib/vconn-active.man \
450         lib/vconn-passive.man \
451         lib/vlog-unixctl.man \
452         lib/vlog-syn.man \
453         lib/vlog.man
454
455 # vswitch IDL
456 OVSIDL_BUILT += lib/vswitch-idl.c lib/vswitch-idl.h lib/vswitch-idl.ovsidl
457
458 EXTRA_DIST += lib/vswitch-idl.ann
459 lib/vswitch-idl.ovsidl: vswitchd/vswitch.ovsschema lib/vswitch-idl.ann
460         $(AM_V_GEN)$(OVSDB_IDLC) annotate $(srcdir)/vswitchd/vswitch.ovsschema $(srcdir)/lib/vswitch-idl.ann > $@.tmp && mv $@.tmp $@
461
462 lib/dirs.c: lib/dirs.c.in Makefile
463         $(AM_V_GEN)($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
464                 -e 's,[@]srcdir[@],$(srcdir),g' \
465                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
466                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
467                 -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
468                 -e 's,[@]bindir[@],"$(bindir)",g' \
469                 -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
470                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
471              > lib/dirs.c.tmp && \
472         mv lib/dirs.c.tmp lib/dirs.c
473
474 lib/meta-flow.inc: $(srcdir)/build-aux/extract-ofp-fields lib/meta-flow.h
475         $(AM_V_GEN)$(run_python) $^ --meta-flow > $@.tmp && mv $@.tmp $@
476 lib/meta-flow.lo: lib/meta-flow.inc
477 lib/nx-match.inc: $(srcdir)/build-aux/extract-ofp-fields lib/meta-flow.h
478         $(AM_V_GEN)$(run_python) $^ --nx-match > $@.tmp && mv $@.tmp $@
479 lib/nx-match.lo: lib/nx-match.inc
480 CLEANFILES += lib/meta-flow.inc lib/nx-match.inc
481 EXTRA_DIST += build-aux/extract-ofp-fields
482
483 lib/ofp-actions.inc1: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
484         $(AM_V_GEN)$(run_python) $^ --prototypes > $@.tmp && mv $@.tmp $@
485 lib/ofp-actions.inc2: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
486         $(AM_V_GEN)$(run_python) $^ --definitions > $@.tmp && mv $@.tmp $@
487 lib/ofp-actions.lo: lib/ofp-actions.inc1 lib/ofp-actions.inc2
488 CLEANFILES += lib/ofp-actions.inc1 lib/ofp-actions.inc2
489 EXTRA_DIST += build-aux/extract-ofp-actions
490
491 lib/ofp-errors.inc: lib/ofp-errors.h include/openflow/openflow-common.h \
492         $(srcdir)/build-aux/extract-ofp-errors
493         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-errors \
494                 $(srcdir)/lib/ofp-errors.h \
495                 $(srcdir)/include/openflow/openflow-common.h > $@.tmp && \
496         mv $@.tmp $@
497 lib/ofp-errors.lo: lib/ofp-errors.inc
498 CLEANFILES += lib/ofp-errors.inc
499 EXTRA_DIST += build-aux/extract-ofp-errors
500
501 lib/ofp-msgs.inc: lib/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
502         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
503                 $(srcdir)/lib/ofp-msgs.h $@ > $@.tmp && mv $@.tmp $@
504 lib/ofp-msgs.lo: lib/ofp-msgs.inc
505 CLEANFILES += lib/ofp-msgs.inc
506 EXTRA_DIST += build-aux/extract-ofp-msgs
507
508 INSTALL_DATA_LOCAL += lib-install-data-local
509 lib-install-data-local:
510         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
511         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
512         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
513         $(MKDIR_P) $(DESTDIR)$(DBDIR)
514