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