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