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)
25 AM_CPPFLAGS += -I $(top_srcdir)/include
26 AM_CPPFLAGS += -I $(top_builddir)/include
27 AM_CPPFLAGS += -I $(top_srcdir)/lib
28 AM_CPPFLAGS += -I $(top_builddir)/lib
30 AM_CPPFLAGS += $(SSL_INCLUDES)
32 AM_CFLAGS = -Wstrict-prototypes
33 AM_CFLAGS += $(WARNING_FLAGS)
34 AM_CFLAGS += $(OVS_CFLAGS)
37 AM_CFLAGS += -D_FILE_OFFSET_BITS=64
38 DPDKSTRIP_FLAGS = --dpdk
40 DPDKSTRIP_FLAGS = --nodpdk
44 AM_CPPFLAGS += -DNDEBUG
45 AM_CFLAGS += -fomit-frame-pointer
48 AM_CTAGSFLAGS = $(OVS_CTAGS_IDENTIFIERS_LIST)
55 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
56 # files. Creating .py[co] works OK for any given version of Open
57 # vSwitch, but it causes trouble if you switch from a version with
58 # foo/__init__.py into an (older) version with plain foo.py, since
59 # foo/__init__.pyc will cause Python to ignore foo.py.
61 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
62 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
69 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
78 .travis/linux-build.sh \
79 .travis/linux-prepare.sh \
80 .travis/osx-build.sh \
81 .travis/osx-prepare.sh \
85 build-aux/cksum-schema-check \
86 build-aux/calculate-schema-cksum \
88 build-aux/dpdkstrip.pl \
89 build-aux/sodepends.pl \
90 build-aux/soexpand.pl \
103 dist_pkgdata_SCRIPTS =
105 dist_scripts_SCRIPTS =
131 scriptsdir = $(pkgdatadir)/scripts
132 completiondir = $(sysconfdir)/bash_completion.d
133 pkgconfigdir = $(libdir)/pkgconfig
135 # This ensures that files added to EXTRA_DIST are always distributed,
136 # even if they are inside an Automake if...endif conditional block that is
137 # disabled by some particular "configure" run. For more information, see:
138 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
139 noinst_HEADERS += $(EXTRA_DIST)
141 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
142 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
146 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
147 $(PERL) $(srcdir)/build-aux/dpdkstrip.pl $(DPDKSTRIP_FLAGS) | \
149 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
150 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
151 -e 's,[@]DBDIR[@],$(DBDIR),g' \
152 -e 's,[@]PERL[@],$(PERL),g' \
153 -e 's,[@]PYTHON[@],$(PYTHON),g' \
154 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
155 -e 's,[@]VERSION[@],$(VERSION),g' \
156 -e 's,[@]localstatedir[@],$(localstatedir),g' \
157 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
158 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
159 -e 's,[@]bindir[@],$(bindir),g' \
160 -e 's,[@]sbindir[@],$(sbindir),g' \
161 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
162 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
164 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
167 $(AM_V_at) mv $@.tmp $@
171 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
173 --version=$(VERSION) \
180 VERSION='$(VERSION)' \
181 localstatedir='$(localstatedir)' \
182 pkgdatadir='$(pkgdatadir)' \
183 sysconfdir='$(sysconfdir)' \
186 $(AM_v_at)mv $@.tmp $@
189 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
190 CLEAN_LOCAL += clean-pycov
193 # If we're checked out from a Git repository, make sure that every
194 # file that is in Git is distributed.
195 ALL_LOCAL += dist-hook-git
196 dist-hook-git: distfiles
197 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
198 (cd datapath && $(MAKE) distfiles); \
199 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
200 LC_ALL=C sort -u > all-distfiles; \
201 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
202 LC_ALL=C sort -u > all-gitfiles; \
203 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
204 if test -s missing-distfiles; then \
205 echo "The following files are in git but not the distribution:"; \
206 cat missing-distfiles; \
209 if LC_ALL=C grep '\.gitignore$$' all-distfiles; then \
210 echo "See above for list of files that are distributed but"; \
211 echo "should not be."; \
215 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
216 # The following is based on commands for the Automake "distdir" target.
218 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
219 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
220 list='$(DISTFILES)'; \
221 for file in $$list; do echo $$file; done | \
222 sed -e "s|^$$srcdirstrip/||;t" \
223 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
224 LC_ALL=C sort -u > $@
225 CLEANFILES += distfiles
226 .PHONY: dist-hook-git
228 # Check that every .c file includes <config.h>.
229 ALL_LOCAL += config-h-check
232 if test -e .git && (git --version) >/dev/null 2>&1 && \
233 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
234 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows|^python'`; \
236 echo "See above for list of violations of the rule that"; \
237 echo "every C source file must #include <config.h>."; \
240 if grep '#include' include/openvswitch/*.h | \
241 grep -vE '(<.*>)|("openvswitch)|("openflow)'; \
243 echo "See above for list of violations of the rule that"; \
244 echo "public openvswitch header file should not include internal library."; \
247 .PHONY: config-h-check
249 # Check for printf() type modifiers that MSVC doesn't support.
250 ALL_LOCAL += printf-check
253 if test -e .git && (git --version) >/dev/null 2>&1 && \
254 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
255 grep -vE '^datapath|^lib/sflow|^third-party'`; \
257 echo "See above for list of violations of the rule that"; \
258 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
259 echo "forbidden. See coding-style.rst for replacements."; \
264 # Check that certain data structures are always declared "static".
265 ALL_LOCAL += static-check
267 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
268 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
270 echo "See above for list of violations of the rule that "; \
271 echo "certain data structures must always be 'static'"; \
276 # Check that assert.h is not used outside a whitelist of files.
277 ALL_LOCAL += check-assert-h-usage
278 check-assert-h-usage:
279 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
280 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
281 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
283 echo "Files listed above unexpectedly #include <""assert.h"">."; \
284 echo "Please use ovs_assert (from util.h) instead of assert."; \
287 .PHONY: check-assert-h-usage
289 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
290 # also mentioned. (<endian.h> always defines the former two constants. They
291 # must be compared to BYTE_ORDER to get the machine's correct endianness. But
292 # it is better to use WORDS_BIGENDIAN.)
293 ALL_LOCAL += check-endian
295 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
296 (cd $(srcdir) && git --no-pager grep -l -E \
297 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
298 $(EGREP) -v '^datapath/'); \
300 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
301 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
306 ALL_LOCAL += thread-safety-check
309 if test -e .git && (git --version) >/dev/null 2>&1 && \
310 grep -n -f build-aux/thread-safety-blacklist \
311 `git ls-files | grep '\.[ch]$$' \
312 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
313 | $(EGREP) -v ':[ ]*/?\*'; \
315 echo "See above for list of calls to functions that are"; \
316 echo "blacklisted due to thread safety issues"; \
319 EXTRA_DIST += build-aux/thread-safety-blacklist
320 .PHONY: thread-safety-check
322 # Check that "ip" is used in preference to "ifconfig", because
323 # "ifconfig" is not installed ubiquitously anymore.
324 ALL_LOCAL += check-ifconfig
326 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
327 (cd $(srcdir) && git --no-pager grep -l -E -e 'ifconfig' | \
328 $(EGREP) -v 'Makefile.am|ovs-vsctl-bashcomp|openvswitch-custom\.te'); \
330 echo "See above for list of files that use or reference"; \
331 echo "'ifconfig'. Please use 'ip' instead."; \
334 .PHONY: check-ifconfig
337 ALL_LOCAL += manpage-check
338 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
340 for manpage in $?; do \
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; \
342 if grep warning: $@.tmp; then error=:; fi; \
345 if $$error; then exit 1; else touch $@; fi
346 $(AM_V_GEN) touch -c $@
347 CLEANFILES += manpage-check
351 ALL_LOCAL += flake8-check
352 # http://flake8.readthedocs.org/en/latest/warnings.html
353 # All warnings explicitly selected or ignored should be listed below.
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)
367 # D*** -- warnings from flake8-docstrings plugin
368 # H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
369 # H231 Python 3.x incompatible 'except x,y:' construct
370 # H232 Python 3.x incompatible octal 077 should be written as 0o77
371 # H233 Python 3.x incompatible use of print operator
372 # H238 old style class declaration, use new style (inherit from `object`)
373 FLAKE8_SELECT = H231,H232,H233,H238
374 FLAKE8_IGNORE = E121,E123,E125,E126,E127,E128,E129,E131,W503,F811,D,H,I
375 flake8-check: $(FLAKE8_PYFILES)
376 $(FLAKE8_WERROR)$(AM_V_GEN) \
378 flake8 $$src --select=$(FLAKE8_SELECT) $(FLAKE8_FLAGS) && \
379 flake8 $$src --ignore=$(FLAKE8_IGNORE) $(FLAKE8_FLAGS) && \
382 CLEANFILES += flake8-check
384 include $(srcdir)/manpages.mk
385 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
386 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
387 @if cmp -s $(@F).tmp $@; then \
393 CLEANFILES += manpage-dep-check
397 ovsext: datapath-windows/ovsext.sln $(srcdir)/datapath-windows/include/OvsDpInterface.h
398 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
399 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
401 CLEAN_LOCAL += ovsext_clean
402 ovsext_clean: datapath-windows/ovsext.sln
403 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
404 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
409 @which clang scan-build >/dev/null 2>&1 || \
410 (echo "Unable to find clang/scan-build, Install clang,clang-analyzer packages"; exit 1)
411 @$(MKDIR_P) "$(srcdir)/tests/clang-analyzer-results"
412 @scan-build -o $(srcdir)/tests/clang-analyzer-results --use-cc=$(CC) $(MAKE)
413 .PHONY: clang-analyze
415 dist-hook: $(DIST_HOOKS)
416 all-local: $(ALL_LOCAL)
417 clean-local: $(CLEAN_LOCAL)
418 install-data-local: $(INSTALL_DATA_LOCAL)
419 uninstall-local: $(UNINSTALL_LOCAL)
420 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
424 cd datapath/linux && $(MAKE) modules_install
428 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
431 include Documentation/automake.mk
432 include m4/automake.mk
433 include lib/automake.mk
434 include ofproto/automake.mk
435 include utilities/automake.mk
436 include tests/automake.mk
437 include include/automake.mk
438 include third-party/automake.mk
439 include debian/automake.mk
440 include vswitchd/automake.mk
441 include ovsdb/automake.mk
442 include rhel/automake.mk
443 include xenserver/automake.mk
444 include python/automake.mk
445 include tutorial/automake.mk
446 include vtep/automake.mk
447 include datapath-windows/automake.mk
448 include datapath-windows/include/automake.mk
449 include windows/automake.mk
450 include ovn/automake.mk
451 include selinux/automake.mk
452 include build-aux/automake.mk