a22f5f37a0edebe0655d1a0cef32b01c7733e80b
[cascardo/ovs.git] / lib / automake.mk
1 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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/type-props.h \
254         lib/unaligned.h \
255         lib/unicode.c \
256         lib/unicode.h \
257         lib/unixctl.c \
258         lib/unixctl.h \
259         lib/util.c \
260         lib/util.h \
261         lib/uuid.c \
262         lib/uuid.h \
263         lib/valgrind.h \
264         lib/vconn-provider.h \
265         lib/vconn-stream.c \
266         lib/vconn.c \
267         lib/vlan-bitmap.c \
268         lib/vlan-bitmap.h \
269         lib/vlandev.c \
270         lib/vlandev.h \
271         lib/vlog.c \
272         lib/vswitch-idl.c \
273         lib/vswitch-idl.h \
274         lib/lldp/aa-structs.h \
275         lib/lldp/lldp.c \
276         lib/lldp/lldp-const.h \
277         lib/lldp/lldp-tlv.h \
278         lib/lldp/lldpd.c \
279         lib/lldp/lldpd.h \
280         lib/lldp/lldpd-structs.c \
281         lib/lldp/lldpd-structs.h
282
283 if WIN32
284 lib_libopenvswitch_la_SOURCES += \
285         lib/daemon-windows.c \
286         lib/getopt_long.c \
287         lib/getrusage-windows.c \
288         lib/latch-windows.c \
289         lib/route-table-stub.c \
290         lib/strsep.c
291 else
292 lib_libopenvswitch_la_SOURCES += \
293         lib/daemon-unix.c \
294         lib/latch-unix.c \
295         lib/signals.c \
296         lib/signals.h \
297         lib/socket-util-unix.c \
298         lib/stream-unix.c
299 endif
300
301 EXTRA_DIST += \
302         lib/stdio.h.in \
303         lib/string.h.in
304
305 nodist_lib_libopenvswitch_la_SOURCES = \
306         lib/dirs.c
307 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
308
309 lib_LTLIBRARIES += lib/libsflow.la
310 lib_libsflow_la_LDFLAGS = \
311         -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
312         -Wl,--version-script=$(top_builddir)/lib/libsflow.sym \
313         $(AM_LDFLAGS)
314 lib_libsflow_la_SOURCES = \
315         lib/sflow_api.h \
316         lib/sflow.h \
317         lib/sflow_agent.c \
318         lib/sflow_sampler.c \
319         lib/sflow_poller.c \
320         lib/sflow_receiver.c
321 lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
322 lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
323 if HAVE_WNO_UNUSED
324 lib_libsflow_la_CFLAGS += -Wno-unused
325 endif
326 if HAVE_WNO_UNUSED_PARAMETER
327 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
328 endif
329
330 if LINUX
331 lib_libopenvswitch_la_SOURCES += \
332         lib/dpif-netlink.c \
333         lib/dpif-netlink.h \
334         lib/netdev-linux.c \
335         lib/netdev-linux.h \
336         lib/netlink-notifier.c \
337         lib/netlink-notifier.h \
338         lib/netlink-protocol.h \
339         lib/netlink-socket.c \
340         lib/netlink-socket.h \
341         lib/ovs-numa.c \
342         lib/ovs-numa.h \
343         lib/rtnetlink-link.c \
344         lib/rtnetlink-link.h \
345         lib/route-table.c \
346         lib/route-table.h
347 endif
348
349 if DPDK_NETDEV
350 lib_libopenvswitch_la_SOURCES += \
351        lib/netdev-dpdk.c \
352        lib/netdev-dpdk.h
353 endif
354
355 if WIN32
356 lib_libopenvswitch_la_SOURCES += \
357         lib/dpif-netlink.c \
358         lib/dpif-netlink.h \
359         lib/netdev-windows.c \
360         lib/netlink-notifier.c \
361         lib/netlink-notifier.h \
362         lib/netlink-protocol.h \
363         lib/netlink-socket.c \
364         lib/netlink-socket.h
365 endif
366
367 if HAVE_POSIX_AIO
368 lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
369 else
370 lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
371 endif
372
373 if ESX
374 lib_libopenvswitch_la_SOURCES += \
375         lib/route-table-stub.c
376 endif
377
378 if HAVE_IF_DL
379 lib_libopenvswitch_la_SOURCES += \
380         lib/netdev-bsd.c \
381         lib/rtbsd.c \
382         lib/rtbsd.h \
383         lib/route-table-bsd.c
384 endif
385
386 if HAVE_OPENSSL
387 lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
388 nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
389 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
390         $(AM_V_GEN)(echo '#include "lib/dhparams.h"' &&                 \
391          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
392          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
393          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
394         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp &&  \
395         mv lib/dhparams.c.tmp lib/dhparams.c
396 else
397 lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
398 endif
399
400 pkgconfig_DATA += \
401         $(srcdir)/lib/libopenvswitch.pc \
402         $(srcdir)/lib/libsflow.pc
403
404 EXTRA_DIST += \
405         lib/dh1024.pem \
406         lib/dh2048.pem \
407         lib/dh4096.pem \
408         lib/dirs.c.in
409
410 MAN_FRAGMENTS += \
411         lib/common.man \
412         lib/common-syn.man \
413         lib/coverage-unixctl.man \
414         lib/daemon.man \
415         lib/daemon-syn.man \
416         lib/db-ctl-base.man \
417         lib/dpctl.man \
418         lib/memory-unixctl.man \
419         lib/ofp-version.man \
420         lib/ovs.tmac \
421         lib/service.man \
422         lib/service-syn.man \
423         lib/ssl-bootstrap.man \
424         lib/ssl-bootstrap-syn.man \
425         lib/ssl-peer-ca-cert.man \
426         lib/ssl.man \
427         lib/ssl-syn.man \
428         lib/table.man \
429         lib/unixctl.man \
430         lib/unixctl-syn.man \
431         lib/vconn-active.man \
432         lib/vconn-passive.man \
433         lib/vlog-unixctl.man \
434         lib/vlog-syn.man \
435         lib/vlog.man
436
437 # vswitch IDL
438 OVSIDL_BUILT += \
439         $(srcdir)/lib/vswitch-idl.c \
440         $(srcdir)/lib/vswitch-idl.h \
441         $(srcdir)/lib/vswitch-idl.ovsidl
442
443 EXTRA_DIST += $(srcdir)/lib/vswitch-idl.ann
444 VSWITCH_IDL_FILES = \
445         $(srcdir)/vswitchd/vswitch.ovsschema \
446         $(srcdir)/lib/vswitch-idl.ann
447 $(srcdir)/lib/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES)
448         $(AM_V_GEN)$(OVSDB_IDLC) annotate $(VSWITCH_IDL_FILES) > $@.tmp && \
449         mv $@.tmp $@
450
451 lib/dirs.c: lib/dirs.c.in Makefile
452         $(AM_V_GEN)($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
453                 -e 's,[@]srcdir[@],$(srcdir),g' \
454                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
455                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
456                 -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
457                 -e 's,[@]bindir[@],"$(bindir)",g' \
458                 -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
459                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
460              > lib/dirs.c.tmp && \
461         mv lib/dirs.c.tmp lib/dirs.c
462
463 lib/meta-flow.inc: $(srcdir)/build-aux/extract-ofp-fields lib/meta-flow.h
464         $(AM_V_GEN)$(run_python) $^ --meta-flow > $@.tmp && mv $@.tmp $@
465 lib/meta-flow.lo: lib/meta-flow.inc
466 lib/nx-match.inc: $(srcdir)/build-aux/extract-ofp-fields lib/meta-flow.h
467         $(AM_V_GEN)$(run_python) $^ --nx-match > $@.tmp && mv $@.tmp $@
468 lib/nx-match.lo: lib/nx-match.inc
469 CLEANFILES += lib/meta-flow.inc lib/nx-match.inc
470 EXTRA_DIST += build-aux/extract-ofp-fields
471
472 lib/ofp-actions.inc1: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
473         $(AM_V_GEN)$(run_python) $^ --prototypes > $@.tmp && mv $@.tmp $@
474 lib/ofp-actions.inc2: $(srcdir)/build-aux/extract-ofp-actions lib/ofp-actions.c
475         $(AM_V_GEN)$(run_python) $^ --definitions > $@.tmp && mv $@.tmp $@
476 lib/ofp-actions.lo: lib/ofp-actions.inc1 lib/ofp-actions.inc2
477 CLEANFILES += lib/ofp-actions.inc1 lib/ofp-actions.inc2
478 EXTRA_DIST += build-aux/extract-ofp-actions
479
480 $(srcdir)/lib/ofp-errors.inc: \
481         lib/ofp-errors.h include/openflow/openflow-common.h \
482         $(srcdir)/build-aux/extract-ofp-errors
483         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-errors \
484                 $(srcdir)/lib/ofp-errors.h \
485                 $(srcdir)/include/openflow/openflow-common.h > $@.tmp && \
486         mv $@.tmp $@
487 $(srcdir)/lib/ofp-errors.c: $(srcdir)/lib/ofp-errors.inc
488 EXTRA_DIST += build-aux/extract-ofp-errors lib/ofp-errors.inc
489
490 $(srcdir)/lib/ofp-msgs.inc: \
491         lib/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
492         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
493                 $(srcdir)/lib/ofp-msgs.h $@ > $@.tmp && mv $@.tmp $@
494 $(srcdir)/lib/ofp-msgs.c: $(srcdir)/lib/ofp-msgs.inc
495 EXTRA_DIST += build-aux/extract-ofp-msgs lib/ofp-msgs.inc
496
497 INSTALL_DATA_LOCAL += lib-install-data-local
498 lib-install-data-local:
499         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
500         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
501         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
502         $(MKDIR_P) $(DESTDIR)$(DBDIR)
503