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