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