1 # Copyright (C) 2007-2017 Nicira, Inc.
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.
8 AUTOMAKE_OPTIONS = foreign subdir-objects
9 ACLOCAL_AMFLAGS = -I m4
12 AM_CPPFLAGS = $(SSL_CFLAGS)
13 AM_LDFLAGS = $(SSL_LDFLAGS)
14 AM_LDFLAGS += $(OVS_LDFLAGS)
17 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
18 AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
19 AM_CPPFLAGS += $(PTHREAD_INCLUDES)
20 AM_CPPFLAGS += $(MSVC_CFLAGS)
21 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
22 AM_LDFLAGS += $(MSVC64_LDFLAGS)
23 PLATFORM = $(MSVC_PLATFORM)
26 AM_CPPFLAGS += -I $(top_srcdir)/include
27 AM_CPPFLAGS += -I $(top_builddir)/include
28 AM_CPPFLAGS += -I $(top_srcdir)/lib
29 AM_CPPFLAGS += -I $(top_builddir)/lib
31 AM_CPPFLAGS += $(SSL_INCLUDES)
33 AM_CFLAGS = -Wstrict-prototypes
34 AM_CFLAGS += $(WARNING_FLAGS)
35 AM_CFLAGS += $(OVS_CFLAGS)
38 AM_CFLAGS += -D_FILE_OFFSET_BITS=64
39 DPDKSTRIP_FLAGS = --dpdk
41 DPDKSTRIP_FLAGS = --nodpdk
45 AM_CPPFLAGS += -DNDEBUG
46 AM_CFLAGS += -fomit-frame-pointer
49 AM_CTAGSFLAGS = $(OVS_CTAGS_IDENTIFIERS_LIST)
56 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
57 # files. Creating .py[co] works OK for any given version of Open
58 # vSwitch, but it causes trouble if you switch from a version with
59 # foo/__init__.py into an (older) version with plain foo.py, since
60 # foo/__init__.pyc will cause Python to ignore foo.py.
62 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
63 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
70 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
79 .travis/linux-build.sh \
80 .travis/linux-prepare.sh \
81 .travis/osx-build.sh \
82 .travis/osx-prepare.sh \
86 build-aux/cksum-schema-check \
87 build-aux/calculate-schema-cksum \
89 build-aux/dpdkstrip.py \
90 build-aux/sodepends.py \
91 build-aux/soexpand.py \
93 poc/builders/Vagrantfile \
94 poc/playbook-centos-builder.yml \
95 poc/playbook-ubuntu-builder.yml \
107 dist_pkgdata_SCRIPTS =
109 dist_scripts_SCRIPTS =
135 if ENABLE_SPARSE_BY_DEFAULT
139 scriptsdir = $(pkgdatadir)/scripts
140 completiondir = $(sysconfdir)/bash_completion.d
141 pkgconfigdir = $(libdir)/pkgconfig
143 # This ensures that files added to EXTRA_DIST are always distributed,
144 # even if they are inside an Automake if...endif conditional block that is
145 # disabled by some particular "configure" run. For more information, see:
146 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
147 noinst_HEADERS += $(EXTRA_DIST)
149 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
150 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
154 $(AM_V_GEN)PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON) $(srcdir)/build-aux/soexpand.py -I$(srcdir) < $< | \
155 $(PYTHON) $(srcdir)/build-aux/dpdkstrip.py $(DPDKSTRIP_FLAGS) | \
157 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
158 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
159 -e 's,[@]DBDIR[@],$(DBDIR),g' \
160 -e 's,[@]PYTHON[@],$(PYTHON),g' \
161 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
162 -e 's,[@]VERSION[@],$(VERSION),g' \
163 -e 's,[@]localstatedir[@],$(localstatedir),g' \
164 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
165 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
166 -e 's,[@]bindir[@],$(bindir),g' \
167 -e 's,[@]sbindir[@],$(sbindir),g' \
168 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
169 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
171 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
174 $(AM_V_at) mv $@.tmp $@
178 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
180 --version=$(VERSION) \
186 VERSION='$(VERSION)' \
187 localstatedir='$(localstatedir)' \
188 pkgdatadir='$(pkgdatadir)' \
189 sysconfdir='$(sysconfdir)' \
192 $(AM_v_at)mv $@.tmp $@
195 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
196 CLEAN_LOCAL += clean-pycov
199 # If we're checked out from a Git repository, make sure that every
200 # file that is in Git is distributed.
201 ALL_LOCAL += dist-hook-git
202 dist-hook-git: distfiles
203 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
204 (cd datapath && $(MAKE) distfiles); \
205 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
206 LC_ALL=C sort -u > all-distfiles; \
207 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
208 LC_ALL=C sort -u > all-gitfiles; \
209 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
210 if test -s missing-distfiles; then \
211 echo "The following files are in git but not the distribution:"; \
212 cat missing-distfiles; \
215 if LC_ALL=C grep '\.gitignore$$' all-distfiles; then \
216 echo "See above for list of files that are distributed but"; \
217 echo "should not be."; \
221 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
222 # The following is based on commands for the Automake "distdir" target.
224 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
225 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
226 list='$(DISTFILES)'; \
227 for file in $$list; do echo $$file; done | \
228 sed -e "s|^$$srcdirstrip/||;t" \
229 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
230 LC_ALL=C sort -u > $@
231 CLEANFILES += distfiles
232 .PHONY: dist-hook-git
234 # Check that every .c file includes <config.h>.
235 ALL_LOCAL += config-h-check
238 if test -e .git && (git --version) >/dev/null 2>&1 && \
239 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
240 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows|^python'`; \
242 echo "See above for list of violations of the rule that"; \
243 echo "every C source file must #include <config.h>."; \
246 if grep '#include' include/openvswitch/*.h | \
247 grep -vE '(<.*>)|("openvswitch)|("openflow)'; \
249 echo "See above for list of violations of the rule that"; \
250 echo "public openvswitch header file should not include internal library."; \
253 .PHONY: config-h-check
255 # Check for printf() type modifiers that MSVC doesn't support.
256 ALL_LOCAL += printf-check
259 if test -e .git && (git --version) >/dev/null 2>&1 && \
260 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
261 grep -vE '^datapath|^lib/sflow|^third-party'`; \
263 echo "See above for list of violations of the rule that"; \
264 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
265 echo "forbidden. See coding-style.rst for replacements."; \
270 # Check that certain data structures are always declared "static".
271 ALL_LOCAL += static-check
273 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
274 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
276 echo "See above for list of violations of the rule that "; \
277 echo "certain data structures must always be 'static'"; \
282 # Check that assert.h is not used outside a whitelist of files.
283 ALL_LOCAL += check-assert-h-usage
284 check-assert-h-usage:
285 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
286 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
287 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
289 echo "Files listed above unexpectedly #include <""assert.h"">."; \
290 echo "Please use ovs_assert (from util.h) instead of assert."; \
293 .PHONY: check-assert-h-usage
295 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
296 # also mentioned. (<endian.h> always defines the former two constants. They
297 # must be compared to BYTE_ORDER to get the machine's correct endianness. But
298 # it is better to use WORDS_BIGENDIAN.)
299 ALL_LOCAL += check-endian
301 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
302 (cd $(srcdir) && git --no-pager grep -l -E \
303 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
304 $(EGREP) -v '^datapath/'); \
306 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
307 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
312 ALL_LOCAL += check-echo-n
314 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
315 git --no-pager grep -n 'echo'' -n' $(srcdir); \
317 echo "See above for uses for \"echo"" -n\", which is non-POSIX"; \
318 echo "and does not work with all shells. Use \"printf\" instead."; \
323 ALL_LOCAL += thread-safety-check
326 if test -e .git && (git --version) >/dev/null 2>&1 && \
327 grep -n -f build-aux/thread-safety-blacklist \
328 `git ls-files | grep '\.[ch]$$' \
329 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
330 | $(EGREP) -v ':[ ]*/?\*'; \
332 echo "See above for list of calls to functions that are"; \
333 echo "blacklisted due to thread safety issues"; \
336 EXTRA_DIST += build-aux/thread-safety-blacklist
337 .PHONY: thread-safety-check
339 # Check that "ip" is used in preference to "ifconfig", because
340 # "ifconfig" is not installed ubiquitously anymore.
341 ALL_LOCAL += check-ifconfig
343 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
344 (cd $(srcdir) && git --no-pager grep -l -E -e 'ifconfig' | \
345 $(EGREP) -v 'Makefile.am|ovs-vsctl-bashcomp|openvswitch-custom\.te'); \
347 echo "See above for list of files that use or reference"; \
348 echo "'ifconfig'. Please use 'ip' instead."; \
351 .PHONY: check-ifconfig
354 ALL_LOCAL += manpage-check
355 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
357 for manpage in $?; do \
358 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; \
359 if grep warning: $@.tmp; then error=:; fi; \
362 if $$error; then exit 1; else touch $@; fi
363 $(AM_V_GEN) touch -c $@
364 CLEANFILES += manpage-check
368 ALL_LOCAL += flake8-check
369 # http://flake8.readthedocs.org/en/latest/user/error-codes.html
370 # All warnings explicitly selected or ignored should be listed below.
372 # E***, W*** -- warnings from pep8
373 # E121 continuation line under-indented for hanging indent (only from flake8 v2.0)
374 # E123 closing bracket does not match indentation of opening bracket's line
375 # E125 continuation line with same indent as next logical line (only from flake8 v2.0)
376 # E126 continuation line over-indented for hanging indent
377 # E127 continuation line over-indented for visual indent
378 # E128 continuation line under-indented for visual indent
379 # E129 visually indented line with same indent as next logical line
380 # E131 continuation line unaligned for hanging indent
381 # E722 do not use bare except, specify exception instead
382 # W503 line break before binary operator
383 # F*** -- warnings native to flake8
384 # F811 redefinition of unused <name> from line <N> (only from flake8 v2.0)
385 # D*** -- warnings from flake8-docstrings plugin
386 # H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
387 # H231 Python 3.x incompatible 'except x,y:' construct
388 # H232 Python 3.x incompatible octal 077 should be written as 0o77
389 # H233 Python 3.x incompatible use of print operator
390 # H238 old style class declaration, use new style (inherit from `object`)
391 FLAKE8_SELECT = H231,H232,H233,H238
392 FLAKE8_IGNORE = E121,E123,E125,E126,E127,E128,E129,E131,E722,W503,F811,D,H,I
393 flake8-check: $(FLAKE8_PYFILES)
394 $(FLAKE8_WERROR)$(AM_V_GEN) \
396 flake8 $$src --select=$(FLAKE8_SELECT) $(FLAKE8_FLAGS) && \
397 flake8 $$src --ignore=$(FLAKE8_IGNORE) $(FLAKE8_FLAGS) && \
400 CLEANFILES += flake8-check
402 include $(srcdir)/manpages.mk
403 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py python/build/soutil.py
404 @PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON) $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
405 @if cmp -s $(@F).tmp $@; then \
411 CLEANFILES += manpage-dep-check
416 ovsext: datapath-windows/ovsext.sln $(srcdir)/datapath-windows/include/OvsDpInterface.h
418 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
421 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
424 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win10$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
428 CLEAN_LOCAL += ovsext_clean
429 ovsext_clean: datapath-windows/ovsext.sln
431 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
434 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
437 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win10$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
443 @which clang scan-build >/dev/null 2>&1 || \
444 (echo "Unable to find clang/scan-build, Install clang,clang-analyzer packages"; exit 1)
445 @$(MKDIR_P) "$(srcdir)/tests/clang-analyzer-results"
446 @scan-build -o $(srcdir)/tests/clang-analyzer-results --use-cc=$(CC) $(MAKE)
447 .PHONY: clang-analyze
449 dist-hook: $(DIST_HOOKS)
450 all-local: $(ALL_LOCAL)
451 clean-local: $(CLEAN_LOCAL)
452 install-data-local: $(INSTALL_DATA_LOCAL)
453 uninstall-local: $(UNINSTALL_LOCAL)
454 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
458 cd datapath/linux && $(MAKE) modules_install
462 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
465 include Documentation/automake.mk
466 include m4/automake.mk
467 include lib/automake.mk
468 include ofproto/automake.mk
469 include utilities/automake.mk
470 include tests/automake.mk
471 include include/automake.mk
472 include third-party/automake.mk
473 include debian/automake.mk
474 include vswitchd/automake.mk
475 include ovsdb/automake.mk
476 include rhel/automake.mk
477 include xenserver/automake.mk
478 include python/automake.mk
479 include tutorial/automake.mk
480 include vtep/automake.mk
481 include datapath-windows/automake.mk
482 include datapath-windows/include/automake.mk
483 include windows/automake.mk
484 include ovn/automake.mk
485 include selinux/automake.mk
486 include build-aux/automake.mk