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