39a652be00ab92d9b3be3650f34624a689ada198
[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-prop.c \
154         lib/ofp-prop.h \
155         lib/ofp-util.c \
156         lib/ofp-util.h \
157         lib/ofp-version-opt.h \
158         lib/ofp-version-opt.c \
159         lib/ofpbuf.c \
160         lib/ofpbuf.h \
161         lib/ovs-atomic-c11.h \
162         lib/ovs-atomic-clang.h \
163         lib/ovs-atomic-flag-gcc4.7+.h \
164         lib/ovs-atomic-gcc4+.h \
165         lib/ovs-atomic-gcc4.7+.h \
166         lib/ovs-atomic-i586.h \
167         lib/ovs-atomic-locked.c \
168         lib/ovs-atomic-locked.h \
169         lib/ovs-atomic-msvc.h \
170         lib/ovs-atomic-pthreads.h \
171         lib/ovs-atomic-x86_64.h \
172         lib/ovs-atomic.h \
173         lib/ovs-lldp.c \
174         lib/ovs-lldp.h \
175         lib/ovs-rcu.c \
176         lib/ovs-rcu.h \
177         lib/ovs-router.h \
178         lib/ovs-router.c \
179         lib/ovs-thread.c \
180         lib/ovs-thread.h \
181         lib/ovsdb-data.c \
182         lib/ovsdb-data.h \
183         lib/ovsdb-error.c \
184         lib/ovsdb-error.h \
185         lib/ovsdb-idl-provider.h \
186         lib/ovsdb-idl.c \
187         lib/ovsdb-idl.h \
188         lib/ovsdb-parser.c \
189         lib/ovsdb-parser.h \
190         lib/ovsdb-types.c \
191         lib/ovsdb-types.h \
192         lib/packets.c \
193         lib/packets.h \
194         lib/pcap-file.c \
195         lib/pcap-file.h \
196         lib/perf-counter.h \
197         lib/perf-counter.c \
198         lib/poll-loop.c \
199         lib/poll-loop.h \
200         lib/process.c \
201         lib/process.h \
202         lib/pvector.c \
203         lib/pvector.h \
204         lib/random.c \
205         lib/random.h \
206         lib/rconn.c \
207         lib/rconn.h \
208         lib/rculist.h \
209         lib/reconnect.c \
210         lib/reconnect.h \
211         lib/rstp.c \
212         lib/rstp.h \
213         lib/rstp-common.h \
214         lib/rstp-state-machines.c \
215         lib/rstp-state-machines.h \
216         lib/sat-math.h \
217         lib/seq.c \
218         lib/seq.h \
219         lib/sha1.c \
220         lib/sha1.h \
221         lib/shash.c \
222         lib/shash.h \
223         lib/simap.c \
224         lib/simap.h \
225         lib/smap.c \
226         lib/smap.h \
227         lib/socket-util.c \
228         lib/socket-util.h \
229         lib/sort.c \
230         lib/sort.h \
231         lib/sset.c \
232         lib/sset.h \
233         lib/stp.c \
234         lib/stp.h \
235         lib/stream-fd.c \
236         lib/stream-fd.h \
237         lib/stream-provider.h \
238         lib/stream-ssl.h \
239         lib/stream-tcp.c \
240         lib/stream.c \
241         lib/stream.h \
242         lib/stdio.c \
243         lib/string.c \
244         lib/svec.c \
245         lib/svec.h \
246         lib/syslog-direct.c \
247         lib/syslog-direct.h \
248         lib/syslog-libc.c \
249         lib/syslog-libc.h \
250         lib/syslog-provider.h \
251         lib/table.c \
252         lib/table.h \
253         lib/timer.c \
254         lib/timer.h \
255         lib/timeval.c \
256         lib/timeval.h \
257         lib/tnl-neigh-cache.c \
258         lib/tnl-neigh-cache.h \
259         lib/tnl-ports.c \
260         lib/tnl-ports.h \
261         lib/token-bucket.c \
262         lib/tun-metadata.c \
263         lib/tun-metadata.h \
264         lib/type-props.h \
265         lib/unaligned.h \
266         lib/unicode.c \
267         lib/unicode.h \
268         lib/unixctl.c \
269         lib/unixctl.h \
270         lib/util.c \
271         lib/util.h \
272         lib/uuid.c \
273         lib/uuid.h \
274         lib/valgrind.h \
275         lib/vconn-provider.h \
276         lib/vconn-stream.c \
277         lib/vconn.c \
278         lib/vlan-bitmap.c \
279         lib/vlan-bitmap.h \
280         lib/vlandev.c \
281         lib/vlandev.h \
282         lib/vlog.c \
283         lib/lldp/aa-structs.h \
284         lib/lldp/lldp.c \
285         lib/lldp/lldp-const.h \
286         lib/lldp/lldp-tlv.h \
287         lib/lldp/lldpd.c \
288         lib/lldp/lldpd.h \
289         lib/lldp/lldpd-structs.c \
290         lib/lldp/lldpd-structs.h
291
292 if WIN32
293 lib_libopenvswitch_la_SOURCES += \
294         lib/daemon-windows.c \
295         lib/getopt_long.c \
296         lib/getrusage-windows.c \
297         lib/latch-windows.c \
298         lib/route-table-stub.c \
299         lib/if-notifier-stub.c \
300         lib/strsep.c
301 else
302 lib_libopenvswitch_la_SOURCES += \
303         lib/daemon-unix.c \
304         lib/latch-unix.c \
305         lib/signals.c \
306         lib/signals.h \
307         lib/socket-util-unix.c \
308         lib/stream-unix.c
309 endif
310
311 EXTRA_DIST += \
312         lib/stdio.h.in \
313         lib/string.h.in
314
315 nodist_lib_libopenvswitch_la_SOURCES = \
316         lib/dirs.c \
317         lib/vswitch-idl.c \
318         lib/vswitch-idl.h
319 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
320
321 lib_LTLIBRARIES += lib/libsflow.la
322 lib_libsflow_la_LDFLAGS = \
323         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
324         -Wl,--version-script=$(top_builddir)/lib/libsflow.sym \
325         $(AM_LDFLAGS)
326 lib_libsflow_la_SOURCES = \
327         lib/sflow_api.h \
328         lib/sflow.h \
329         lib/sflow_agent.c \
330         lib/sflow_sampler.c \
331         lib/sflow_poller.c \
332         lib/sflow_receiver.c
333 lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
334 lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
335 if HAVE_WNO_UNUSED
336 lib_libsflow_la_CFLAGS += -Wno-unused
337 endif
338 if HAVE_WNO_UNUSED_PARAMETER
339 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
340 endif
341
342 if LINUX
343 lib_libopenvswitch_la_SOURCES += \
344         lib/dpif-netlink.c \
345         lib/dpif-netlink.h \
346         lib/if-notifier.c \
347         lib/if-notifier.h \
348         lib/netdev-linux.c \
349         lib/netdev-linux.h \
350         lib/netlink-conntrack.c \
351         lib/netlink-conntrack.h \
352         lib/netlink-notifier.c \
353         lib/netlink-notifier.h \
354         lib/netlink-protocol.h \
355         lib/netlink-socket.c \
356         lib/netlink-socket.h \
357         lib/ovs-numa.c \
358         lib/ovs-numa.h \
359         lib/rtnetlink.c \
360         lib/rtnetlink.h \
361         lib/route-table.c \
362         lib/route-table.h
363 endif
364
365 if DPDK_NETDEV
366 lib_libopenvswitch_la_SOURCES += \
367        lib/netdev-dpdk.c \
368        lib/netdev-dpdk.h
369 endif
370
371 if WIN32
372 lib_libopenvswitch_la_SOURCES += \
373         lib/dpif-netlink.c \
374         lib/dpif-netlink.h \
375         lib/netdev-windows.c \
376         lib/netlink-notifier.c \
377         lib/netlink-notifier.h \
378         lib/netlink-protocol.h \
379         lib/netlink-socket.c \
380         lib/netlink-socket.h
381 endif
382
383 if HAVE_POSIX_AIO
384 lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
385 else
386 lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
387 endif
388
389 if ESX
390 lib_libopenvswitch_la_SOURCES += \
391         lib/route-table-stub.c \
392         lib/if-notifier-stub.c
393 endif
394
395 if HAVE_IF_DL
396 lib_libopenvswitch_la_SOURCES += \
397         lib/if-notifier-bsd.c \
398         lib/netdev-bsd.c \
399         lib/rtbsd.c \
400         lib/rtbsd.h \
401         lib/route-table-bsd.c
402 endif
403
404 if HAVE_OPENSSL
405 lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
406 nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
407 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
408         $(AM_V_GEN)(echo '#include "lib/dhparams.h"' &&                 \
409          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
410          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
411          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
412         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp &&  \
413         mv lib/dhparams.c.tmp lib/dhparams.c
414 else
415 lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
416 endif
417
418 pkgconfig_DATA += \
419         $(srcdir)/lib/libopenvswitch.pc \
420         $(srcdir)/lib/libsflow.pc
421
422 EXTRA_DIST += \
423         lib/dh1024.pem \
424         lib/dh2048.pem \
425         lib/dh4096.pem \
426         lib/dirs.c.in \
427         lib/db-ctl-base.xml
428
429 MAN_FRAGMENTS += \
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 lib/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 lib/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: lib/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)/lib/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: lib/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
504         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
505                 $(srcdir)/lib/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)
516