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