]> git.proxmox.com Git - ovs.git/blame - Makefile.am
sandbox: launch SB backup server when running in OVN mode
[ovs.git] / Makefile.am
CommitLineData
8a988976 1# Copyright (C) 2007-2016 Nicira, Inc.
a14bc59f
BP
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
064af421
BP
8AUTOMAKE_OPTIONS = foreign subdir-objects
9ACLOCAL_AMFLAGS = -I m4
10SUBDIRS = datapath
11
064af421 12AM_CPPFLAGS = $(SSL_CFLAGS)
cf06c2e9 13AM_LDFLAGS = $(SSL_LDFLAGS)
95626395 14AM_LDFLAGS += $(OVS_LDFLAGS)
e42dfc72
AS
15
16if WIN32
17AM_CPPFLAGS += -I $(top_srcdir)/include/windows
c803536e 18AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
94887cf4 19AM_CPPFLAGS += $(PTHREAD_INCLUDES)
b0e1bce5 20AM_CPPFLAGS += $(MSVC_CFLAGS)
94887cf4 21AM_LDFLAGS += $(PTHREAD_LDFLAGS)
1cb3649c 22AM_LDFLAGS += $(MSVC64_LDFLAGS)
e42dfc72
AS
23endif
24
064af421 25AM_CPPFLAGS += -I $(top_srcdir)/include
837eefc7 26AM_CPPFLAGS += -I $(top_builddir)/include
064af421 27AM_CPPFLAGS += -I $(top_srcdir)/lib
611d30ce 28AM_CPPFLAGS += -I $(top_builddir)/lib
064af421 29
8605a29b
PK
30AM_CPPFLAGS += $(SSL_INCLUDES)
31
064af421 32AM_CFLAGS = -Wstrict-prototypes
d161c099 33AM_CFLAGS += $(WARNING_FLAGS)
95626395 34AM_CFLAGS += $(OVS_CFLAGS)
064af421 35
58397e6c
KT
36if DPDK_NETDEV
37AM_CFLAGS += -D_FILE_OFFSET_BITS=64
38endif
39
064af421
BP
40if NDEBUG
41AM_CPPFLAGS += -DNDEBUG
42AM_CFLAGS += -fomit-frame-pointer
064af421
BP
43endif
44
b02e1154
GS
45if WIN32
46psep=";"
47else
48psep=":"
49endif
853d1083
BP
50# PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
51# files. Creating .py[co] works OK for any given version of Open
52# vSwitch, but it causes trouble if you switch from a version with
53# foo/__init__.py into an (older) version with plain foo.py, since
54# foo/__init__.pyc will cause Python to ignore foo.py.
e23812fc
BP
55run_python = \
56 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
57 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
853d1083 58
22c79496 59ALL_LOCAL =
d879a707 60BUILT_SOURCES =
064af421 61CLEANFILES =
15b619e2 62CLEAN_LOCAL =
064af421 63DISTCLEANFILES =
79982e90 64PYCOV_CLEAN_FILES = build-aux/check-structs,cover
4441a01c
BP
65
66# A list of Markdown-formatted documentation that will automatically be
67# included in the "make dist-docs" output.
68docs = \
542cc9bb
TG
69 CONTRIBUTING.md \
70 CodingStyle.md \
71 DESIGN.md \
72 FAQ.md \
73 INSTALL.md \
74 INSTALL.Debian.md \
75 INSTALL.Docker.md \
e5bac8f7 76 INSTALL.DPDK-ADVANCED.md \
542cc9bb
TG
77 INSTALL.DPDK.md \
78 INSTALL.Fedora.md \
79 INSTALL.KVM.md \
80 INSTALL.Libvirt.md \
81 INSTALL.NetBSD.md \
82 INSTALL.RHEL.md \
9b897c91 83 INSTALL.SELinux.md \
542cc9bb
TG
84 INSTALL.SSL.md \
85 INSTALL.XenServer.md \
86 INSTALL.userspace.md \
87 INSTALL.Windows.md \
88 IntegrationGuide.md \
13ad56a0 89 MAINTAINERS.md \
542cc9bb
TG
90 OPENFLOW-1.1+.md \
91 PORTING.md \
d25e2f57 92 README.md \
542cc9bb 93 README-lisp.md \
a36de779 94 README-native-tunneling.md \
542cc9bb 95 REPORTING-BUGS.md \
f0664242 96 SECURITY.md \
4441a01c
BP
97 WHY-OVS.md
98EXTRA_DIST = \
99 $(docs) \
100 NOTICE \
826bc7b6 101 .travis.yml \
40a75bbf
LR
102 .travis/linux-build.sh \
103 .travis/linux-prepare.sh \
104 .travis/osx-build.sh \
105 .travis/osx-prepare.sh \
12c96b8a 106 appveyor.yml \
0027492d 107 boot.sh \
c9b94429 108 build-aux/cccl \
abc67c1e 109 build-aux/cksum-schema-check \
39916858 110 build-aux/calculate-schema-cksum \
4441a01c 111 build-aux/dist-docs \
6ca37677 112 build-aux/sodepends.pl \
94512c4a 113 build-aux/soexpand.pl \
a4e3c495 114 build-aux/xml2nroff \
6ca37677 115 $(MAN_FRAGMENTS) \
1ce96d2a 116 $(MAN_ROOTS) \
ef9c432c
WT
117 Vagrantfile \
118 Vagrantfile-FreeBSD
064af421
BP
119bin_PROGRAMS =
120sbin_PROGRAMS =
121bin_SCRIPTS =
87103e1f 122DIST_HOOKS =
064af421 123dist_man_MANS =
3b12adda 124dist_pkgdata_DATA =
064af421
BP
125dist_pkgdata_SCRIPTS =
126dist_sbin_SCRIPTS =
b2df0225 127dist_scripts_SCRIPTS =
429ebf21 128dist_scripts_DATA =
b2df0225 129INSTALL_DATA_LOCAL =
44852fdf 130UNINSTALL_LOCAL =
064af421 131man_MANS =
0027492d 132MAN_FRAGMENTS =
6ca37677 133MAN_ROOTS =
c3bb4bd7 134noinst_DATA =
064af421 135noinst_HEADERS =
38b7a52b 136lib_LTLIBRARIES =
045b2e5c 137noinst_man_MANS =
064af421
BP
138noinst_PROGRAMS =
139noinst_SCRIPTS =
00732bf5 140OVSIDL_BUILT =
9c16ed64 141pkgdata_DATA =
b2df0225 142sbin_SCRIPTS =
43bb5f82 143scripts_SCRIPTS =
2c9907cd 144completion_SCRIPTS =
429ebf21 145scripts_DATA =
c3bb4bd7 146SUFFIXES =
15b619e2 147check_DATA =
08d42548 148check_SCRIPTS =
81696de0 149pkgconfig_DATA =
115d8719 150FLAKE8_PYFILES =
064af421 151
43bb5f82 152scriptsdir = $(pkgdatadir)/scripts
2c9907cd 153completiondir = $(sysconfdir)/bash_completion.d
81696de0 154pkgconfigdir = $(libdir)/pkgconfig
43bb5f82 155
9741af79
BP
156# This ensures that files added to EXTRA_DIST are always distributed,
157# even if they are inside an Automake if...endif conditional block that is
158# disabled by some particular "configure" run. For more information, see:
159# http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
160noinst_HEADERS += $(EXTRA_DIST)
161
064af421 162ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
cbaa4ffe 163ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
064af421 164
c3bb4bd7 165SUFFIXES += .in
064af421 166.in:
ef44aa50 167 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
3b135da3 168 sed \
064af421 169 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
3b135da3 170 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
f973f2af 171 -e 's,[@]DBDIR[@],$(DBDIR),g' \
3b135da3
BP
172 -e 's,[@]PERL[@],$(PERL),g' \
173 -e 's,[@]PYTHON[@],$(PYTHON),g' \
064af421 174 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
3b135da3
BP
175 -e 's,[@]VERSION[@],$(VERSION),g' \
176 -e 's,[@]localstatedir[@],$(localstatedir),g' \
064af421 177 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
3b135da3 178 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
43bb5f82
BP
179 -e 's,[@]bindir[@],$(bindir),g' \
180 -e 's,[@]sbindir[@],$(sbindir),g' \
6901639b 181 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
d879a707 182 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
3b135da3 183 > $@.tmp
00961f7c 184 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
3b135da3
BP
185 chmod +x $@.tmp; \
186 fi
ef44aa50 187 $(AM_V_at) mv $@.tmp $@
064af421 188
99635791
BP
189SUFFIXES += .xml
190%: %.xml
191 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
8a988976 192 -I $(srcdir) \
99635791
BP
193 --version=$(VERSION) \
194 PKIDIR='$(PKIDIR)' \
195 LOGDIR='$(LOGDIR)' \
196 DBDIR='$(DBDIR)' \
197 PERL='$(PERL)' \
198 PYTHON='$(PYTHON)' \
199 RUNDIR='$(RUNDIR)' \
200 VERSION='$(VERSION)' \
201 localstatedir='$(localstatedir)' \
202 pkgdatadir='$(pkgdatadir)' \
203 sysconfdir='$(sysconfdir)' \
204 bindir='$(bindir)' \
205 sbindir='$(sbindir)'
206 $(AM_v_at)mv $@.tmp $@
207
79982e90
EJ
208.PHONY: clean-pycov
209clean-pycov:
210 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
211CLEAN_LOCAL += clean-pycov
212
87103e1f
BP
213# If we're checked out from a Git repository, make sure that every
214# file that is in Git is distributed.
b4e1bf8b
BP
215#
216# We only enable this check when GNU make is in use because the
217# Makefile in datapath/linux, needed to get the list of files to
218# distribute, requires GNU make extensions.
219if GNU_MAKE
39376d06
BP
220ALL_LOCAL += dist-hook-git
221dist-hook-git: distfiles
222 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
223 (cd datapath && $(MAKE) distfiles); \
224 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
a6da6967 225 LC_ALL=C sort -u > all-distfiles; \
39376d06 226 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
a6da6967
BP
227 LC_ALL=C sort -u > all-gitfiles; \
228 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
39376d06 229 if test -s missing-distfiles; then \
4207d631 230 echo "The following files are in git but not the distribution:"; \
39376d06
BP
231 cat missing-distfiles; \
232 exit 1; \
233 fi; \
87103e1f 234 fi
39376d06
BP
235CLEANFILES += all-distfiles all-gitfiles missing-distfiles
236# The following is based on commands for the Automake "distdir" target.
237distfiles: Makefile
238 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
239 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
240 list='$(DISTFILES)'; \
241 for file in $$list; do echo $$file; done | \
242 sed -e "s|^$$srcdirstrip/||;t" \
a6da6967
BP
243 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
244 LC_ALL=C sort -u > $@
39376d06 245CLEANFILES += distfiles
b4e1bf8b
BP
246endif
247.PHONY: dist-hook-git
87103e1f 248
9e4ba008
BP
249# Check that every .c file includes <config.h>.
250ALL_LOCAL += config-h-check
251config-h-check:
252 @cd $(srcdir); \
253 if test -e .git && (git --version) >/dev/null 2>&1 && \
b411e5c3 254 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
c63b04d6 255 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows|^python'`; \
9e4ba008
BP
256 then \
257 echo "See above for list of violations of the rule that"; \
258 echo "every C source file must #include <config.h>."; \
259 exit 1; \
260 fi
261.PHONY: config-h-check
262
34582733
AS
263# Check for printf() type modifiers that MSVC doesn't support.
264ALL_LOCAL += printf-check
265printf-check:
8faeab72
DDP
266 @cd $(srcdir); \
267 if test -e .git && (git --version) >/dev/null 2>&1 && \
268 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
3b3f8857 269 grep -vE '^datapath|^lib/sflow|^third-party'`; \
34582733
AS
270 then \
271 echo "See above for list of violations of the rule that"; \
272 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
542cc9bb 273 echo "forbidden. See CodingStyle.md for replacements."; \
34582733
AS
274 exit 1; \
275 fi
276.PHONY: printf-check
277
1514b275
BP
278# Check that certain data structures are always declared "static".
279ALL_LOCAL += static-check
280static-check:
db5ce514 281 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
1514b275 282 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
db5ce514
BP
283 then \
284 echo "See above for list of violations of the rule that "; \
1514b275 285 echo "certain data structures must always be 'static'"; \
db5ce514
BP
286 exit 1; \
287 fi
1514b275 288.PHONY: static-check
db5ce514 289
4958e3ee
BP
290# Check that assert.h is not used outside a whitelist of files.
291ALL_LOCAL += check-assert-h-usage
292check-assert-h-usage:
293 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
294 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
92fa2e92 295 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
4958e3ee
BP
296 then \
297 echo "Files listed above unexpectedly #include <""assert.h"">."; \
298 echo "Please use ovs_assert (from util.h) instead of assert."; \
299 exit 1; \
300 fi
301.PHONY: check-assert-h-usage
302
64746850
BP
303# Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
304# also mentioned. (<endian.h> always defines the former two constants. They
305# must be compared to BYTE_ORDER to get the machine's correct endianness. But
306# it is better to use WORDS_BIGENDIAN.)
307ALL_LOCAL += check-endian
308check-endian:
309 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
310 (cd $(srcdir) && git --no-pager grep -l -E \
311 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
312 $(EGREP) -v '^datapath/'); \
313 then \
314 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
315 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
316 exit 1; \
317 fi
318.PHONY: check-endian
319
6a3e30f3
BP
320ALL_LOCAL += thread-safety-check
321thread-safety-check:
8faeab72
DDP
322 @cd $(srcdir); \
323 if test -e .git && (git --version) >/dev/null 2>&1 && \
324 grep -n -f build-aux/thread-safety-blacklist \
325 `git ls-files | grep '\.[ch]$$' \
ca3d034b 326 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
6a3e30f3
BP
327 | $(EGREP) -v ':[ ]*/?\*'; \
328 then \
329 echo "See above for list of calls to functions that are"; \
330 echo "blacklisted due to thread safety issues"; \
331 exit 1; \
332 fi
333EXTRA_DIST += build-aux/thread-safety-blacklist
c9172561 334.PHONY: thread-safety-check
6a3e30f3 335
0027492d
BP
336if HAVE_GROFF
337ALL_LOCAL += manpage-check
1261619f
BP
338manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
339 @error=false; \
340 for manpage in $?; do \
186ef5c1 341 LANG=en_US.UTF-8 groff -w mac -w delim -w escape -w input -w missing -w tab -T utf8 -man -p -z $$manpage >$@.tmp 2>&1; \
1261619f
BP
342 if grep warning: $@.tmp; then error=:; fi; \
343 rm -f $@.tmp; \
0027492d 344 done; \
be09aa10
EJ
345 if $$error; then exit 1; else touch $@; fi
346 $(AM_V_GEN) touch -c $@
0027492d
BP
347CLEANFILES += manpage-check
348endif
349
115d8719
RB
350if HAVE_FLAKE8
351ALL_LOCAL += flake8-check
007ec24d 352# http://flake8.readthedocs.org/en/latest/warnings.html
f3068bff
RB
353# All warnings explicitly selected or ignored should be listed below.
354#
355# E***, W*** -- warnings from pep8
356# E121 continuation line under-indented for hanging indent (only from flake8 v2.0)
357# E123 closing bracket does not match indentation of opening bracket's line
358# E125 continuation line with same indent as next logical line (only from flake8 v2.0)
359# E126 continuation line over-indented for hanging indent
360# E127 continuation line over-indented for visual indent
361# E128 continuation line under-indented for visual indent
362# E129 visually indented line with same indent as next logical line
363# E131 continuation line unaligned for hanging indent
364# W503 line break before binary operator
365# F*** -- warnings native to flake8
366# F811 redefinition of unused <name> from line <N> (only from flake8 v2.0)
007ec24d
NS
367# D*** -- warnings from flake8-docstrings plugin
368# H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
f3068bff 369# H231 Python 3.x incompatible 'except x,y:' construct
56ec0611 370# H232 Python 3.x incompatible octal 077 should be written as 0o77
8ea171ab 371# H233 Python 3.x incompatible use of print operator
03756304 372# H238 old style class declaration, use new style (inherit from `object`)
115d8719 373flake8-check: $(FLAKE8_PYFILES)
490bafe8
RB
374 $(AM_V_GEN) if flake8 $^ --select=H231,H232,H233,H238 ${FLAKE8_FLAGS} && \
375 flake8 $^ --ignore=E121,E123,E125,E126,E127,E128,E129,E131,W503,F811,D,H ${FLAKE8_FLAGS}; then \
376 touch $@; else exit 1; fi
115d8719 377endif
968eec59 378CLEANFILES += flake8-check
115d8719 379
6ca37677
BP
380include $(srcdir)/manpages.mk
381$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
382 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
383 @if cmp -s $(@F).tmp $@; then \
384 touch $@; \
385 rm -f $(@F).tmp; \
386 else \
387 mv $(@F).tmp $@; \
388 fi
389CLEANFILES += manpage-dep-check
390
bd9d7025 391if VSTUDIO_DDK
e02b8fb0
AS
392ALL_LOCAL += ovsext
393ovsext: datapath-windows/ovsext.sln $(srcdir)/datapath-windows/include/OvsDpInterface.h
394 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)"
395 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
bd9d7025
AS
396
397CLEAN_LOCAL += ovsext_clean
398ovsext_clean: datapath-windows/ovsext.sln
e02b8fb0
AS
399 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)"
400 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
bd9d7025 401endif
e02b8fb0 402.PHONY: ovsext
bd9d7025 403
30b79363
BB
404clang-analyze: clean
405 @which clang scan-build >/dev/null 2>&1 || \
406 (echo "Unable to find clang/scan-build, Install clang,clang-analyzer packages"; exit 1)
407 @$(MKDIR_P) "$(srcdir)/tests/clang-analyzer-results"
408 @scan-build -o $(srcdir)/tests/clang-analyzer-results --use-cc=$(CC) $(MAKE)
409.PHONY: clang-analyze
410
87103e1f 411dist-hook: $(DIST_HOOKS)
22c79496 412all-local: $(ALL_LOCAL)
15b619e2 413clean-local: $(CLEAN_LOCAL)
b2df0225 414install-data-local: $(INSTALL_DATA_LOCAL)
44852fdf
BP
415uninstall-local: $(UNINSTALL_LOCAL)
416.PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
87103e1f 417
3a14d239
BP
418modules_install:
419if LINUX_ENABLED
420 cd datapath/linux && $(MAKE) modules_install
421endif
422
4441a01c 423dist-docs:
6b304335 424 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
4441a01c
BP
425.PHONY: dist-docs
426
8c254406 427include Documentation/automake.mk
ed1be787 428include m4/automake.mk
064af421 429include lib/automake.mk
8cd4882f 430include ofproto/automake.mk
064af421
BP
431include utilities/automake.mk
432include tests/automake.mk
433include include/automake.mk
434include third-party/automake.mk
435include debian/automake.mk
436include vswitchd/automake.mk
f85f8ebb 437include ovsdb/automake.mk
c434706a 438include rhel/automake.mk
064af421 439include xenserver/automake.mk
0be6140a 440include python/automake.mk
eeecce05 441include tutorial/automake.mk
add17b69 442include vtep/automake.mk
c803536e 443include datapath-windows/automake.mk
c640e3ce 444include datapath-windows/include/automake.mk
d183efc2 445include windows/automake.mk
fe36184b 446include ovn/automake.mk
9b897c91 447include selinux/automake.mk