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