util: New function ovs_strzcpy().
[sliver-openvswitch.git] / lib / automake.mk
1 # Copyright (C) 2009, 2010, 2011 Nicira Networks, 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/bitmap.c \
16         lib/bitmap.h \
17         lib/byte-order.h \
18         lib/byteq.c \
19         lib/byteq.h \
20         lib/cfm.c \
21         lib/cfm.h \
22         lib/classifier.c \
23         lib/classifier.h \
24         lib/command-line.c \
25         lib/command-line.h \
26         lib/compiler.h \
27         lib/coverage.c \
28         lib/coverage.h \
29         lib/csum.c \
30         lib/csum.h \
31         lib/daemon.c \
32         lib/daemon.h \
33         lib/dummy.c \
34         lib/dummy.h \
35         lib/dhcp-client.c \
36         lib/dhcp-client.h \
37         lib/dhcp.c \
38         lib/dhcp.h \
39         lib/dhparams.h \
40         lib/dirs.h \
41         lib/dpif-netdev.c \
42         lib/dpif-provider.h \
43         lib/dpif.c \
44         lib/dpif.h \
45         lib/dynamic-string.c \
46         lib/dynamic-string.h \
47         lib/entropy.c \
48         lib/entropy.h \
49         lib/fatal-signal.c \
50         lib/fatal-signal.h \
51         lib/flow.c \
52         lib/flow.h \
53         lib/hash.c \
54         lib/hash.h \
55         lib/hmap.c \
56         lib/hmap.h \
57         lib/json.c \
58         lib/json.h \
59         lib/jsonrpc.c \
60         lib/jsonrpc.h \
61         lib/leak-checker.c \
62         lib/leak-checker.h \
63         lib/learning-switch.c \
64         lib/learning-switch.h \
65         lib/list.c \
66         lib/list.h \
67         lib/lockfile.c \
68         lib/lockfile.h \
69         lib/mac-learning.c \
70         lib/mac-learning.h \
71         lib/multipath.c \
72         lib/multipath.h \
73         lib/netdev-dummy.c \
74         lib/netdev-provider.h \
75         lib/netdev.c \
76         lib/netdev.h \
77         lib/netlink.c \
78         lib/netlink.h \
79         lib/nx-match.c \
80         lib/nx-match.def \
81         lib/nx-match.h \
82         lib/odp-util.c \
83         lib/odp-util.h \
84         lib/ofp-errors.c \
85         lib/ofp-errors.h \
86         lib/ofp-parse.c \
87         lib/ofp-parse.h \
88         lib/ofp-print.c \
89         lib/ofp-print.h \
90         lib/ofp-util.c \
91         lib/ofp-util.h \
92         lib/ofpbuf.c \
93         lib/ofpbuf.h \
94         lib/ovsdb-data.c \
95         lib/ovsdb-data.h \
96         lib/ovsdb-error.c \
97         lib/ovsdb-error.h \
98         lib/ovsdb-idl-provider.h \
99         lib/ovsdb-idl.c \
100         lib/ovsdb-idl.h \
101         lib/ovsdb-parser.c \
102         lib/ovsdb-parser.h \
103         lib/ovsdb-types.c \
104         lib/ovsdb-types.h \
105         lib/packets.c \
106         lib/packets.h \
107         lib/pcap.c \
108         lib/pcap.h \
109         lib/poll-loop.c \
110         lib/poll-loop.h \
111         lib/process.c \
112         lib/process.h \
113         lib/random.c \
114         lib/random.h \
115         lib/rconn.c \
116         lib/rconn.h \
117         lib/reconnect.c \
118         lib/reconnect.h \
119         lib/sat-math.h \
120         lib/sha1.c \
121         lib/sha1.h \
122         lib/shash.c \
123         lib/shash.h \
124         lib/signals.c \
125         lib/signals.h \
126         lib/socket-util.c \
127         lib/socket-util.h \
128         lib/sort.c \
129         lib/sort.h \
130         lib/stream-fd.c \
131         lib/stream-fd.h \
132         lib/stream-provider.h \
133         lib/stream-ssl.h \
134         lib/stream-tcp.c \
135         lib/stream-unix.c \
136         lib/stream.c \
137         lib/stream.h \
138         lib/stress.c \
139         lib/stress.h \
140         lib/string.c \
141         lib/string.h \
142         lib/svec.c \
143         lib/svec.h \
144         lib/table.c \
145         lib/table.h \
146         lib/tag.c \
147         lib/tag.h \
148         lib/timeval.c \
149         lib/timeval.h \
150         lib/type-props.h \
151         lib/unaligned.h \
152         lib/unicode.c \
153         lib/unicode.h \
154         lib/unixctl.c \
155         lib/unixctl.h \
156         lib/util.c \
157         lib/util.h \
158         lib/uuid.c \
159         lib/uuid.h \
160         lib/valgrind.h \
161         lib/vconn-provider.h \
162         lib/vconn-stream.c \
163         lib/vconn.c \
164         lib/vconn.h \
165         lib/vlog.c \
166         lib/vlog.h
167 nodist_lib_libopenvswitch_a_SOURCES = \
168         lib/dirs.c
169 CLEANFILES += $(nodist_lib_libopenvswitch_a_SOURCES)
170
171 noinst_LIBRARIES += lib/libsflow.a
172 lib_libsflow_a_SOURCES = \
173         lib/sflow_api.h \
174         lib/sflow.h \
175         lib/sflow_agent.c \
176         lib/sflow_sampler.c \
177         lib/sflow_poller.c \
178         lib/sflow_receiver.c
179 lib_libsflow_a_CFLAGS = $(AM_CFLAGS)
180 if HAVE_WNO_UNUSED
181 lib_libsflow_a_CFLAGS += -Wno-unused
182 endif
183 if HAVE_WNO_UNUSED_PARAMETER
184 lib_libsflow_a_CFLAGS += -Wno-unused-parameter
185 endif
186
187 if HAVE_NETLINK
188 lib_libopenvswitch_a_SOURCES += \
189         lib/dpif-linux.c \
190         lib/dpif-linux.h \
191         lib/netdev-linux.c \
192         lib/netdev-vport.c \
193         lib/netdev-vport.h \
194         lib/netlink-protocol.h \
195         lib/netlink-socket.c \
196         lib/netlink-socket.h \
197         lib/rtnetlink.c \
198         lib/rtnetlink.h \
199         lib/rtnetlink-link.c \
200         lib/rtnetlink-link.h \
201         lib/route-table.c \
202         lib/route-table.h
203 endif
204
205 if HAVE_OPENSSL
206 lib_libopenvswitch_a_SOURCES += lib/stream-ssl.c
207 nodist_lib_libopenvswitch_a_SOURCES += lib/dhparams.c
208 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
209         (echo '#include "lib/dhparams.h"' &&                            \
210          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
211          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
212          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
213         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp
214         mv lib/dhparams.c.tmp lib/dhparams.c
215 endif
216
217 EXTRA_DIST += \
218         lib/dh1024.pem \
219         lib/dh2048.pem \
220         lib/dh4096.pem \
221         lib/dirs.c.in
222
223 EXTRA_DIST += \
224         lib/common.man \
225         lib/common-syn.man \
226         lib/daemon.man \
227         lib/daemon-syn.man \
228         lib/leak-checker.man \
229         lib/ssl-bootstrap.man \
230         lib/ssl-bootstrap-syn.man \
231         lib/ssl-peer-ca-cert.man \
232         lib/ssl.man \
233         lib/ssl-syn.man \
234         lib/stress-unixctl.man \
235         lib/table.man \
236         lib/unixctl.man \
237         lib/unixctl-syn.man \
238         lib/vconn-active.man \
239         lib/vconn-passive.man \
240         lib/vlog-unixctl.man \
241         lib/vlog-syn.man \
242         lib/vlog.man
243
244 lib/dirs.c: lib/dirs.c.in Makefile
245         ($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
246                 -e 's,[@]srcdir[@],$(srcdir),g' \
247                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
248                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
249                 -e 's,[@]bindir[@],"$(bindir)",g' \
250                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
251              > lib/dirs.c.tmp
252         mv lib/dirs.c.tmp lib/dirs.c
253
254 $(srcdir)/lib/ofp-errors.c: \
255         include/openflow/openflow.h include/openflow/nicira-ext.h \
256         build-aux/extract-ofp-errors
257         cd $(srcdir)/include && \
258         $(PYTHON) ../build-aux/extract-ofp-errors \
259                 openflow/openflow.h openflow/nicira-ext.h > ../lib/ofp-errors.c
260 EXTRA_DIST += build-aux/extract-ofp-errors
261
262 install-data-local: lib-install-data-local
263 lib-install-data-local:
264         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
265         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
266         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
267
268 if !USE_LINKER_SECTIONS
269 # All distributed sources, with names adjust properly for referencing
270 # from $(builddir).
271 all_sources = \
272         `for file in $(DIST_SOURCES); do \
273                 if test -f $$file; then \
274                         echo $$file; \
275                 else \
276                         echo $(VPATH)/$$file; \
277                 fi; \
278          done`
279
280 lib/coverage.$(OBJEXT): lib/coverage.def
281 lib/coverage.def: $(DIST_SOURCES)
282         sed -n 's|^COVERAGE_DEFINE(\([_a-zA-Z0-9]\{1,\}\)).*$$|COVERAGE_COUNTER(\1)|p' $(all_sources) | LC_ALL=C sort -u > $@
283 CLEANFILES += lib/coverage.def
284
285 lib/stress.$(OBJEXT): lib/stress.def
286 lib/stress.def: $(DIST_SOURCES)
287         sed -n '/^STRESS_OPTION(/,/);$$/{s/);$$/)/;p}' $(all_sources) > $@
288 CLEANFILES += lib/stress.def
289
290 lib/vlog.$(OBJEXT): lib/vlog-modules.def
291 lib/vlog-modules.def: $(DIST_SOURCES)
292         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 > $@
293 CLEANFILES += lib/vlog-modules.def
294 endif