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