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