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