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