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