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