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