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