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