]> git.proxmox.com Git - mirror_ovs.git/blame - Makefile.am
ovsdb: Fix dead assignment reported by clang.
[mirror_ovs.git] / Makefile.am
CommitLineData
8a988976 1# Copyright (C) 2007-2016 Nicira, Inc.
a14bc59f
BP
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
064af421
BP
8AUTOMAKE_OPTIONS = foreign subdir-objects
9ACLOCAL_AMFLAGS = -I m4
10SUBDIRS = datapath
11
064af421 12AM_CPPFLAGS = $(SSL_CFLAGS)
cf06c2e9 13AM_LDFLAGS = $(SSL_LDFLAGS)
95626395 14AM_LDFLAGS += $(OVS_LDFLAGS)
e42dfc72
AS
15
16if WIN32
17AM_CPPFLAGS += -I $(top_srcdir)/include/windows
c803536e 18AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
94887cf4 19AM_CPPFLAGS += $(PTHREAD_INCLUDES)
b0e1bce5 20AM_CPPFLAGS += $(MSVC_CFLAGS)
94887cf4 21AM_LDFLAGS += $(PTHREAD_LDFLAGS)
1cb3649c 22AM_LDFLAGS += $(MSVC64_LDFLAGS)
e42dfc72
AS
23endif
24
064af421 25AM_CPPFLAGS += -I $(top_srcdir)/include
837eefc7 26AM_CPPFLAGS += -I $(top_builddir)/include
064af421 27AM_CPPFLAGS += -I $(top_srcdir)/lib
611d30ce 28AM_CPPFLAGS += -I $(top_builddir)/lib
064af421 29
8605a29b
PK
30AM_CPPFLAGS += $(SSL_INCLUDES)
31
064af421 32AM_CFLAGS = -Wstrict-prototypes
d161c099 33AM_CFLAGS += $(WARNING_FLAGS)
95626395 34AM_CFLAGS += $(OVS_CFLAGS)
064af421 35
58397e6c
KT
36if DPDK_NETDEV
37AM_CFLAGS += -D_FILE_OFFSET_BITS=64
38endif
39
064af421
BP
40if NDEBUG
41AM_CPPFLAGS += -DNDEBUG
42AM_CFLAGS += -fomit-frame-pointer
064af421
BP
43endif
44
b02e1154
GS
45if WIN32
46psep=";"
47else
48psep=":"
49endif
853d1083
BP
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.
e23812fc
BP
55run_python = \
56 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
57 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
853d1083 58
22c79496 59ALL_LOCAL =
d879a707 60BUILT_SOURCES =
064af421 61CLEANFILES =
15b619e2 62CLEAN_LOCAL =
064af421 63DISTCLEANFILES =
79982e90 64PYCOV_CLEAN_FILES = build-aux/check-structs,cover
4441a01c
BP
65
66# A list of Markdown-formatted documentation that will automatically be
67# included in the "make dist-docs" output.
68docs = \
542cc9bb
TG
69 CONTRIBUTING.md \
70 CodingStyle.md \
71 DESIGN.md \
72 FAQ.md \
73 INSTALL.md \
74 INSTALL.Debian.md \
75 INSTALL.Docker.md \
76 INSTALL.DPDK.md \
77 INSTALL.Fedora.md \
78 INSTALL.KVM.md \
79 INSTALL.Libvirt.md \
80 INSTALL.NetBSD.md \
81 INSTALL.RHEL.md \
9b897c91 82 INSTALL.SELinux.md \
542cc9bb
TG
83 INSTALL.SSL.md \
84 INSTALL.XenServer.md \
85 INSTALL.userspace.md \
86 INSTALL.Windows.md \
87 IntegrationGuide.md \
13ad56a0 88 MAINTAINERS.md \
542cc9bb
TG
89 OPENFLOW-1.1+.md \
90 PORTING.md \
d25e2f57 91 README.md \
542cc9bb 92 README-lisp.md \
a36de779 93 README-native-tunneling.md \
542cc9bb 94 REPORTING-BUGS.md \
f0664242 95 SECURITY.md \
542cc9bb 96 TODO.md \
4441a01c
BP
97 WHY-OVS.md
98EXTRA_DIST = \
99 $(docs) \
100 NOTICE \
826bc7b6 101 .travis.yml \
40a75bbf
LR
102 .travis/linux-build.sh \
103 .travis/linux-prepare.sh \
104 .travis/osx-build.sh \
105 .travis/osx-prepare.sh \
12c96b8a 106 appveyor.yml \
0027492d 107 boot.sh \
c9b94429 108 build-aux/cccl \
abc67c1e 109 build-aux/cksum-schema-check \
39916858 110 build-aux/calculate-schema-cksum \
4441a01c 111 build-aux/dist-docs \
6ca37677 112 build-aux/sodepends.pl \
94512c4a 113 build-aux/soexpand.pl \
a4e3c495 114 build-aux/xml2nroff \
6ca37677 115 $(MAN_FRAGMENTS) \
1ce96d2a 116 $(MAN_ROOTS) \
b56b2566 117 Vagrantfile
064af421
BP
118bin_PROGRAMS =
119sbin_PROGRAMS =
120bin_SCRIPTS =
87103e1f 121DIST_HOOKS =
064af421 122dist_man_MANS =
3b12adda 123dist_pkgdata_DATA =
064af421
BP
124dist_pkgdata_SCRIPTS =
125dist_sbin_SCRIPTS =
b2df0225 126dist_scripts_SCRIPTS =
429ebf21 127dist_scripts_DATA =
b2df0225 128INSTALL_DATA_LOCAL =
44852fdf 129UNINSTALL_LOCAL =
064af421 130man_MANS =
0027492d 131MAN_FRAGMENTS =
6ca37677 132MAN_ROOTS =
c3bb4bd7 133noinst_DATA =
064af421 134noinst_HEADERS =
38b7a52b 135lib_LTLIBRARIES =
045b2e5c 136noinst_man_MANS =
064af421
BP
137noinst_PROGRAMS =
138noinst_SCRIPTS =
00732bf5 139OVSIDL_BUILT =
9c16ed64 140pkgdata_DATA =
b2df0225 141sbin_SCRIPTS =
43bb5f82 142scripts_SCRIPTS =
2c9907cd 143completion_SCRIPTS =
429ebf21 144scripts_DATA =
c3bb4bd7 145SUFFIXES =
15b619e2 146check_DATA =
08d42548 147check_SCRIPTS =
81696de0 148pkgconfig_DATA =
115d8719 149FLAKE8_PYFILES =
064af421 150
43bb5f82 151scriptsdir = $(pkgdatadir)/scripts
2c9907cd 152completiondir = $(sysconfdir)/bash_completion.d
81696de0 153pkgconfigdir = $(libdir)/pkgconfig
43bb5f82 154
9741af79
BP
155# This ensures that files added to EXTRA_DIST are always distributed,
156# even if they are inside an Automake if...endif conditional block that is
157# disabled by some particular "configure" run. For more information, see:
158# http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
159noinst_HEADERS += $(EXTRA_DIST)
160
064af421 161ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
cbaa4ffe 162ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
064af421 163
c3bb4bd7 164SUFFIXES += .in
064af421 165.in:
ef44aa50 166 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
3b135da3 167 sed \
064af421 168 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
3b135da3 169 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
f973f2af 170 -e 's,[@]DBDIR[@],$(DBDIR),g' \
3b135da3
BP
171 -e 's,[@]PERL[@],$(PERL),g' \
172 -e 's,[@]PYTHON[@],$(PYTHON),g' \
064af421 173 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
3b135da3
BP
174 -e 's,[@]VERSION[@],$(VERSION),g' \
175 -e 's,[@]localstatedir[@],$(localstatedir),g' \
064af421 176 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
3b135da3 177 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
43bb5f82
BP
178 -e 's,[@]bindir[@],$(bindir),g' \
179 -e 's,[@]sbindir[@],$(sbindir),g' \
6901639b 180 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
d879a707 181 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
3b135da3 182 > $@.tmp
00961f7c 183 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
3b135da3
BP
184 chmod +x $@.tmp; \
185 fi
ef44aa50 186 $(AM_V_at) mv $@.tmp $@
064af421 187
99635791
BP
188SUFFIXES += .xml
189%: %.xml
190 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
8a988976 191 -I $(srcdir) \
99635791
BP
192 --version=$(VERSION) \
193 PKIDIR='$(PKIDIR)' \
194 LOGDIR='$(LOGDIR)' \
195 DBDIR='$(DBDIR)' \
196 PERL='$(PERL)' \
197 PYTHON='$(PYTHON)' \
198 RUNDIR='$(RUNDIR)' \
199 VERSION='$(VERSION)' \
200 localstatedir='$(localstatedir)' \
201 pkgdatadir='$(pkgdatadir)' \
202 sysconfdir='$(sysconfdir)' \
203 bindir='$(bindir)' \
204 sbindir='$(sbindir)'
205 $(AM_v_at)mv $@.tmp $@
206
79982e90
EJ
207.PHONY: clean-pycov
208clean-pycov:
209 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
210CLEAN_LOCAL += clean-pycov
211
87103e1f
BP
212# If we're checked out from a Git repository, make sure that every
213# file that is in Git is distributed.
b4e1bf8b
BP
214#
215# We only enable this check when GNU make is in use because the
216# Makefile in datapath/linux, needed to get the list of files to
217# distribute, requires GNU make extensions.
218if GNU_MAKE
39376d06
BP
219ALL_LOCAL += dist-hook-git
220dist-hook-git: distfiles
221 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
222 (cd datapath && $(MAKE) distfiles); \
223 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
a6da6967 224 LC_ALL=C sort -u > all-distfiles; \
39376d06 225 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
a6da6967
BP
226 LC_ALL=C sort -u > all-gitfiles; \
227 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
39376d06 228 if test -s missing-distfiles; then \
4207d631 229 echo "The following files are in git but not the distribution:"; \
39376d06
BP
230 cat missing-distfiles; \
231 exit 1; \
232 fi; \
87103e1f 233 fi
39376d06
BP
234CLEANFILES += all-distfiles all-gitfiles missing-distfiles
235# The following is based on commands for the Automake "distdir" target.
236distfiles: Makefile
237 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
238 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
239 list='$(DISTFILES)'; \
240 for file in $$list; do echo $$file; done | \
241 sed -e "s|^$$srcdirstrip/||;t" \
a6da6967
BP
242 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
243 LC_ALL=C sort -u > $@
39376d06 244CLEANFILES += distfiles
b4e1bf8b
BP
245endif
246.PHONY: dist-hook-git
87103e1f 247
9e4ba008
BP
248# Check that every .c file includes <config.h>.
249ALL_LOCAL += config-h-check
250config-h-check:
251 @cd $(srcdir); \
252 if test -e .git && (git --version) >/dev/null 2>&1 && \
b411e5c3 253 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
c63b04d6 254 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows|^python'`; \
9e4ba008
BP
255 then \
256 echo "See above for list of violations of the rule that"; \
257 echo "every C source file must #include <config.h>."; \
258 exit 1; \
259 fi
260.PHONY: config-h-check
261
34582733
AS
262# Check for printf() type modifiers that MSVC doesn't support.
263ALL_LOCAL += printf-check
264printf-check:
8faeab72
DDP
265 @cd $(srcdir); \
266 if test -e .git && (git --version) >/dev/null 2>&1 && \
267 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
3b3f8857 268 grep -vE '^datapath|^lib/sflow|^third-party'`; \
34582733
AS
269 then \
270 echo "See above for list of violations of the rule that"; \
271 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
542cc9bb 272 echo "forbidden. See CodingStyle.md for replacements."; \
34582733
AS
273 exit 1; \
274 fi
275.PHONY: printf-check
276
1514b275
BP
277# Check that certain data structures are always declared "static".
278ALL_LOCAL += static-check
279static-check:
db5ce514 280 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
1514b275 281 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
db5ce514
BP
282 then \
283 echo "See above for list of violations of the rule that "; \
1514b275 284 echo "certain data structures must always be 'static'"; \
db5ce514
BP
285 exit 1; \
286 fi
1514b275 287.PHONY: static-check
db5ce514 288
4958e3ee
BP
289# Check that assert.h is not used outside a whitelist of files.
290ALL_LOCAL += check-assert-h-usage
291check-assert-h-usage:
292 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
293 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
92fa2e92 294 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
4958e3ee
BP
295 then \
296 echo "Files listed above unexpectedly #include <""assert.h"">."; \
297 echo "Please use ovs_assert (from util.h) instead of assert."; \
298 exit 1; \
299 fi
300.PHONY: check-assert-h-usage
301
64746850
BP
302# Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
303# also mentioned. (<endian.h> always defines the former two constants. They
304# must be compared to BYTE_ORDER to get the machine's correct endianness. But
305# it is better to use WORDS_BIGENDIAN.)
306ALL_LOCAL += check-endian
307check-endian:
308 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
309 (cd $(srcdir) && git --no-pager grep -l -E \
310 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
311 $(EGREP) -v '^datapath/'); \
312 then \
313 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
314 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
315 exit 1; \
316 fi
317.PHONY: check-endian
318
6a3e30f3
BP
319ALL_LOCAL += thread-safety-check
320thread-safety-check:
8faeab72
DDP
321 @cd $(srcdir); \
322 if test -e .git && (git --version) >/dev/null 2>&1 && \
323 grep -n -f build-aux/thread-safety-blacklist \
324 `git ls-files | grep '\.[ch]$$' \
ca3d034b 325 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
6a3e30f3
BP
326 | $(EGREP) -v ':[ ]*/?\*'; \
327 then \
328 echo "See above for list of calls to functions that are"; \
329 echo "blacklisted due to thread safety issues"; \
330 exit 1; \
331 fi
332EXTRA_DIST += build-aux/thread-safety-blacklist
c9172561 333.PHONY: thread-safety-check
6a3e30f3 334
0027492d
BP
335if HAVE_GROFF
336ALL_LOCAL += manpage-check
1261619f
BP
337manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
338 @error=false; \
339 for manpage in $?; do \
186ef5c1 340 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; \
1261619f
BP
341 if grep warning: $@.tmp; then error=:; fi; \
342 rm -f $@.tmp; \
0027492d 343 done; \
be09aa10
EJ
344 if $$error; then exit 1; else touch $@; fi
345 $(AM_V_GEN) touch -c $@
0027492d
BP
346CLEANFILES += manpage-check
347endif
348
115d8719
RB
349if HAVE_FLAKE8
350ALL_LOCAL += flake8-check
007ec24d 351# http://flake8.readthedocs.org/en/latest/warnings.html
f3068bff
RB
352# All warnings explicitly selected or ignored should be listed below.
353#
354# E***, W*** -- warnings from pep8
355# E121 continuation line under-indented for hanging indent (only from flake8 v2.0)
356# E123 closing bracket does not match indentation of opening bracket's line
357# E125 continuation line with same indent as next logical line (only from flake8 v2.0)
358# E126 continuation line over-indented for hanging indent
359# E127 continuation line over-indented for visual indent
360# E128 continuation line under-indented for visual indent
361# E129 visually indented line with same indent as next logical line
362# E131 continuation line unaligned for hanging indent
363# W503 line break before binary operator
364# F*** -- warnings native to flake8
365# F811 redefinition of unused <name> from line <N> (only from flake8 v2.0)
007ec24d
NS
366# D*** -- warnings from flake8-docstrings plugin
367# H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
f3068bff 368# H231 Python 3.x incompatible 'except x,y:' construct
56ec0611 369# H232 Python 3.x incompatible octal 077 should be written as 0o77
8ea171ab 370# H233 Python 3.x incompatible use of print operator
03756304 371# H238 old style class declaration, use new style (inherit from `object`)
115d8719 372flake8-check: $(FLAKE8_PYFILES)
490bafe8
RB
373 $(AM_V_GEN) if flake8 $^ --select=H231,H232,H233,H238 ${FLAKE8_FLAGS} && \
374 flake8 $^ --ignore=E121,E123,E125,E126,E127,E128,E129,E131,W503,F811,D,H ${FLAKE8_FLAGS}; then \
375 touch $@; else exit 1; fi
115d8719 376endif
968eec59 377CLEANFILES += flake8-check
115d8719 378
6ca37677
BP
379include $(srcdir)/manpages.mk
380$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
381 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
382 @if cmp -s $(@F).tmp $@; then \
383 touch $@; \
384 rm -f $(@F).tmp; \
385 else \
386 mv $(@F).tmp $@; \
387 fi
388CLEANFILES += manpage-dep-check
389
bd9d7025 390if VSTUDIO_DDK
e02b8fb0
AS
391ALL_LOCAL += ovsext
392ovsext: datapath-windows/ovsext.sln $(srcdir)/datapath-windows/include/OvsDpInterface.h
393 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)"
394 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
bd9d7025
AS
395
396CLEAN_LOCAL += ovsext_clean
397ovsext_clean: datapath-windows/ovsext.sln
e02b8fb0
AS
398 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)"
399 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
bd9d7025 400endif
e02b8fb0 401.PHONY: ovsext
bd9d7025 402
87103e1f 403dist-hook: $(DIST_HOOKS)
22c79496 404all-local: $(ALL_LOCAL)
15b619e2 405clean-local: $(CLEAN_LOCAL)
b2df0225 406install-data-local: $(INSTALL_DATA_LOCAL)
44852fdf
BP
407uninstall-local: $(UNINSTALL_LOCAL)
408.PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
87103e1f 409
3a14d239
BP
410modules_install:
411if LINUX_ENABLED
412 cd datapath/linux && $(MAKE) modules_install
413endif
414
4441a01c 415dist-docs:
6b304335 416 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
4441a01c
BP
417.PHONY: dist-docs
418
8c254406 419include Documentation/automake.mk
ed1be787 420include m4/automake.mk
064af421 421include lib/automake.mk
8cd4882f 422include ofproto/automake.mk
064af421
BP
423include utilities/automake.mk
424include tests/automake.mk
425include include/automake.mk
426include third-party/automake.mk
427include debian/automake.mk
428include vswitchd/automake.mk
f85f8ebb 429include ovsdb/automake.mk
c434706a 430include rhel/automake.mk
064af421 431include xenserver/automake.mk
0be6140a 432include python/automake.mk
eeecce05 433include tutorial/automake.mk
add17b69 434include vtep/automake.mk
c803536e 435include datapath-windows/automake.mk
c640e3ce 436include datapath-windows/include/automake.mk
d183efc2 437include windows/automake.mk
fe36184b 438include ovn/automake.mk
9b897c91 439include selinux/automake.mk