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