1 # Copyright (C) 2007-2016 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
41 AM_CPPFLAGS += -DNDEBUG
42 AM_CFLAGS += -fomit-frame-pointer
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.
56 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
57 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
64 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
66 # A list of Markdown-formatted documentation that will automatically be
67 # included in the "make dist-docs" output.
83 INSTALL.XenServer.md \
84 INSTALL.userspace.md \
92 README-native-tunneling.md \
106 build-aux/cksum-schema-check \
107 build-aux/dist-docs \
108 build-aux/sodepends.pl \
109 build-aux/soexpand.pl \
110 build-aux/xml2nroff \
120 dist_pkgdata_SCRIPTS =
122 dist_scripts_SCRIPTS =
147 scriptsdir = $(pkgdatadir)/scripts
148 completiondir = $(sysconfdir)/bash_completion.d
149 pkgconfigdir = $(libdir)/pkgconfig
151 # This ensures that files added to EXTRA_DIST are always distributed,
152 # even if they are inside an Automake if...endif conditional block that is
153 # disabled by some particular "configure" run. For more information, see:
154 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
155 noinst_HEADERS += $(EXTRA_DIST)
157 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
158 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
162 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
164 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
165 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
166 -e 's,[@]DBDIR[@],$(DBDIR),g' \
167 -e 's,[@]PERL[@],$(PERL),g' \
168 -e 's,[@]PYTHON[@],$(PYTHON),g' \
169 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
170 -e 's,[@]VERSION[@],$(VERSION),g' \
171 -e 's,[@]localstatedir[@],$(localstatedir),g' \
172 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
173 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
174 -e 's,[@]bindir[@],$(bindir),g' \
175 -e 's,[@]sbindir[@],$(sbindir),g' \
176 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
177 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
179 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
182 $(AM_V_at) mv $@.tmp $@
186 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
188 --version=$(VERSION) \
195 VERSION='$(VERSION)' \
196 localstatedir='$(localstatedir)' \
197 pkgdatadir='$(pkgdatadir)' \
198 sysconfdir='$(sysconfdir)' \
201 $(AM_v_at)mv $@.tmp $@
205 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
206 CLEAN_LOCAL += clean-pycov
208 # If we're checked out from a Git repository, make sure that every
209 # file that is in Git is distributed.
211 # We only enable this check when GNU make is in use because the
212 # Makefile in datapath/linux, needed to get the list of files to
213 # distribute, requires GNU make extensions.
215 ALL_LOCAL += dist-hook-git
216 dist-hook-git: distfiles
217 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
218 (cd datapath && $(MAKE) distfiles); \
219 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
220 LC_ALL=C sort -u > all-distfiles; \
221 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
222 LC_ALL=C sort -u > all-gitfiles; \
223 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
224 if test -s missing-distfiles; then \
225 echo "The following files are in git but not the distribution:"; \
226 cat missing-distfiles; \
230 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
231 # The following is based on commands for the Automake "distdir" target.
233 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
234 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
235 list='$(DISTFILES)'; \
236 for file in $$list; do echo $$file; done | \
237 sed -e "s|^$$srcdirstrip/||;t" \
238 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
239 LC_ALL=C sort -u > $@
240 CLEANFILES += distfiles
242 .PHONY: dist-hook-git
244 # Check that every .c file includes <config.h>.
245 ALL_LOCAL += config-h-check
248 if test -e .git && (git --version) >/dev/null 2>&1 && \
249 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
250 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
252 echo "See above for list of violations of the rule that"; \
253 echo "every C source file must #include <config.h>."; \
256 .PHONY: config-h-check
258 # Check for printf() type modifiers that MSVC doesn't support.
259 ALL_LOCAL += printf-check
262 if test -e .git && (git --version) >/dev/null 2>&1 && \
263 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
264 grep -vE '^datapath|^lib/sflow|^third-party'`; \
266 echo "See above for list of violations of the rule that"; \
267 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
268 echo "forbidden. See CodingStyle.md for replacements."; \
273 # Check that certain data structures are always declared "static".
274 ALL_LOCAL += static-check
276 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
277 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
279 echo "See above for list of violations of the rule that "; \
280 echo "certain data structures must always be 'static'"; \
285 # Check that assert.h is not used outside a whitelist of files.
286 ALL_LOCAL += check-assert-h-usage
287 check-assert-h-usage:
288 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
289 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
290 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
292 echo "Files listed above unexpectedly #include <""assert.h"">."; \
293 echo "Please use ovs_assert (from util.h) instead of assert."; \
296 .PHONY: check-assert-h-usage
298 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
299 # also mentioned. (<endian.h> always defines the former two constants. They
300 # must be compared to BYTE_ORDER to get the machine's correct endianness. But
301 # it is better to use WORDS_BIGENDIAN.)
302 ALL_LOCAL += check-endian
304 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
305 (cd $(srcdir) && git --no-pager grep -l -E \
306 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
307 $(EGREP) -v '^datapath/'); \
309 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
310 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
315 ALL_LOCAL += thread-safety-check
318 if test -e .git && (git --version) >/dev/null 2>&1 && \
319 grep -n -f build-aux/thread-safety-blacklist \
320 `git ls-files | grep '\.[ch]$$' \
321 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
322 | $(EGREP) -v ':[ ]*/?\*'; \
324 echo "See above for list of calls to functions that are"; \
325 echo "blacklisted due to thread safety issues"; \
328 EXTRA_DIST += build-aux/thread-safety-blacklist
329 .PHONY: thread-safety-check
332 ALL_LOCAL += manpage-check
333 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
335 for manpage in $?; do \
336 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; \
337 if grep warning: $@.tmp; then error=:; fi; \
340 if $$error; then exit 1; else touch $@; fi
341 $(AM_V_GEN) touch -c $@
342 CLEANFILES += manpage-check
346 ALL_LOCAL += flake8-check
347 # http://flake8.readthedocs.org/en/latest/warnings.html
348 # All warnings explicitly selected or ignored should be listed below.
350 # E***, W*** -- warnings from pep8
351 # E121 continuation line under-indented for hanging indent (only from flake8 v2.0)
352 # E123 closing bracket does not match indentation of opening bracket's line
353 # E125 continuation line with same indent as next logical line (only from flake8 v2.0)
354 # E126 continuation line over-indented for hanging indent
355 # E127 continuation line over-indented for visual indent
356 # E128 continuation line under-indented for visual indent
357 # E129 visually indented line with same indent as next logical line
358 # E131 continuation line unaligned for hanging indent
359 # W503 line break before binary operator
360 # F*** -- warnings native to flake8
361 # F811 redefinition of unused <name> from line <N> (only from flake8 v2.0)
362 # D*** -- warnings from flake8-docstrings plugin
363 # H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
364 # H231 Python 3.x incompatible 'except x,y:' construct
365 # H232 Python 3.x incompatible octal 077 should be written as 0o77
366 # H233 Python 3.x incompatible use of print operator
367 # H238 old style class declaration, use new style (inherit from `object`)
368 flake8-check: $(FLAKE8_PYFILES)
369 $(AM_V_GEN) if flake8 $^ --select=H231,H232,H233,H238 ${FLAKE8_FLAGS} && \
370 flake8 $^ --ignore=E121,E123,E125,E126,E127,E128,E129,E131,W503,F811,D,H ${FLAKE8_FLAGS}; then \
371 touch $@; else exit 1; fi
374 include $(srcdir)/manpages.mk
375 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
376 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
377 @if cmp -s $(@F).tmp $@; then \
383 CLEANFILES += manpage-dep-check
386 ALL_LOCAL += ovsext_make
387 ovsext_make: datapath-windows/ovsext.sln
388 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)"
389 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
391 CLEAN_LOCAL += ovsext_clean
392 ovsext_clean: datapath-windows/ovsext.sln
393 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)"
394 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
398 dist-hook: $(DIST_HOOKS)
399 all-local: $(ALL_LOCAL)
400 clean-local: $(CLEAN_LOCAL)
401 install-data-local: $(INSTALL_DATA_LOCAL)
402 uninstall-local: $(UNINSTALL_LOCAL)
403 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
407 cd datapath/linux && $(MAKE) modules_install
411 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
414 include Documentation/automake.mk
415 include m4/automake.mk
416 include lib/automake.mk
417 include ofproto/automake.mk
418 include utilities/automake.mk
419 include tests/automake.mk
420 include include/automake.mk
421 include third-party/automake.mk
422 include debian/automake.mk
423 include vswitchd/automake.mk
424 include ovsdb/automake.mk
425 include rhel/automake.mk
426 include xenserver/automake.mk
427 include python/automake.mk
428 include tutorial/automake.mk
429 include vtep/automake.mk
430 include datapath-windows/automake.mk
431 include datapath-windows/include/automake.mk
432 include windows/automake.mk
433 include ovn/automake.mk