ovs-atomic: Factor type declarations out of most implementations.
[sliver-openvswitch.git] / lib / automake.mk
1 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 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 lib_LTLIBRARIES += lib/libopenvswitch.la
9
10 lib_libopenvswitch_la_LIBADD = $(SSL_LIBS)
11
12 if WIN32
13 lib_libopenvswitch_la_LIBADD += ${PTHREAD_LIBS}
14 endif
15
16 lib_libopenvswitch_la_LDFLAGS = -release $(VERSION)
17
18 lib_libopenvswitch_la_SOURCES = \
19         lib/aes128.c \
20         lib/aes128.h \
21         lib/async-append.h \
22         lib/backtrace.c \
23         lib/backtrace.h \
24         lib/bfd.c \
25         lib/bfd.h \
26         lib/bitmap.c \
27         lib/bitmap.h \
28         lib/bundle.c \
29         lib/bundle.h \
30         lib/byte-order.h \
31         lib/byteq.c \
32         lib/byteq.h \
33         lib/cfm.c \
34         lib/cfm.h \
35         lib/classifier.c \
36         lib/classifier.h \
37         lib/command-line.c \
38         lib/command-line.h \
39         lib/compiler.h \
40         lib/connectivity.c \
41         lib/connectivity.h \
42         lib/coverage.c \
43         lib/coverage.h \
44         lib/crc32c.c \
45         lib/crc32c.h \
46         lib/csum.c \
47         lib/csum.h \
48         lib/daemon.h \
49         lib/dhcp.h \
50         lib/dummy.c \
51         lib/dummy.h \
52         lib/dhparams.h \
53         lib/dirs.h \
54         lib/dpif-netdev.c \
55         lib/dpif-provider.h \
56         lib/dpif.c \
57         lib/dpif.h \
58         lib/heap.c \
59         lib/heap.h \
60         lib/dynamic-string.c \
61         lib/dynamic-string.h \
62         lib/entropy.c \
63         lib/entropy.h \
64         lib/fat-rwlock.c \
65         lib/fat-rwlock.h \
66         lib/fatal-signal.c \
67         lib/fatal-signal.h \
68         lib/flow.c \
69         lib/flow.h \
70         lib/guarded-list.c \
71         lib/guarded-list.h \
72         lib/hash.c \
73         lib/hash.h \
74         lib/hindex.c \
75         lib/hindex.h \
76         lib/hmap.c \
77         lib/hmap.h \
78         lib/hmapx.c \
79         lib/hmapx.h \
80         lib/jhash.c \
81         lib/jhash.h \
82         lib/json.c \
83         lib/json.h \
84         lib/jsonrpc.c \
85         lib/jsonrpc.h \
86         lib/lacp.c \
87         lib/lacp.h \
88         lib/latch.h \
89         lib/learn.c \
90         lib/learn.h \
91         lib/learning-switch.c \
92         lib/learning-switch.h \
93         lib/list.c \
94         lib/list.h \
95         lib/lockfile.c \
96         lib/lockfile.h \
97         lib/mac-learning.c \
98         lib/mac-learning.h \
99         lib/match.c \
100         lib/match.h \
101         lib/memory.c \
102         lib/memory.h \
103         lib/meta-flow.c \
104         lib/meta-flow.h \
105         lib/multipath.c \
106         lib/multipath.h \
107         lib/netdev-dummy.c \
108         lib/netdev-provider.h \
109         lib/netdev-vport.c \
110         lib/netdev-vport.h \
111         lib/netdev.c \
112         lib/netdev.h \
113         lib/netflow.h \
114         lib/netlink.c \
115         lib/netlink.h \
116         lib/nx-match.c \
117         lib/nx-match.h \
118         lib/odp-execute.c \
119         lib/odp-execute.h \
120         lib/odp-util.c \
121         lib/odp-util.h \
122         lib/ofp-actions.c \
123         lib/ofp-actions.h \
124         lib/ofp-errors.c \
125         lib/ofp-errors.h \
126         lib/ofp-msgs.c \
127         lib/ofp-msgs.h \
128         lib/ofp-parse.c \
129         lib/ofp-parse.h \
130         lib/ofp-print.c \
131         lib/ofp-print.h \
132         lib/ofp-util.c \
133         lib/ofp-util.def \
134         lib/ofp-util.h \
135         lib/ofp-version-opt.h \
136         lib/ofp-version-opt.c \
137         lib/ofpbuf.c \
138         lib/ofpbuf.h \
139         lib/ovs-atomic-c11.h \
140         lib/ovs-atomic-clang.h \
141         lib/ovs-atomic-flag-gcc4.7+.h \
142         lib/ovs-atomic-gcc4+.c \
143         lib/ovs-atomic-gcc4+.h \
144         lib/ovs-atomic-gcc4.7+.h \
145         lib/ovs-atomic-pthreads.c \
146         lib/ovs-atomic-pthreads.h \
147         lib/ovs-atomic-types.h \
148         lib/ovs-atomic.h \
149         lib/ovs-thread.c \
150         lib/ovs-thread.h \
151         lib/ovsdb-data.c \
152         lib/ovsdb-data.h \
153         lib/ovsdb-error.c \
154         lib/ovsdb-error.h \
155         lib/ovsdb-idl-provider.h \
156         lib/ovsdb-idl.c \
157         lib/ovsdb-idl.h \
158         lib/ovsdb-parser.c \
159         lib/ovsdb-parser.h \
160         lib/ovsdb-types.c \
161         lib/ovsdb-types.h \
162         lib/packets.c \
163         lib/packets.h \
164         lib/pcap-file.c \
165         lib/pcap-file.h \
166         lib/poll-loop.c \
167         lib/poll-loop.h \
168         lib/process.c \
169         lib/process.h \
170         lib/random.c \
171         lib/random.h \
172         lib/rconn.c \
173         lib/rconn.h \
174         lib/reconnect.c \
175         lib/reconnect.h \
176         lib/sat-math.h \
177         lib/seq.c \
178         lib/seq.h \
179         lib/sha1.c \
180         lib/sha1.h \
181         lib/shash.c \
182         lib/shash.h \
183         lib/simap.c \
184         lib/simap.h \
185         lib/smap.c \
186         lib/smap.h \
187         lib/socket-util.c \
188         lib/socket-util.h \
189         lib/sort.c \
190         lib/sort.h \
191         lib/sset.c \
192         lib/sset.h \
193         lib/stp.c \
194         lib/stp.h \
195         lib/stream-fd.h \
196         lib/stream-provider.h \
197         lib/stream-ssl.h \
198         lib/stream-tcp.c \
199         lib/stream.c \
200         lib/stream.h \
201         lib/stdio.c \
202         lib/string.c \
203         lib/svec.c \
204         lib/svec.h \
205         lib/table.c \
206         lib/table.h \
207         lib/tag.c \
208         lib/tag.h \
209         lib/timer.c \
210         lib/timer.h \
211         lib/timeval.c \
212         lib/timeval.h \
213         lib/token-bucket.c \
214         lib/token-bucket.h \
215         lib/type-props.h \
216         lib/unaligned.h \
217         lib/unicode.c \
218         lib/unicode.h \
219         lib/unixctl.c \
220         lib/unixctl.h \
221         lib/util.c \
222         lib/util.h \
223         lib/uuid.c \
224         lib/uuid.h \
225         lib/valgrind.h \
226         lib/vconn-provider.h \
227         lib/vconn-stream.c \
228         lib/vconn.c \
229         lib/vconn.h \
230         lib/vlan-bitmap.c \
231         lib/vlan-bitmap.h \
232         lib/vlandev.c \
233         lib/vlandev.h \
234         lib/vlog.c \
235         lib/vlog.h \
236         lib/vswitch-idl.c \
237         lib/vswitch-idl.h \
238         lib/vtep-idl.c \
239         lib/vtep-idl.h
240
241 if WIN32
242 lib_libopenvswitch_la_SOURCES += \
243         lib/daemon-windows.c \
244         lib/getopt_long.c \
245         lib/getrusage-windows.c \
246         lib/latch-windows.c \
247         lib/route-table-stub.c \
248         lib/stream-fd-windows.c
249 else
250 lib_libopenvswitch_la_SOURCES += \
251         lib/daemon.c \
252         lib/latch-unix.c \
253         lib/signals.c \
254         lib/signals.h \
255         lib/stream-fd-unix.c \
256         lib/stream-unix.c
257 endif
258
259 EXTRA_DIST += \
260         lib/stdio.h.in \
261         lib/string.h.in
262
263 nodist_lib_libopenvswitch_la_SOURCES = \
264         lib/dirs.c
265 CLEANFILES += $(nodist_lib_libopenvswitch_la_SOURCES)
266
267 lib_LTLIBRARIES += lib/libsflow.la
268 lib_libsflow_la_LDFLAGS = -release $(VERSION)
269 lib_libsflow_la_SOURCES = \
270         lib/sflow_api.h \
271         lib/sflow.h \
272         lib/sflow_agent.c \
273         lib/sflow_sampler.c \
274         lib/sflow_poller.c \
275         lib/sflow_receiver.c
276 lib_libsflow_la_CPPFLAGS = $(AM_CPPFLAGS)
277 lib_libsflow_la_CFLAGS = $(AM_CFLAGS)
278 if HAVE_WNO_UNUSED
279 lib_libsflow_la_CFLAGS += -Wno-unused
280 endif
281 if HAVE_WNO_UNUSED_PARAMETER
282 lib_libsflow_la_CFLAGS += -Wno-unused-parameter
283 endif
284
285 if LINUX
286 lib_libopenvswitch_la_SOURCES += \
287         lib/dpif-linux.c \
288         lib/dpif-linux.h \
289         lib/netdev-linux.c \
290         lib/netdev-linux.h \
291         lib/netlink-notifier.c \
292         lib/netlink-notifier.h \
293         lib/netlink-protocol.h \
294         lib/netlink-socket.c \
295         lib/netlink-socket.h \
296         lib/rtnetlink-link.c \
297         lib/rtnetlink-link.h \
298         lib/route-table.c \
299         lib/route-table.h
300 endif
301
302 if HAVE_POSIX_AIO
303 lib_libopenvswitch_la_SOURCES += lib/async-append-aio.c
304 else
305 lib_libopenvswitch_la_SOURCES += lib/async-append-null.c
306 endif
307
308 if ESX
309 lib_libopenvswitch_la_SOURCES += \
310         lib/route-table-stub.c
311 endif
312
313 if HAVE_IF_DL
314 lib_libopenvswitch_la_SOURCES += \
315         lib/netdev-bsd.c \
316         lib/rtbsd.c \
317         lib/rtbsd.h \
318         lib/route-table-bsd.c
319 endif
320
321 if HAVE_OPENSSL
322 lib_libopenvswitch_la_SOURCES += lib/stream-ssl.c
323 nodist_lib_libopenvswitch_la_SOURCES += lib/dhparams.c
324 lib/dhparams.c: lib/dh1024.pem lib/dh2048.pem lib/dh4096.pem
325         (echo '#include "lib/dhparams.h"' &&                            \
326          openssl dhparam -C -in $(srcdir)/lib/dh1024.pem -noout &&      \
327          openssl dhparam -C -in $(srcdir)/lib/dh2048.pem -noout &&      \
328          openssl dhparam -C -in $(srcdir)/lib/dh4096.pem -noout)        \
329         | sed 's/\(get_dh[0-9]*\)()/\1(void)/' > lib/dhparams.c.tmp
330         mv lib/dhparams.c.tmp lib/dhparams.c
331 else
332 lib_libopenvswitch_la_SOURCES += lib/stream-nossl.c
333 endif
334
335 EXTRA_DIST += \
336         lib/dh1024.pem \
337         lib/dh2048.pem \
338         lib/dh4096.pem \
339         lib/dirs.c.in
340
341 MAN_FRAGMENTS += \
342         lib/common.man \
343         lib/common-syn.man \
344         lib/coverage-unixctl.man \
345         lib/daemon.man \
346         lib/daemon-syn.man \
347         lib/memory-unixctl.man \
348         lib/ofp-version.man \
349         lib/ovs.tmac \
350         lib/service.man \
351         lib/service-syn.man \
352         lib/ssl-bootstrap.man \
353         lib/ssl-bootstrap-syn.man \
354         lib/ssl-peer-ca-cert.man \
355         lib/ssl.man \
356         lib/ssl-syn.man \
357         lib/table.man \
358         lib/unixctl.man \
359         lib/unixctl-syn.man \
360         lib/vconn-active.man \
361         lib/vconn-passive.man \
362         lib/vlog-unixctl.man \
363         lib/vlog-syn.man \
364         lib/vlog.man
365
366 # vswitch IDL
367 OVSIDL_BUILT += \
368         $(srcdir)/lib/vswitch-idl.c \
369         $(srcdir)/lib/vswitch-idl.h \
370         $(srcdir)/lib/vswitch-idl.ovsidl \
371         $(srcdir)/lib/vtep-idl.c \
372         $(srcdir)/lib/vtep-idl.h \
373         $(srcdir)/lib/vtep-idl.ovsidl
374
375 EXTRA_DIST += $(srcdir)/lib/vswitch-idl.ann
376 VSWITCH_IDL_FILES = \
377         $(srcdir)/vswitchd/vswitch.ovsschema \
378         $(srcdir)/lib/vswitch-idl.ann
379 $(srcdir)/lib/vswitch-idl.ovsidl: $(VSWITCH_IDL_FILES)
380         $(OVSDB_IDLC) annotate $(VSWITCH_IDL_FILES) > $@.tmp
381         mv $@.tmp $@
382
383 EXTRA_DIST += $(srcdir)/lib/vtep-idl.ann
384 VTEP_IDL_FILES = \
385         $(srcdir)/vtep/vtep.ovsschema \
386         $(srcdir)/lib/vtep-idl.ann
387 $(srcdir)/lib/vtep-idl.ovsidl: $(VTEP_IDL_FILES)
388         $(OVSDB_IDLC) annotate $(VTEP_IDL_FILES) > $@.tmp
389         mv $@.tmp $@
390
391 lib/dirs.c: lib/dirs.c.in Makefile
392         ($(ro_c) && sed < $(srcdir)/lib/dirs.c.in \
393                 -e 's,[@]srcdir[@],$(srcdir),g' \
394                 -e 's,[@]LOGDIR[@],"$(LOGDIR)",g' \
395                 -e 's,[@]RUNDIR[@],"$(RUNDIR)",g' \
396                 -e 's,[@]DBDIR[@],"$(DBDIR)",g' \
397                 -e 's,[@]bindir[@],"$(bindir)",g' \
398                 -e 's,[@]sysconfdir[@],"$(sysconfdir)",g' \
399                 -e 's,[@]pkgdatadir[@],"$(pkgdatadir)",g') \
400              > lib/dirs.c.tmp
401         mv lib/dirs.c.tmp lib/dirs.c
402
403 $(srcdir)/lib/ofp-errors.inc: \
404         lib/ofp-errors.h include/openflow/openflow-common.h \
405         $(srcdir)/build-aux/extract-ofp-errors
406         $(run_python) $(srcdir)/build-aux/extract-ofp-errors \
407                 $(srcdir)/lib/ofp-errors.h \
408                 $(srcdir)/include/openflow/openflow-common.h > $@.tmp
409         mv $@.tmp $@
410 $(srcdir)/lib/ofp-errors.c: $(srcdir)/lib/ofp-errors.inc
411 EXTRA_DIST += build-aux/extract-ofp-errors lib/ofp-errors.inc
412
413 $(srcdir)/lib/ofp-msgs.inc: \
414         lib/ofp-msgs.h $(srcdir)/build-aux/extract-ofp-msgs
415         $(run_python) $(srcdir)/build-aux/extract-ofp-msgs \
416                 $(srcdir)/lib/ofp-msgs.h $@ > $@.tmp && mv $@.tmp $@
417 $(srcdir)/lib/ofp-msgs.c: $(srcdir)/lib/ofp-msgs.inc
418 EXTRA_DIST += build-aux/extract-ofp-msgs lib/ofp-msgs.inc
419
420 INSTALL_DATA_LOCAL += lib-install-data-local
421 lib-install-data-local:
422         $(MKDIR_P) $(DESTDIR)$(RUNDIR)
423         $(MKDIR_P) $(DESTDIR)$(PKIDIR)
424         $(MKDIR_P) $(DESTDIR)$(LOGDIR)
425         $(MKDIR_P) $(DESTDIR)$(DBDIR)
426