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