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