openvswitch: Userspace tunneling.
[cascardo/ovs.git] / Makefile.am
1 # Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 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 endif
23
24 AM_CPPFLAGS += -I $(top_srcdir)/include
25 AM_CPPFLAGS += -I $(top_builddir)/include
26 AM_CPPFLAGS += -I $(top_srcdir)/lib
27 AM_CPPFLAGS += -I $(top_builddir)/lib
28
29 AM_CPPFLAGS += $(SSL_INCLUDES)
30
31 AM_CFLAGS = -Wstrict-prototypes
32 AM_CFLAGS += $(WARNING_FLAGS)
33 AM_CFLAGS += $(OVS_CFLAGS)
34
35 if NDEBUG
36 AM_CPPFLAGS += -DNDEBUG
37 AM_CFLAGS += -fomit-frame-pointer
38 endif
39
40 if WIN32
41 psep=";"
42 else
43 psep=":"
44 endif
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.
50 if INCLUDE_PYTHON_COMPAT
51 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
52 else
53 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
54 endif
55 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
56
57
58 ALL_LOCAL =
59 BUILT_SOURCES =
60 CLEANFILES =
61 CLEAN_LOCAL =
62 DISTCLEANFILES =
63 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
64 EXTRA_DIST = \
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 \
83         NOTICE \
84         OPENFLOW-1.1+.md \
85         PORTING.md \
86         README.md \
87         README-lisp.md \
88         README-native-tunneling.md \
89         REPORTING-BUGS.md \
90         TODO.md \
91         .travis.yml \
92         .travis/build.sh \
93         .travis/prepare.sh \
94         WHY-OVS.md \
95         boot.sh \
96         build-aux/cccl \
97         build-aux/sodepends.pl \
98         build-aux/soexpand.pl \
99         $(MAN_FRAGMENTS) \
100         $(MAN_ROOTS)
101 bin_PROGRAMS =
102 sbin_PROGRAMS =
103 bin_SCRIPTS =
104 DIST_HOOKS =
105 dist_man_MANS =
106 dist_pkgdata_DATA =
107 dist_pkgdata_SCRIPTS =
108 dist_sbin_SCRIPTS =
109 dist_scripts_SCRIPTS =
110 dist_scripts_DATA =
111 INSTALL_DATA_LOCAL =
112 UNINSTALL_LOCAL =
113 man_MANS =
114 MAN_FRAGMENTS =
115 MAN_ROOTS =
116 noinst_DATA =
117 noinst_HEADERS =
118 lib_LTLIBRARIES =
119 noinst_man_MANS =
120 noinst_PROGRAMS =
121 noinst_SCRIPTS =
122 OVSIDL_BUILT =
123 pkgdata_DATA =
124 sbin_SCRIPTS =
125 scripts_SCRIPTS =
126 scripts_DATA =
127 SUFFIXES =
128 check_DATA =
129
130 scriptsdir = $(pkgdatadir)/scripts
131
132 # This ensures that files added to EXTRA_DIST are always distributed,
133 # even if they are inside an Automake if...endif conditional block that is
134 # disabled by some particular "configure" run.  For more information, see:
135 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
136 noinst_HEADERS += $(EXTRA_DIST)
137
138 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
139 ro_shell = printf '\043 Generated automatically -- do not modify!    -*- buffer-read-only: t -*-\n'
140
141 SUFFIXES += .in
142 .in:
143         $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
144             sed \
145                 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
146                 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
147                 -e 's,[@]DBDIR[@],$(DBDIR),g' \
148                 -e 's,[@]PERL[@],$(PERL),g' \
149                 -e 's,[@]PYTHON[@],$(PYTHON),g' \
150                 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
151                 -e 's,[@]VERSION[@],$(VERSION),g' \
152                 -e 's,[@]localstatedir[@],$(localstatedir),g' \
153                 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
154                 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
155                 -e 's,[@]bindir[@],$(bindir),g' \
156                 -e 's,[@]sbindir[@],$(sbindir),g' \
157                 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
158             > $@.tmp
159         @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
160             chmod +x $@.tmp; \
161         fi
162         $(AM_V_at) mv $@.tmp $@
163
164 .PHONY: clean-pycov
165 clean-pycov:
166         cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
167 CLEAN_LOCAL += clean-pycov
168
169 # If we're checked out from a Git repository, make sure that every
170 # file that is in Git is distributed.
171 #
172 # We only enable this check when GNU make is in use because the
173 # Makefile in datapath/linux, needed to get the list of files to
174 # distribute, requires GNU make extensions.
175 if GNU_MAKE
176 ALL_LOCAL += dist-hook-git
177 dist-hook-git: distfiles
178         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
179           (cd datapath && $(MAKE) distfiles);                               \
180           (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) |        \
181             LC_ALL=C sort -u > all-distfiles;                               \
182           (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' |        \
183             LC_ALL=C sort -u > all-gitfiles;                                \
184           LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
185           if test -s missing-distfiles; then                                \
186             echo "The distribution is missing the following files:";        \
187             cat missing-distfiles;                                          \
188             exit 1;                                                         \
189           fi;                                                               \
190         fi
191 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
192 # The following is based on commands for the Automake "distdir" target.
193 distfiles: Makefile
194         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
195         topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
196         list='$(DISTFILES)'; \
197         for file in $$list; do echo $$file; done | \
198           sed -e "s|^$$srcdirstrip/||;t" \
199               -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
200           LC_ALL=C sort -u > $@
201 CLEANFILES += distfiles
202 endif
203 .PHONY: dist-hook-git
204
205 # Check that every .c file includes <config.h>.
206 ALL_LOCAL += config-h-check
207 config-h-check:
208         @cd $(srcdir); \
209         if test -e .git && (git --version) >/dev/null 2>&1 && \
210            git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
211                grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
212         then \
213             echo "See above for list of violations of the rule that"; \
214             echo "every C source file must #include <config.h>."; \
215             exit 1; \
216         fi
217 .PHONY: config-h-check
218
219 # Check for printf() type modifiers that MSVC doesn't support.
220 ALL_LOCAL += printf-check
221 printf-check:
222         @cd $(srcdir); \
223         if test -e .git && (git --version) >/dev/null 2>&1 && \
224            git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
225                grep -vE '^datapath|^lib/sflow|^third-party'`; \
226         then \
227             echo "See above for list of violations of the rule that"; \
228             echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
229             echo "forbidden.  See CodingStyle.md for replacements."; \
230             exit 1; \
231         fi
232 .PHONY: printf-check
233
234 # Check that certain data structures are always declared "static".
235 ALL_LOCAL += static-check
236 static-check:
237         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
238             git --no-pager grep -n -E '^[       ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
239          then \
240             echo "See above for list of violations of the rule that "; \
241             echo "certain data structures must always be 'static'"; \
242             exit 1; \
243          fi
244 .PHONY: static-check
245
246 # Check that assert.h is not used outside a whitelist of files.
247 ALL_LOCAL += check-assert-h-usage
248 check-assert-h-usage:
249         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
250             (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
251             $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
252          then \
253             echo "Files listed above unexpectedly #include <""assert.h"">."; \
254             echo "Please use ovs_assert (from util.h) instead of assert."; \
255             exit 1; \
256          fi
257 .PHONY: check-assert-h-usage
258
259 ALL_LOCAL += thread-safety-check
260 thread-safety-check:
261         @cd $(srcdir); \
262         if test -e .git && (git --version) >/dev/null 2>&1 && \
263            grep -n -f build-aux/thread-safety-blacklist \
264                `git ls-files | grep '\.[ch]$$' \
265                 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
266                | $(EGREP) -v ':[        ]*/?\*'; \
267         then \
268             echo "See above for list of calls to functions that are"; \
269             echo "blacklisted due to thread safety issues"; \
270             exit 1; \
271         fi
272 EXTRA_DIST += build-aux/thread-safety-blacklist
273
274 if HAVE_GROFF
275 ALL_LOCAL += manpage-check
276 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
277         @error=false; \
278         for manpage in $?; do \
279                 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; \
280                 if grep warning: $@.tmp; then error=:; fi; \
281                 rm -f $@.tmp; \
282         done; \
283         if $$error; then exit 1; else touch $@; fi
284         $(AM_V_GEN) touch -c $@
285 CLEANFILES += manpage-check
286 endif
287
288 include $(srcdir)/manpages.mk
289 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
290         @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
291         @if cmp -s $(@F).tmp $@; then \
292                 touch $@; \
293                 rm -f $(@F).tmp; \
294         else \
295                 mv $(@F).tmp $@; \
296         fi
297 CLEANFILES += manpage-dep-check
298
299 if VSTUDIO_DDK
300 ALL_LOCAL += ovsext_make
301 ovsext_make: datapath-windows/ovsext.sln
302         MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="$(VSTUDIO_CONFIG)"
303
304 CLEAN_LOCAL += ovsext_clean
305 ovsext_clean: datapath-windows/ovsext.sln
306         MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="$(VSTUDIO_CONFIG)"
307 endif
308
309 dist-hook: $(DIST_HOOKS)
310 all-local: $(ALL_LOCAL)
311 clean-local: $(CLEAN_LOCAL)
312 install-data-local: $(INSTALL_DATA_LOCAL)
313 uninstall-local: $(UNINSTALL_LOCAL)
314 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
315
316 modules_install:
317 if LINUX_ENABLED
318         cd datapath/linux && $(MAKE) modules_install
319 endif
320
321 include m4/automake.mk
322 include lib/automake.mk
323 include ofproto/automake.mk
324 include utilities/automake.mk
325 include tests/automake.mk
326 include include/automake.mk
327 include third-party/automake.mk
328 include debian/automake.mk
329 include vswitchd/automake.mk
330 include ovsdb/automake.mk
331 include rhel/automake.mk
332 include xenserver/automake.mk
333 include python/automake.mk
334 include python/compat/automake.mk
335 include tutorial/automake.mk
336 include vtep/automake.mk
337 include datapath-windows/automake.mk
338 include datapath-windows/include/automake.mk