]> git.proxmox.com Git - mirror_ovs.git/blame - Makefile.am
datapath-windows: Fix broken build on MSVC.
[mirror_ovs.git] / Makefile.am
CommitLineData
7868fbc6 1# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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)
e42dfc72
AS
22endif
23
064af421 24AM_CPPFLAGS += -I $(top_srcdir)/include
837eefc7 25AM_CPPFLAGS += -I $(top_builddir)/include
064af421 26AM_CPPFLAGS += -I $(top_srcdir)/lib
611d30ce 27AM_CPPFLAGS += -I $(top_builddir)/lib
064af421 28
8605a29b
PK
29AM_CPPFLAGS += $(SSL_INCLUDES)
30
064af421 31AM_CFLAGS = -Wstrict-prototypes
d161c099 32AM_CFLAGS += $(WARNING_FLAGS)
95626395 33AM_CFLAGS += $(OVS_CFLAGS)
064af421
BP
34
35if NDEBUG
36AM_CPPFLAGS += -DNDEBUG
37AM_CFLAGS += -fomit-frame-pointer
064af421
BP
38endif
39
b02e1154
GS
40if WIN32
41psep=";"
42else
43psep=":"
44endif
853d1083
BP
45# PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
46# files. Creating .py[co] works OK for any given version of Open
47# vSwitch, but it causes trouble if you switch from a version with
48# foo/__init__.py into an (older) version with plain foo.py, since
49# foo/__init__.pyc will cause Python to ignore foo.py.
9b4a5392 50if INCLUDE_PYTHON_COMPAT
b02e1154 51run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
9b4a5392 52else
b02e1154 53run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
9b4a5392
AA
54endif
55run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
56
853d1083 57
22c79496 58ALL_LOCAL =
d879a707 59BUILT_SOURCES =
064af421 60CLEANFILES =
15b619e2 61CLEAN_LOCAL =
064af421 62DISTCLEANFILES =
79982e90 63PYCOV_CLEAN_FILES = build-aux/check-structs,cover
4cdb08c0 64EXTRA_DIST = \
542cc9bb
TG
65 CONTRIBUTING.md \
66 CodingStyle.md \
67 DESIGN.md \
68 FAQ.md \
69 INSTALL.md \
70 INSTALL.Debian.md \
71 INSTALL.Docker.md \
72 INSTALL.DPDK.md \
73 INSTALL.Fedora.md \
74 INSTALL.KVM.md \
75 INSTALL.Libvirt.md \
76 INSTALL.NetBSD.md \
77 INSTALL.RHEL.md \
78 INSTALL.SSL.md \
79 INSTALL.XenServer.md \
80 INSTALL.userspace.md \
81 INSTALL.Windows.md \
82 IntegrationGuide.md \
4cdb08c0 83 NOTICE \
542cc9bb
TG
84 OPENFLOW-1.1+.md \
85 PORTING.md \
d25e2f57 86 README.md \
542cc9bb 87 README-lisp.md \
a36de779 88 README-native-tunneling.md \
542cc9bb
TG
89 REPORTING-BUGS.md \
90 TODO.md \
826bc7b6
TG
91 .travis.yml \
92 .travis/build.sh \
93 .travis/prepare.sh \
542cc9bb 94 WHY-OVS.md \
0027492d 95 boot.sh \
c9b94429 96 build-aux/cccl \
6ca37677 97 build-aux/sodepends.pl \
94512c4a 98 build-aux/soexpand.pl \
6ca37677
BP
99 $(MAN_FRAGMENTS) \
100 $(MAN_ROOTS)
064af421
BP
101bin_PROGRAMS =
102sbin_PROGRAMS =
103bin_SCRIPTS =
87103e1f 104DIST_HOOKS =
064af421 105dist_man_MANS =
3b12adda 106dist_pkgdata_DATA =
064af421
BP
107dist_pkgdata_SCRIPTS =
108dist_sbin_SCRIPTS =
b2df0225 109dist_scripts_SCRIPTS =
429ebf21 110dist_scripts_DATA =
b2df0225 111INSTALL_DATA_LOCAL =
44852fdf 112UNINSTALL_LOCAL =
064af421 113man_MANS =
0027492d 114MAN_FRAGMENTS =
6ca37677 115MAN_ROOTS =
c3bb4bd7 116noinst_DATA =
064af421 117noinst_HEADERS =
38b7a52b 118lib_LTLIBRARIES =
045b2e5c 119noinst_man_MANS =
064af421
BP
120noinst_PROGRAMS =
121noinst_SCRIPTS =
00732bf5 122OVSIDL_BUILT =
9c16ed64 123pkgdata_DATA =
b2df0225 124sbin_SCRIPTS =
43bb5f82 125scripts_SCRIPTS =
429ebf21 126scripts_DATA =
c3bb4bd7 127SUFFIXES =
15b619e2 128check_DATA =
81696de0 129pkgconfig_DATA =
064af421 130
43bb5f82 131scriptsdir = $(pkgdatadir)/scripts
81696de0 132pkgconfigdir = $(libdir)/pkgconfig
43bb5f82 133
9741af79
BP
134# This ensures that files added to EXTRA_DIST are always distributed,
135# even if they are inside an Automake if...endif conditional block that is
136# disabled by some particular "configure" run. For more information, see:
137# http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
138noinst_HEADERS += $(EXTRA_DIST)
139
064af421 140ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
cbaa4ffe 141ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
064af421 142
c3bb4bd7 143SUFFIXES += .in
064af421 144.in:
ef44aa50 145 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
3b135da3 146 sed \
064af421 147 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
3b135da3 148 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
f973f2af 149 -e 's,[@]DBDIR[@],$(DBDIR),g' \
3b135da3
BP
150 -e 's,[@]PERL[@],$(PERL),g' \
151 -e 's,[@]PYTHON[@],$(PYTHON),g' \
064af421 152 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
3b135da3
BP
153 -e 's,[@]VERSION[@],$(VERSION),g' \
154 -e 's,[@]localstatedir[@],$(localstatedir),g' \
064af421 155 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
3b135da3 156 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
43bb5f82
BP
157 -e 's,[@]bindir[@],$(bindir),g' \
158 -e 's,[@]sbindir[@],$(sbindir),g' \
d879a707 159 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
3b135da3 160 > $@.tmp
00961f7c 161 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
3b135da3
BP
162 chmod +x $@.tmp; \
163 fi
ef44aa50 164 $(AM_V_at) mv $@.tmp $@
064af421 165
79982e90
EJ
166.PHONY: clean-pycov
167clean-pycov:
168 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
169CLEAN_LOCAL += clean-pycov
170
87103e1f
BP
171# If we're checked out from a Git repository, make sure that every
172# file that is in Git is distributed.
b4e1bf8b
BP
173#
174# We only enable this check when GNU make is in use because the
175# Makefile in datapath/linux, needed to get the list of files to
176# distribute, requires GNU make extensions.
177if GNU_MAKE
39376d06
BP
178ALL_LOCAL += dist-hook-git
179dist-hook-git: distfiles
180 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
181 (cd datapath && $(MAKE) distfiles); \
182 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
a6da6967 183 LC_ALL=C sort -u > all-distfiles; \
39376d06 184 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
a6da6967
BP
185 LC_ALL=C sort -u > all-gitfiles; \
186 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
39376d06
BP
187 if test -s missing-distfiles; then \
188 echo "The distribution is missing the following files:"; \
189 cat missing-distfiles; \
190 exit 1; \
191 fi; \
87103e1f 192 fi
39376d06
BP
193CLEANFILES += all-distfiles all-gitfiles missing-distfiles
194# The following is based on commands for the Automake "distdir" target.
195distfiles: Makefile
196 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
197 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
198 list='$(DISTFILES)'; \
199 for file in $$list; do echo $$file; done | \
200 sed -e "s|^$$srcdirstrip/||;t" \
a6da6967
BP
201 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
202 LC_ALL=C sort -u > $@
39376d06 203CLEANFILES += distfiles
b4e1bf8b
BP
204endif
205.PHONY: dist-hook-git
87103e1f 206
9e4ba008
BP
207# Check that every .c file includes <config.h>.
208ALL_LOCAL += config-h-check
209config-h-check:
210 @cd $(srcdir); \
211 if test -e .git && (git --version) >/dev/null 2>&1 && \
b411e5c3 212 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
c803536e 213 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
9e4ba008
BP
214 then \
215 echo "See above for list of violations of the rule that"; \
216 echo "every C source file must #include <config.h>."; \
217 exit 1; \
218 fi
219.PHONY: config-h-check
220
34582733
AS
221# Check for printf() type modifiers that MSVC doesn't support.
222ALL_LOCAL += printf-check
223printf-check:
8faeab72
DDP
224 @cd $(srcdir); \
225 if test -e .git && (git --version) >/dev/null 2>&1 && \
226 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
3b3f8857 227 grep -vE '^datapath|^lib/sflow|^third-party'`; \
34582733
AS
228 then \
229 echo "See above for list of violations of the rule that"; \
230 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
542cc9bb 231 echo "forbidden. See CodingStyle.md for replacements."; \
34582733
AS
232 exit 1; \
233 fi
234.PHONY: printf-check
235
1514b275
BP
236# Check that certain data structures are always declared "static".
237ALL_LOCAL += static-check
238static-check:
db5ce514 239 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
1514b275 240 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
db5ce514
BP
241 then \
242 echo "See above for list of violations of the rule that "; \
1514b275 243 echo "certain data structures must always be 'static'"; \
db5ce514
BP
244 exit 1; \
245 fi
1514b275 246.PHONY: static-check
db5ce514 247
4958e3ee
BP
248# Check that assert.h is not used outside a whitelist of files.
249ALL_LOCAL += check-assert-h-usage
250check-assert-h-usage:
251 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
252 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
92fa2e92 253 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
4958e3ee
BP
254 then \
255 echo "Files listed above unexpectedly #include <""assert.h"">."; \
256 echo "Please use ovs_assert (from util.h) instead of assert."; \
257 exit 1; \
258 fi
259.PHONY: check-assert-h-usage
260
6a3e30f3
BP
261ALL_LOCAL += thread-safety-check
262thread-safety-check:
8faeab72
DDP
263 @cd $(srcdir); \
264 if test -e .git && (git --version) >/dev/null 2>&1 && \
265 grep -n -f build-aux/thread-safety-blacklist \
266 `git ls-files | grep '\.[ch]$$' \
ca3d034b 267 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
6a3e30f3
BP
268 | $(EGREP) -v ':[ ]*/?\*'; \
269 then \
270 echo "See above for list of calls to functions that are"; \
271 echo "blacklisted due to thread safety issues"; \
272 exit 1; \
273 fi
274EXTRA_DIST += build-aux/thread-safety-blacklist
275
0027492d
BP
276if HAVE_GROFF
277ALL_LOCAL += manpage-check
1261619f
BP
278manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
279 @error=false; \
280 for manpage in $?; do \
186ef5c1 281 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
282 if grep warning: $@.tmp; then error=:; fi; \
283 rm -f $@.tmp; \
0027492d 284 done; \
be09aa10
EJ
285 if $$error; then exit 1; else touch $@; fi
286 $(AM_V_GEN) touch -c $@
0027492d
BP
287CLEANFILES += manpage-check
288endif
289
6ca37677
BP
290include $(srcdir)/manpages.mk
291$(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
292 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
293 @if cmp -s $(@F).tmp $@; then \
294 touch $@; \
295 rm -f $(@F).tmp; \
296 else \
297 mv $(@F).tmp $@; \
298 fi
299CLEANFILES += manpage-dep-check
300
bd9d7025
AS
301if VSTUDIO_DDK
302ALL_LOCAL += ovsext_make
303ovsext_make: datapath-windows/ovsext.sln
304 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="$(VSTUDIO_CONFIG)"
305
306CLEAN_LOCAL += ovsext_clean
307ovsext_clean: datapath-windows/ovsext.sln
308 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="$(VSTUDIO_CONFIG)"
309endif
310
87103e1f 311dist-hook: $(DIST_HOOKS)
22c79496 312all-local: $(ALL_LOCAL)
15b619e2 313clean-local: $(CLEAN_LOCAL)
b2df0225 314install-data-local: $(INSTALL_DATA_LOCAL)
44852fdf
BP
315uninstall-local: $(UNINSTALL_LOCAL)
316.PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
87103e1f 317
3a14d239
BP
318modules_install:
319if LINUX_ENABLED
320 cd datapath/linux && $(MAKE) modules_install
321endif
322
ed1be787 323include m4/automake.mk
064af421 324include lib/automake.mk
8cd4882f 325include ofproto/automake.mk
064af421
BP
326include utilities/automake.mk
327include tests/automake.mk
328include include/automake.mk
329include third-party/automake.mk
330include debian/automake.mk
331include vswitchd/automake.mk
f85f8ebb 332include ovsdb/automake.mk
c434706a 333include rhel/automake.mk
064af421 334include xenserver/automake.mk
0be6140a 335include python/automake.mk
6c88547d 336include python/compat/automake.mk
eeecce05 337include tutorial/automake.mk
add17b69 338include vtep/automake.mk
c803536e 339include datapath-windows/automake.mk
c640e3ce 340include datapath-windows/include/automake.mk