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