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