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