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