]> git.proxmox.com Git - ovs.git/blob - Makefile.am
FAQ: Add entry for OVS/DPDK version dependencies.
[ovs.git] / Makefile.am
1 # Copyright (C) 2007-2016 Nicira, Inc.
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
8 AUTOMAKE_OPTIONS = foreign subdir-objects
9 ACLOCAL_AMFLAGS = -I m4
10 SUBDIRS = datapath
11
12 AM_CPPFLAGS = $(SSL_CFLAGS)
13 AM_LDFLAGS = $(SSL_LDFLAGS)
14 AM_LDFLAGS += $(OVS_LDFLAGS)
15
16 if WIN32
17 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
18 AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
19 AM_CPPFLAGS += $(PTHREAD_INCLUDES)
20 AM_CPPFLAGS += $(MSVC_CFLAGS)
21 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
22 AM_LDFLAGS += $(MSVC64_LDFLAGS)
23 endif
24
25 AM_CPPFLAGS += -I $(top_srcdir)/include
26 AM_CPPFLAGS += -I $(top_builddir)/include
27 AM_CPPFLAGS += -I $(top_srcdir)/lib
28 AM_CPPFLAGS += -I $(top_builddir)/lib
29
30 AM_CPPFLAGS += $(SSL_INCLUDES)
31
32 AM_CFLAGS = -Wstrict-prototypes
33 AM_CFLAGS += $(WARNING_FLAGS)
34 AM_CFLAGS += $(OVS_CFLAGS)
35
36 if DPDK_NETDEV
37 AM_CFLAGS += -D_FILE_OFFSET_BITS=64
38 endif
39
40 if NDEBUG
41 AM_CPPFLAGS += -DNDEBUG
42 AM_CFLAGS += -fomit-frame-pointer
43 endif
44
45 if WIN32
46 psep=";"
47 else
48 psep=":"
49 endif
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.
55 run_python = \
56 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
57 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
58
59 ALL_LOCAL =
60 BUILT_SOURCES =
61 CLEANFILES =
62 CLEAN_LOCAL =
63 DISTCLEANFILES =
64 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
65
66 # A list of Markdown-formatted documentation that will automatically be
67 # included in the "make dist-docs" output.
68 docs = \
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.SELinux.md \
83 INSTALL.SSL.md \
84 INSTALL.XenServer.md \
85 INSTALL.userspace.md \
86 INSTALL.Windows.md \
87 IntegrationGuide.md \
88 MAINTAINERS.md \
89 OPENFLOW-1.1+.md \
90 PORTING.md \
91 README.md \
92 README-lisp.md \
93 README-native-tunneling.md \
94 REPORTING-BUGS.md \
95 SECURITY.md \
96 TODO.md \
97 WHY-OVS.md
98 EXTRA_DIST = \
99 $(docs) \
100 NOTICE \
101 .travis.yml \
102 .travis/linux-build.sh \
103 .travis/linux-prepare.sh \
104 .travis/osx-build.sh \
105 .travis/osx-prepare.sh \
106 appveyor.yml \
107 boot.sh \
108 build-aux/cccl \
109 build-aux/cksum-schema-check \
110 build-aux/dist-docs \
111 build-aux/sodepends.pl \
112 build-aux/soexpand.pl \
113 build-aux/xml2nroff \
114 $(MAN_FRAGMENTS) \
115 $(MAN_ROOTS) \
116 Vagrantfile
117 bin_PROGRAMS =
118 sbin_PROGRAMS =
119 bin_SCRIPTS =
120 DIST_HOOKS =
121 dist_man_MANS =
122 dist_pkgdata_DATA =
123 dist_pkgdata_SCRIPTS =
124 dist_sbin_SCRIPTS =
125 dist_scripts_SCRIPTS =
126 dist_scripts_DATA =
127 INSTALL_DATA_LOCAL =
128 UNINSTALL_LOCAL =
129 man_MANS =
130 MAN_FRAGMENTS =
131 MAN_ROOTS =
132 noinst_DATA =
133 noinst_HEADERS =
134 lib_LTLIBRARIES =
135 noinst_man_MANS =
136 noinst_PROGRAMS =
137 noinst_SCRIPTS =
138 OVSIDL_BUILT =
139 pkgdata_DATA =
140 sbin_SCRIPTS =
141 scripts_SCRIPTS =
142 completion_SCRIPTS =
143 scripts_DATA =
144 SUFFIXES =
145 check_DATA =
146 check_SCRIPTS =
147 pkgconfig_DATA =
148 FLAKE8_PYFILES =
149
150 scriptsdir = $(pkgdatadir)/scripts
151 completiondir = $(sysconfdir)/bash_completion.d
152 pkgconfigdir = $(libdir)/pkgconfig
153
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
158 noinst_HEADERS += $(EXTRA_DIST)
159
160 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
161 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
162
163 SUFFIXES += .in
164 .in:
165 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
166 sed \
167 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
168 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
169 -e 's,[@]DBDIR[@],$(DBDIR),g' \
170 -e 's,[@]PERL[@],$(PERL),g' \
171 -e 's,[@]PYTHON[@],$(PYTHON),g' \
172 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
173 -e 's,[@]VERSION[@],$(VERSION),g' \
174 -e 's,[@]localstatedir[@],$(localstatedir),g' \
175 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
176 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
177 -e 's,[@]bindir[@],$(bindir),g' \
178 -e 's,[@]sbindir[@],$(sbindir),g' \
179 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
180 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
181 > $@.tmp
182 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
183 chmod +x $@.tmp; \
184 fi
185 $(AM_V_at) mv $@.tmp $@
186
187 SUFFIXES += .xml
188 %: %.xml
189 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
190 -I $(srcdir) \
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
206 .PHONY: clean-pycov
207 clean-pycov:
208 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
209 CLEAN_LOCAL += clean-pycov
210
211 # If we're checked out from a Git repository, make sure that every
212 # file that is in Git is distributed.
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.
217 if GNU_MAKE
218 ALL_LOCAL += dist-hook-git
219 dist-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) | \
223 LC_ALL=C sort -u > all-distfiles; \
224 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
225 LC_ALL=C sort -u > all-gitfiles; \
226 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
227 if test -s missing-distfiles; then \
228 echo "The following files are in git but not the distribution:"; \
229 cat missing-distfiles; \
230 exit 1; \
231 fi; \
232 fi
233 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
234 # The following is based on commands for the Automake "distdir" target.
235 distfiles: 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" \
241 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
242 LC_ALL=C sort -u > $@
243 CLEANFILES += distfiles
244 endif
245 .PHONY: dist-hook-git
246
247 # Check that every .c file includes <config.h>.
248 ALL_LOCAL += config-h-check
249 config-h-check:
250 @cd $(srcdir); \
251 if test -e .git && (git --version) >/dev/null 2>&1 && \
252 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
253 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
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
261 # Check for printf() type modifiers that MSVC doesn't support.
262 ALL_LOCAL += printf-check
263 printf-check:
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]$$' | \
267 grep -vE '^datapath|^lib/sflow|^third-party'`; \
268 then \
269 echo "See above for list of violations of the rule that"; \
270 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
271 echo "forbidden. See CodingStyle.md for replacements."; \
272 exit 1; \
273 fi
274 .PHONY: printf-check
275
276 # Check that certain data structures are always declared "static".
277 ALL_LOCAL += static-check
278 static-check:
279 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
280 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
281 then \
282 echo "See above for list of violations of the rule that "; \
283 echo "certain data structures must always be 'static'"; \
284 exit 1; \
285 fi
286 .PHONY: static-check
287
288 # Check that assert.h is not used outside a whitelist of files.
289 ALL_LOCAL += check-assert-h-usage
290 check-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[>]') | \
293 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
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
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.)
305 ALL_LOCAL += check-endian
306 check-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
318 ALL_LOCAL += thread-safety-check
319 thread-safety-check:
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]$$' \
324 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
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
331 EXTRA_DIST += build-aux/thread-safety-blacklist
332 .PHONY: thread-safety-check
333
334 if HAVE_GROFF
335 ALL_LOCAL += manpage-check
336 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
337 @error=false; \
338 for manpage in $?; do \
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; \
340 if grep warning: $@.tmp; then error=:; fi; \
341 rm -f $@.tmp; \
342 done; \
343 if $$error; then exit 1; else touch $@; fi
344 $(AM_V_GEN) touch -c $@
345 CLEANFILES += manpage-check
346 endif
347
348 if HAVE_FLAKE8
349 ALL_LOCAL += flake8-check
350 # http://flake8.readthedocs.org/en/latest/warnings.html
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)
365 # D*** -- warnings from flake8-docstrings plugin
366 # H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
367 # H231 Python 3.x incompatible 'except x,y:' construct
368 # H232 Python 3.x incompatible octal 077 should be written as 0o77
369 # H233 Python 3.x incompatible use of print operator
370 # H238 old style class declaration, use new style (inherit from `object`)
371 flake8-check: $(FLAKE8_PYFILES)
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
375 endif
376 CLEANFILES += flake8-check
377
378 include $(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
387 CLEANFILES += manpage-dep-check
388
389 if VSTUDIO_DDK
390 ALL_LOCAL += ovsext
391 ovsext: 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)"
394
395 CLEAN_LOCAL += ovsext_clean
396 ovsext_clean: datapath-windows/ovsext.sln
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)"
399 endif
400 .PHONY: ovsext
401
402 dist-hook: $(DIST_HOOKS)
403 all-local: $(ALL_LOCAL)
404 clean-local: $(CLEAN_LOCAL)
405 install-data-local: $(INSTALL_DATA_LOCAL)
406 uninstall-local: $(UNINSTALL_LOCAL)
407 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
408
409 modules_install:
410 if LINUX_ENABLED
411 cd datapath/linux && $(MAKE) modules_install
412 endif
413
414 dist-docs:
415 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
416 .PHONY: dist-docs
417
418 include Documentation/automake.mk
419 include m4/automake.mk
420 include lib/automake.mk
421 include ofproto/automake.mk
422 include utilities/automake.mk
423 include tests/automake.mk
424 include include/automake.mk
425 include third-party/automake.mk
426 include debian/automake.mk
427 include vswitchd/automake.mk
428 include ovsdb/automake.mk
429 include rhel/automake.mk
430 include xenserver/automake.mk
431 include python/automake.mk
432 include tutorial/automake.mk
433 include vtep/automake.mk
434 include datapath-windows/automake.mk
435 include datapath-windows/include/automake.mk
436 include windows/automake.mk
437 include ovn/automake.mk
438 include selinux/automake.mk