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