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