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