]> git.proxmox.com Git - ovs.git/blame_incremental - Makefile.am
netdev-dpdk: Use ETH_ADDR_BYTES_ARGS instead of open-coding it.
[ovs.git] / Makefile.am
... / ...
CommitLineData
1# Copyright (C) 2007-2017 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
8AUTOMAKE_OPTIONS = foreign subdir-objects
9ACLOCAL_AMFLAGS = -I m4
10SUBDIRS = datapath
11
12AM_CPPFLAGS = $(SSL_CFLAGS)
13AM_LDFLAGS = $(SSL_LDFLAGS)
14AM_LDFLAGS += $(OVS_LDFLAGS)
15
16if WIN32
17AM_CPPFLAGS += -I $(top_srcdir)/include/windows
18AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
19AM_CPPFLAGS += $(PTHREAD_INCLUDES)
20AM_CPPFLAGS += $(MSVC_CFLAGS)
21AM_LDFLAGS += $(PTHREAD_LDFLAGS)
22AM_LDFLAGS += $(MSVC64_LDFLAGS)
23PLATFORM = $(MSVC_PLATFORM)
24endif
25
26AM_CPPFLAGS += -I $(top_srcdir)/include
27AM_CPPFLAGS += -I $(top_builddir)/include
28AM_CPPFLAGS += -I $(top_srcdir)/lib
29AM_CPPFLAGS += -I $(top_builddir)/lib
30
31AM_CPPFLAGS += $(SSL_INCLUDES)
32
33AM_CFLAGS = -Wstrict-prototypes
34AM_CFLAGS += $(WARNING_FLAGS)
35AM_CFLAGS += $(OVS_CFLAGS)
36
37if DPDK_NETDEV
38AM_CFLAGS += -D_FILE_OFFSET_BITS=64
39DPDKSTRIP_FLAGS = --dpdk
40else
41DPDKSTRIP_FLAGS = --nodpdk
42endif
43
44if NDEBUG
45AM_CPPFLAGS += -DNDEBUG
46AM_CFLAGS += -fomit-frame-pointer
47endif
48
49AM_CTAGSFLAGS = $(OVS_CTAGS_IDENTIFIERS_LIST)
50
51if WIN32
52psep=";"
53else
54psep=":"
55endif
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.
61run_python = \
62 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
63 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
64
65ALL_LOCAL =
66BUILT_SOURCES =
67CLEANFILES =
68CLEAN_LOCAL =
69DISTCLEANFILES =
70PYCOV_CLEAN_FILES = build-aux/check-structs,cover
71
72EXTRA_DIST = \
73 AUTHORS.rst \
74 CONTRIBUTING.rst \
75 LICENSE \
76 MAINTAINERS.rst \
77 README.rst \
78 NOTICE \
79 .travis.yml \
80 .travis/linux-build.sh \
81 .travis/linux-prepare.sh \
82 .travis/osx-build.sh \
83 .travis/osx-prepare.sh \
84 appveyor.yml \
85 boot.sh \
86 poc/builders/Vagrantfile \
87 poc/playbook-centos-builder.yml \
88 poc/playbook-fedora-builder.yml \
89 poc/playbook-ubuntu-builder.yml \
90 $(MAN_FRAGMENTS) \
91 $(MAN_ROOTS) \
92 Vagrantfile \
93 Vagrantfile-FreeBSD \
94 .mailmap
95bin_PROGRAMS =
96sbin_PROGRAMS =
97bin_SCRIPTS =
98DIST_HOOKS =
99dist_man_MANS =
100dist_pkgdata_DATA =
101dist_pkgdata_SCRIPTS =
102dist_sbin_SCRIPTS =
103dist_scripts_SCRIPTS =
104dist_scripts_DATA =
105INSTALL_DATA_LOCAL =
106UNINSTALL_LOCAL =
107man_MANS =
108MAN_FRAGMENTS =
109MAN_ROOTS =
110noinst_DATA =
111noinst_HEADERS =
112lib_LTLIBRARIES =
113noinst_LTLIBRARIES =
114noinst_man_MANS =
115noinst_PROGRAMS =
116noinst_SCRIPTS =
117OVSIDL_BUILT =
118pkgdata_DATA =
119sbin_SCRIPTS =
120scripts_SCRIPTS =
121completion_SCRIPTS =
122scripts_DATA =
123SUFFIXES =
124check_DATA =
125check_SCRIPTS =
126pkgconfig_DATA =
127FLAKE8_PYFILES =
128
129if ENABLE_SPARSE_BY_DEFAULT
130C ?= 1
131endif
132
133scriptsdir = $(pkgdatadir)/scripts
134completiondir = $(sysconfdir)/bash_completion.d
135pkgconfigdir = $(libdir)/pkgconfig
136
137# This ensures that files added to EXTRA_DIST are always distributed,
138# even if they are inside an Automake if...endif conditional block that is
139# disabled by some particular "configure" run. For more information, see:
140# http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
141noinst_HEADERS += $(EXTRA_DIST)
142
143ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
144ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
145
146SUFFIXES += .in
147.in:
148 $(AM_V_GEN)PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON) $(srcdir)/build-aux/soexpand.py -I$(srcdir) < $< | \
149 $(PYTHON) $(srcdir)/build-aux/dpdkstrip.py $(DPDKSTRIP_FLAGS) | \
150 sed \
151 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
152 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
153 -e 's,[@]DBDIR[@],$(DBDIR),g' \
154 -e 's,[@]PYTHON[@],$(PYTHON),g' \
155 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
156 -e 's,[@]VERSION[@],$(VERSION),g' \
157 -e 's,[@]localstatedir[@],$(localstatedir),g' \
158 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
159 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
160 -e 's,[@]bindir[@],$(bindir),g' \
161 -e 's,[@]sbindir[@],$(sbindir),g' \
162 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
163 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
164 > $@.tmp
165 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
166 chmod +x $@.tmp; \
167 fi
168 $(AM_V_at) mv $@.tmp $@
169
170SUFFIXES += .xml
171%: %.xml
172 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
173 -I $(srcdir) \
174 --version=$(VERSION) \
175 PKIDIR='$(PKIDIR)' \
176 LOGDIR='$(LOGDIR)' \
177 DBDIR='$(DBDIR)' \
178 PYTHON='$(PYTHON)' \
179 RUNDIR='$(RUNDIR)' \
180 VERSION='$(VERSION)' \
181 localstatedir='$(localstatedir)' \
182 pkgdatadir='$(pkgdatadir)' \
183 sysconfdir='$(sysconfdir)' \
184 bindir='$(bindir)' \
185 sbindir='$(sbindir)'
186 $(AM_v_at)mv $@.tmp $@
187
188clean-pycov:
189 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
190CLEAN_LOCAL += clean-pycov
191.PHONY: clean-pycov
192
193# If we're checked out from a Git repository, make sure that every
194# file that is in Git is distributed.
195ALL_LOCAL += dist-hook-git
196dist-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 grep -v '\.gitattributes$$' | \
203 LC_ALL=C sort -u > all-gitfiles; \
204 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
205 if test -s missing-distfiles; then \
206 echo "The following files are in git but not the distribution:"; \
207 cat missing-distfiles; \
208 exit 1; \
209 fi; \
210 if LC_ALL=C grep '\.gitignore$$' all-distfiles; then \
211 echo "See above for list of files that are distributed but"; \
212 echo "should not be."; \
213 exit 1; \
214 fi \
215 fi
216CLEANFILES += all-distfiles all-gitfiles missing-distfiles
217# The following is based on commands for the Automake "distdir" target.
218distfiles: Makefile
219 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
220 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
221 list='$(DISTFILES)'; \
222 for file in $$list; do echo $$file; done | \
223 sed -e "s|^$$srcdirstrip/||;t" \
224 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
225 LC_ALL=C sort -u > $@
226CLEANFILES += distfiles
227.PHONY: dist-hook-git
228
229# Check that every .c file includes <config.h>.
230ALL_LOCAL += config-h-check
231config-h-check:
232 @cd $(srcdir); \
233 if test -e .git && (git --version) >/dev/null 2>&1 && \
234 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
235 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows|^python'`; \
236 then \
237 echo "See above for list of violations of the rule that"; \
238 echo "every C source file must #include <config.h>."; \
239 exit 1; \
240 fi; \
241 if grep '#include' include/openvswitch/*.h | \
242 grep -vE '(<.*>)|("openvswitch)|("openflow)'; \
243 then \
244 echo "See above for list of violations of the rule that"; \
245 echo "public openvswitch header file should not include internal library."; \
246 exit 1; \
247 fi
248.PHONY: config-h-check
249
250# Check for printf() type modifiers that MSVC doesn't support.
251ALL_LOCAL += printf-check
252printf-check:
253 @cd $(srcdir); \
254 if test -e .git && (git --version) >/dev/null 2>&1 && \
255 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
256 grep -vE '^datapath|^lib/sflow|^third-party'`; \
257 then \
258 echo "See above for list of violations of the rule that"; \
259 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
260 echo "forbidden. See coding-style.rst for replacements."; \
261 exit 1; \
262 fi
263.PHONY: printf-check
264
265# Check that certain data structures are always declared "static".
266ALL_LOCAL += static-check
267static-check:
268 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
269 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
270 then \
271 echo "See above for list of violations of the rule that "; \
272 echo "certain data structures must always be 'static'"; \
273 exit 1; \
274 fi
275.PHONY: static-check
276
277# Check that assert.h is not used outside a whitelist of files.
278ALL_LOCAL += check-assert-h-usage
279check-assert-h-usage:
280 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
281 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
282 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
283 then \
284 echo "Files listed above unexpectedly #include <""assert.h"">."; \
285 echo "Please use ovs_assert (from util.h) instead of assert."; \
286 exit 1; \
287 fi
288.PHONY: check-assert-h-usage
289
290# Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
291# also mentioned. (<endian.h> always defines the former two constants. They
292# must be compared to BYTE_ORDER to get the machine's correct endianness. But
293# it is better to use WORDS_BIGENDIAN.)
294ALL_LOCAL += check-endian
295check-endian:
296 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
297 (cd $(srcdir) && git --no-pager grep -l -E \
298 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
299 $(EGREP) -v '^datapath/'); \
300 then \
301 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
302 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
303 exit 1; \
304 fi
305.PHONY: check-endian
306
307ALL_LOCAL += check-echo-n
308check-echo-n:
309 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
310 git --no-pager grep -n 'echo'' -n' $(srcdir); \
311 then \
312 echo "See above for uses for \"echo"" -n\", which is non-POSIX"; \
313 echo "and does not work with all shells. Use \"printf\" instead."; \
314 exit 1; \
315 fi
316.PHONY: check-echo-n
317
318ALL_LOCAL += check-tabs
319check-tabs:
320 @cd $(srcdir); \
321 if test -e .git && (git --version) >/dev/null 2>&1 && \
322 grep -ln "^ " \
323 `git ls-files \
324 | grep -v -f build-aux/initial-tab-whitelist` /dev/null \
325 | $(EGREP) -v ':[ ]*/?\*'; \
326 then \
327 echo "See above for files that use tabs for indentation."; \
328 echo "Please use spaces instead."; \
329 exit 1; \
330 fi
331.PHONY: check-tabs
332
333ALL_LOCAL += thread-safety-check
334thread-safety-check:
335 @cd $(srcdir); \
336 if test -e .git && (git --version) >/dev/null 2>&1 && \
337 grep -n -f build-aux/thread-safety-blacklist \
338 `git ls-files | grep '\.[ch]$$' \
339 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
340 | $(EGREP) -v ':[ ]*/?\*'; \
341 then \
342 echo "See above for list of calls to functions that are"; \
343 echo "blacklisted due to thread safety issues"; \
344 exit 1; \
345 fi
346EXTRA_DIST += build-aux/thread-safety-blacklist
347.PHONY: thread-safety-check
348
349# Check that "ip" is used in preference to "ifconfig", because
350# "ifconfig" is not installed ubiquitously anymore.
351ALL_LOCAL += check-ifconfig
352check-ifconfig:
353 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
354 (cd $(srcdir) && git --no-pager grep -l -E -e 'ifconfig' | \
355 $(EGREP) -v 'Makefile.am|ovs-vsctl-bashcomp|openvswitch-custom\.te'); \
356 then \
357 echo "See above for list of files that use or reference"; \
358 echo "'ifconfig'. Please use 'ip' instead."; \
359 exit 1; \
360 fi
361.PHONY: check-ifconfig
362
363if HAVE_GROFF
364ALL_LOCAL += manpage-check
365manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
366 @error=false; \
367 for manpage in $?; do \
368 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; \
369 if grep warning: $@.tmp; then error=:; fi; \
370 rm -f $@.tmp; \
371 done; \
372 if $$error; then exit 1; else touch $@; fi
373 $(AM_V_GEN) touch -c $@
374CLEANFILES += manpage-check
375endif
376
377if HAVE_FLAKE8
378ALL_LOCAL += flake8-check
379# http://flake8.readthedocs.org/en/latest/user/error-codes.html
380# All warnings explicitly selected or ignored should be listed below.
381#
382# E***, W*** -- warnings from pep8
383# E121 continuation line under-indented for hanging indent (only from flake8 v2.0)
384# E123 closing bracket does not match indentation of opening bracket's line
385# E125 continuation line with same indent as next logical line (only from flake8 v2.0)
386# E126 continuation line over-indented for hanging indent
387# E127 continuation line over-indented for visual indent
388# E128 continuation line under-indented for visual indent
389# E129 visually indented line with same indent as next logical line
390# E131 continuation line unaligned for hanging indent
391# E722 do not use bare except, specify exception instead
392# W503 line break before binary operator
393# F*** -- warnings native to flake8
394# F811 redefinition of unused <name> from line <N> (only from flake8 v2.0)
395# D*** -- warnings from flake8-docstrings plugin
396# H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
397# H231 Python 3.x incompatible 'except x,y:' construct
398# H232 Python 3.x incompatible octal 077 should be written as 0o77
399# H233 Python 3.x incompatible use of print operator
400# H238 old style class declaration, use new style (inherit from `object`)
401FLAKE8_SELECT = H231,H232,H233,H238
402FLAKE8_IGNORE = E121,E123,E125,E126,E127,E128,E129,E131,E722,W503,F811,D,H,I
403flake8-check: $(FLAKE8_PYFILES)
404 $(FLAKE8_WERROR)$(AM_V_GEN) \
405 src='$^' && \
406 flake8 $$src --select=$(FLAKE8_SELECT) $(FLAKE8_FLAGS) && \
407 flake8 $$src --ignore=$(FLAKE8_IGNORE) $(FLAKE8_FLAGS) && \
408 touch $@
409endif
410CLEANFILES += flake8-check
411
412include $(srcdir)/manpages.mk
413$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py python/build/soutil.py
414 @PYTHONPATH=$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON) $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
415 @if cmp -s $(@F).tmp $@; then \
416 touch $@; \
417 rm -f $(@F).tmp; \
418 else \
419 mv $(@F).tmp $@; \
420 fi
421CLEANFILES += manpage-dep-check
422
423if VSTUDIO_DDK
424ALL_LOCAL += ovsext
425ARCH = x64
426ovsext: datapath-windows/ovsext.sln $(srcdir)/datapath-windows/include/OvsDpInterface.h
427if VSTUDIO_WIN8
428 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
429endif
430if VSTUDIO_WIN8_1
431 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
432endif
433if VSTUDIO_WIN10
434 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win10$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
435endif
436
437
438CLEAN_LOCAL += ovsext_clean
439ovsext_clean: datapath-windows/ovsext.sln
440if VSTUDIO_WIN8
441 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
442endif
443if VSTUDIO_WIN8_1
444 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
445endif
446if VSTUDIO_WIN10
447 MSBuild.exe //nologo //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win10$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)" //p:Platform=$(ARCH)
448endif
449endif
450.PHONY: ovsext
451
452clang-analyze: clean
453 @which clang scan-build >/dev/null 2>&1 || \
454 (echo "Unable to find clang/scan-build, Install clang,clang-analyzer packages"; exit 1)
455 @$(MKDIR_P) "$(srcdir)/tests/clang-analyzer-results"
456 @scan-build -o $(srcdir)/tests/clang-analyzer-results --use-cc=$(CC) $(MAKE)
457.PHONY: clang-analyze
458
459dist-hook: $(DIST_HOOKS)
460all-local: $(ALL_LOCAL)
461clean-local: $(CLEAN_LOCAL)
462install-data-local: $(INSTALL_DATA_LOCAL)
463uninstall-local: $(UNINSTALL_LOCAL)
464.PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
465
466modules_install:
467if LINUX_ENABLED
468 cd datapath/linux && $(MAKE) modules_install
469endif
470
471dist-docs:
472 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
473.PHONY: dist-docs
474
475include Documentation/automake.mk
476include m4/automake.mk
477include lib/automake.mk
478include ofproto/automake.mk
479include utilities/automake.mk
480include tests/automake.mk
481include include/automake.mk
482include third-party/automake.mk
483include debian/automake.mk
484include vswitchd/automake.mk
485include ovsdb/automake.mk
486include rhel/automake.mk
487include xenserver/automake.mk
488include python/automake.mk
489include tutorial/automake.mk
490include vtep/automake.mk
491include datapath-windows/automake.mk
492include datapath-windows/include/automake.mk
493include windows/automake.mk
494include ovn/automake.mk
495include selinux/automake.mk
496include build-aux/automake.mk