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/bundle.c \
21         lib/bundle.h \
22         lib/byte-order.h \
23         lib/byteq.c \
24         lib/byteq.h \
25         lib/cfm.c \
26         lib/cfm.h \
27         lib/classifier.c \
28         lib/classifier.h \
29         lib/command-line.c \
30         lib/command-line.h \
31         lib/compiler.h \
32         lib/coverage.c \
33         lib/coverage.h \
34         lib/crc32c.c \
35         lib/crc32c.h \
36         lib/csum.c \
37         lib/csum.h \
38         lib/daemon.c \
39         lib/daemon.h \
40         lib/dhcp.h \
41         lib/dummy.c \
42         lib/dummy.h \
43         lib/dhparams.h \
44         lib/dirs.h \
45         lib/dpif-netdev.c \
46         lib/dpif-provider.h \
47         lib/dpif.c \
48         lib/dpif.h \
49         lib/heap.c \
50         lib/heap.h \
51         lib/dynamic-string.c \
52         lib/dynamic-string.h \
53         lib/entropy.c \
54         lib/entropy.h \
55         lib/fatal-signal.c \
56         lib/fatal-signal.h \
57         lib/flow.c \
58         lib/flow.h \
59         lib/guarded-list.c \
60         lib/guarded-list.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-clang.h \
133         lib/ovs-atomic-flag-gcc4.7+.h \
134         lib/ovs-atomic-gcc4+.c \
135         lib/ovs-atomic-gcc4+.h \
136         lib/ovs-atomic-gcc4.7+.h \
137         lib/ovs-atomic-pthreads.c \
138         lib/ovs-atomic-pthreads.h \
139         lib/ovs-atomic.h \
140         lib/ovs-thread.c \
141         lib/ovs-thread.h \
142         lib/ovsdb-data.c \
143         lib/ovsdb-data.h \
144         lib/ovsdb-error.c \
145         lib/ovsdb-error.h \
146         lib/ovsdb-idl-provider.h \
147         lib/ovsdb-idl.c \
148         lib/ovsdb-idl.h \
149         lib/ovsdb-parser.c \
150         lib/ovsdb-parser.h \
151         lib/ovsdb-types.c \
152         lib/ovsdb-types.h \
153         lib/packets.c \
154         lib/packets.h \
155         lib/pcap-file.c \
156         lib/pcap-file.h \
157         lib/poll-loop.c \
158         lib/poll-loop.h \
159         lib/process.c \
160         lib/process.h \
161         lib/random.c \
162         lib/random.h \
163         lib/rconn.c \
164         lib/rconn.h \
165         lib/reconnect.c \
166         lib/reconnect.h \
167         lib/sat-math.h \
168         lib/seq.c \
169         lib/seq.h \
170         lib/sha1.c \
171         lib/sha1.h \
172         lib/shash.c \
173         lib/shash.h \
174         lib/simap.c \
175         lib/simap.h \
176         lib/signals.c \
177         lib/signals.h \
178         lib/smap.c \
179         lib/smap.h \
180         lib/socket-util.c \
181         lib/socket-util.h \
182         lib/sort.c \
183         lib/sort.h \
184         lib/sset.c \
185         lib/sset.h \
186         lib/stp.c \
187         lib/stp.h \
188         lib/stream-fd.c \
189         lib/stream-fd.h \
190         lib/stream-provider.h \
191         lib/stream-ssl.h \
192         lib/stream-tcp.c \
193         lib/stream-unix.c \
194         lib/stream.c \
195         lib/stream.h \
196         lib/string.c \
197         lib/string.h \
198         lib/svec.c \
199         lib/svec.h \
200         lib/table.c \
201         lib/table.h \
202         lib/tag.c \
203         lib/tag.h \
204         lib/timer.c \
205         lib/timer.h \
206         lib/timeval.c \
207         lib/timeval.h \
208         lib/token-bucket.c \
209         lib/token-bucket.h \
210         lib/tunalloc.c \
211         lib/tunalloc.h \
212         lib/type-props.h \
213         lib/unaligned.h \
214         lib/unicode.c \
215         lib/unicode.h \
216         lib/unixctl.c \
217         lib/unixctl.h \
218         lib/util.c \
219         lib/util.h \
220         lib/uuid.c \
221         lib/uuid.h \
222         lib/valgrind.h \
223         lib/vconn-provider.h \
224         lib/vconn-stream.c \
225         lib/vconn.c \
226         lib/vconn.h \
227         lib/vlan-bitmap.c \
228         lib/vlan-bitmap.h \
229         lib/vlandev.c \
230         lib/vlandev.h \
231         lib/vlog.c \
232         lib/vlog.h \
233         lib/vswitch-idl.c \
234         lib/vswitch-idl.h \
235         lib/vtep-idl.c \
236         lib/vtep-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         $(srcdir)/lib/vtep-idl.c \
343         $(srcdir)/lib/vtep-idl.h \
344         $(srcdir)/lib/vtep-idl.ovsidl
345
346 EXTRA_DIST += $(srcdir)/lib/vswitch-idl.ann
347 VSWITCH_IDL_FILES = \
348         $(srcdir)/vswitchd/vswitch.ovsschema \
349         $(srcdir)/lib/vswitch-idl.ann
350 $(srcdir)/lib/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES)
351         $(OVSDB_IDLC) annotate $(VSWITCH_IDL_FILES) > $@.tmp
352         mv $@.tmp $@
353
354 EXTRA_DIST += $(srcdir)/lib/vtep-idl.ann
355 VTEP_IDL_FILES = \
356         $(srcdir)/vtep/vtep.ovsschema \
357         $(srcdir)/lib/vtep-idl.ann
358 $(srcdir)/lib/vtep-idl.ovsidl: $(VTEP_IDL_FILES)
359         $(OVSDB_IDLC) annotate $(VTEP_IDL_FILES) > $@.tmp
360         mv $@.tmp $@
361
362 lib/dirs.c: lib/dirs.c.in Makefile
363         ($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
364                 -e 's,[@]srcdir[@],$(srcdir),g' \
365                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
366                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
367                 -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
368                 -e 's,[@]bindir[@],"$(bindir)",g' \
369                 -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
370                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
371              > lib/dirs.c.tmp
372         mv lib/dirs.c.tmp lib/dirs.c
373
374 $(srcdir)/lib/ofp-errors.inc: \
375         lib/ofp-errors.h include/openflow/openflow-common.h \
376         $(srcdir)/build-aux/extract-ofp-errors
377         $(run_python) $(srcdir)/build-aux/extract-ofp-errors \
378                 $(srcdir)/lib/ofp-errors.h \
379                 $(srcdir)/include/openflow/openflow-common.h > $@.tmp
380         mv $@.tmp $@
381 $(srcdir)/lib/ofp-errors.c: $(srcdir)/lib/ofp-errors.inc
382 EXTRA_DIST += build-aux/extract-ofp-errors lib/ofp-errors.inc
383
384 $(srcdir)/lib/ofp-msgs.inc: \
385         lib/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
386         $(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
387                 $(srcdir)/lib/ofp-msgs.h $@ > $@.tmp && mv $@.tmp $@
388 $(srcdir)/lib/ofp-msgs.c: $(srcdir)/lib/ofp-msgs.inc
389 EXTRA_DIST += build-aux/extract-ofp-msgs lib/ofp-msgs.inc
390
391 INSTALL_DATA_LOCAL += lib-install-data-local
392 lib-install-data-local:
393         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
394         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
395         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
396         $(MKDIR_P) $(DESTDIR)$(DBDIR)
397
398 if !USE_LINKER_SECTIONS
399 # All distributed sources, with names adjust properly for referencing
400 # from $(builddir).
401 all_sources = \
402         `for file in $(DIST_SOURCES); do \
403                 if test -f $$file; then \
404                         echo $$file; \
405                 else \
406                         echo $(VPATH)/$$file; \
407                 fi; \
408          done`
409
410 lib/coverage.$(OBJEXT): lib/coverage.def
411 lib/coverage.def: $(DIST_SOURCES)
412         sed -n 's|^COVERAGE_DEFINE(\([_a-zA-Z0-9]\{1,\}\)).*$$|COVERAGE_COUNTER(\1)|p' $(all_sources) | LC_ALL=C sort -u > $@
413 CLEANFILES += lib/coverage.def
414
415 lib/vlog.$(OBJEXT): lib/vlog-modules.def
416 lib/vlog-modules.def: $(DIST_SOURCES)
417         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 > $@
418 CLEANFILES += lib/vlog-modules.def
419 endif