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