1 # Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
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.
8 AUTOMAKE_OPTIONS = foreign subdir-objects
9 ACLOCAL_AMFLAGS = -I m4
12 AM_CPPFLAGS = $(SSL_CFLAGS)
13 AM_LDFLAGS = $(SSL_LDFLAGS)
16 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
17 AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
18 AM_CPPFLAGS += $(PTHREAD_INCLUDES)
19 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
22 AM_CPPFLAGS += -I $(top_srcdir)/include
23 AM_CPPFLAGS += -I $(top_builddir)/include
24 AM_CPPFLAGS += -I $(top_srcdir)/lib
25 AM_CPPFLAGS += -I $(top_builddir)/lib
27 AM_CPPFLAGS += $(SSL_INCLUDES)
29 AM_CFLAGS = -Wstrict-prototypes
30 AM_CFLAGS += $(WARNING_FLAGS)
33 AM_CPPFLAGS += -DNDEBUG
34 AM_CFLAGS += -fomit-frame-pointer
42 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
43 # files. Creating .py[co] works OK for any given version of Open
44 # vSwitch, but it causes trouble if you switch from a version with
45 # foo/__init__.py into an (older) version with plain foo.py, since
46 # foo/__init__.pyc will cause Python to ignore foo.py.
47 if INCLUDE_PYTHON_COMPAT
48 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
50 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
52 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
60 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
88 build-aux/sodepends.pl \
89 build-aux/soexpand.pl \
98 dist_pkgdata_SCRIPTS =
100 dist_scripts_SCRIPTS =
121 scriptsdir = $(pkgdatadir)/scripts
123 # This ensures that files added to EXTRA_DIST are always distributed,
124 # even if they are inside an Automake if...endif conditional block that is
125 # disabled by some particular "configure" run. For more information, see:
126 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
127 noinst_HEADERS += $(EXTRA_DIST)
129 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
130 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
134 $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
136 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
137 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
138 -e 's,[@]DBDIR[@],$(DBDIR),g' \
139 -e 's,[@]PERL[@],$(PERL),g' \
140 -e 's,[@]PYTHON[@],$(PYTHON),g' \
141 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
142 -e 's,[@]VERSION[@],$(VERSION),g' \
143 -e 's,[@]localstatedir[@],$(localstatedir),g' \
144 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
145 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
146 -e 's,[@]bindir[@],$(bindir),g' \
147 -e 's,[@]sbindir[@],$(sbindir),g' \
148 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
150 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
153 $(AM_V_GEN) mv $@.tmp $@
157 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
158 CLEAN_LOCAL += clean-pycov
160 # If we're checked out from a Git repository, make sure that every
161 # file that is in Git is distributed.
163 # We only enable this check when GNU make is in use because the
164 # Makefile in datapath/linux, needed to get the list of files to
165 # distribute, requires GNU make extensions.
167 ALL_LOCAL += dist-hook-git
168 dist-hook-git: distfiles
169 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
170 (cd datapath && $(MAKE) distfiles); \
171 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
172 LC_ALL=C sort -u > all-distfiles; \
173 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
174 LC_ALL=C sort -u > all-gitfiles; \
175 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
176 if test -s missing-distfiles; then \
177 echo "The distribution is missing the following files:"; \
178 cat missing-distfiles; \
182 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
183 # The following is based on commands for the Automake "distdir" target.
185 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
186 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
187 list='$(DISTFILES)'; \
188 for file in $$list; do echo $$file; done | \
189 sed -e "s|^$$srcdirstrip/||;t" \
190 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
191 LC_ALL=C sort -u > $@
192 CLEANFILES += distfiles
194 .PHONY: dist-hook-git
196 # Check that every .c file includes <config.h>.
197 ALL_LOCAL += config-h-check
200 if test -e .git && (git --version) >/dev/null 2>&1 && \
201 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
202 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
204 echo "See above for list of violations of the rule that"; \
205 echo "every C source file must #include <config.h>."; \
208 .PHONY: config-h-check
210 # Check for printf() type modifiers that MSVC doesn't support.
211 ALL_LOCAL += printf-check
214 if test -e .git && (git --version) >/dev/null 2>&1 && \
215 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
216 grep -vE '^datapath|^lib/sflow|^third-party'`; \
218 echo "See above for list of violations of the rule that"; \
219 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
220 echo "forbidden. See CodingStyle for replacements."; \
225 # Check that certain data structures are always declared "static".
226 ALL_LOCAL += static-check
228 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
229 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
231 echo "See above for list of violations of the rule that "; \
232 echo "certain data structures must always be 'static'"; \
237 # Check that assert.h is not used outside a whitelist of files.
238 ALL_LOCAL += check-assert-h-usage
239 check-assert-h-usage:
240 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
241 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
242 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
244 echo "Files listed above unexpectedly #include <""assert.h"">."; \
245 echo "Please use ovs_assert (from util.h) instead of assert."; \
248 .PHONY: check-assert-h-usage
250 ALL_LOCAL += thread-safety-check
253 if test -e .git && (git --version) >/dev/null 2>&1 && \
254 grep -n -f build-aux/thread-safety-blacklist \
255 `git ls-files | grep '\.[ch]$$' \
256 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
257 | $(EGREP) -v ':[ ]*/?\*'; \
259 echo "See above for list of calls to functions that are"; \
260 echo "blacklisted due to thread safety issues"; \
263 EXTRA_DIST += build-aux/thread-safety-blacklist
266 ALL_LOCAL += manpage-check
267 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
269 for manpage in $?; do \
270 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; \
271 if grep warning: $@.tmp; then error=:; fi; \
274 if $$error; then exit 1; else touch $@; fi
275 $(AM_V_GEN) touch -c $@
276 CLEANFILES += manpage-check
279 include $(srcdir)/manpages.mk
280 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
281 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
282 @if cmp -s $(@F).tmp $@; then \
288 CLEANFILES += manpage-dep-check
290 dist-hook: $(DIST_HOOKS)
291 all-local: $(ALL_LOCAL)
292 clean-local: $(CLEAN_LOCAL)
293 install-data-local: $(INSTALL_DATA_LOCAL)
294 uninstall-local: $(UNINSTALL_LOCAL)
295 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
299 cd datapath/linux && $(MAKE) modules_install
302 include m4/automake.mk
303 include lib/automake.mk
304 include ofproto/automake.mk
305 include utilities/automake.mk
306 include tests/automake.mk
307 include include/automake.mk
308 include third-party/automake.mk
309 include debian/automake.mk
310 include vswitchd/automake.mk
311 include ovsdb/automake.mk
312 include rhel/automake.mk
313 include xenserver/automake.mk
314 include python/automake.mk
315 include python/compat/automake.mk
316 include tutorial/automake.mk
317 include vtep/automake.mk
318 include datapath-windows/automake.mk
319 include datapath-windows/include/automake.mk