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