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 += $(PTHREAD_INCLUDES)
18 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
21 AM_CPPFLAGS += $(SSL_INCLUDES)
23 AM_CPPFLAGS += -I $(top_srcdir)/include
24 AM_CPPFLAGS += -I $(top_srcdir)/lib
25 AM_CPPFLAGS += -I $(top_builddir)/lib
27 AM_CFLAGS = -Wstrict-prototypes
28 AM_CFLAGS += $(WARNING_FLAGS)
31 AM_CPPFLAGS += -DNDEBUG
32 AM_CFLAGS += -fomit-frame-pointer
40 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
41 # files. Creating .py[co] works OK for any given version of Open
42 # vSwitch, but it causes trouble if you switch from a version with
43 # foo/__init__.py into an (older) version with plain foo.py, since
44 # foo/__init__.pyc will cause Python to ignore foo.py.
45 if INCLUDE_PYTHON_COMPAT
46 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
48 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
50 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
58 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
85 build-aux/sodepends.pl \
86 build-aux/soexpand.pl \
95 dist_pkgdata_SCRIPTS =
97 dist_scripts_SCRIPTS =
118 scriptsdir = $(pkgdatadir)/scripts
120 # This ensures that files added to EXTRA_DIST are always distributed,
121 # even if they are inside an Automake if...endif conditional block that is
122 # disabled by some particular "configure" run. For more information, see:
123 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
124 noinst_HEADERS += $(EXTRA_DIST)
126 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
127 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
131 $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
133 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
134 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
135 -e 's,[@]DBDIR[@],$(DBDIR),g' \
136 -e 's,[@]PERL[@],$(PERL),g' \
137 -e 's,[@]PYTHON[@],$(PYTHON),g' \
138 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
139 -e 's,[@]VERSION[@],$(VERSION),g' \
140 -e 's,[@]localstatedir[@],$(localstatedir),g' \
141 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
142 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
143 -e 's,[@]bindir[@],$(bindir),g' \
144 -e 's,[@]sbindir[@],$(sbindir),g' \
145 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
147 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
150 $(AM_V_GEN) mv $@.tmp $@
154 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
155 CLEAN_LOCAL += clean-pycov
157 # If we're checked out from a Git repository, make sure that every
158 # file that is in Git is distributed.
160 # We only enable this check when GNU make is in use because the
161 # Makefile in datapath/linux, needed to get the list of files to
162 # distribute, requires GNU make extensions.
164 ALL_LOCAL += dist-hook-git
165 dist-hook-git: distfiles
166 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
167 (cd datapath && $(MAKE) distfiles); \
168 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
169 LC_ALL=C sort -u > all-distfiles; \
170 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
171 LC_ALL=C sort -u > all-gitfiles; \
172 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
173 if test -s missing-distfiles; then \
174 echo "The distribution is missing the following files:"; \
175 cat missing-distfiles; \
179 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
180 # The following is based on commands for the Automake "distdir" target.
182 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
183 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
184 list='$(DISTFILES)'; \
185 for file in $$list; do echo $$file; done | \
186 sed -e "s|^$$srcdirstrip/||;t" \
187 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
188 LC_ALL=C sort -u > $@
189 CLEANFILES += distfiles
191 .PHONY: dist-hook-git
193 # Check that every .c file includes <config.h>.
194 ALL_LOCAL += config-h-check
197 if test -e .git && (git --version) >/dev/null 2>&1 && \
198 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
199 grep -vE '^datapath|^lib/sflow|^third-party'`; \
201 echo "See above for list of violations of the rule that"; \
202 echo "every C source file must #include <config.h>."; \
205 .PHONY: config-h-check
207 # Check for printf() type modifiers that MSVC doesn't support.
208 ALL_LOCAL += printf-check
210 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
211 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files $(srcdir) | grep '\.[ch]$$'`; \
213 echo "See above for list of violations of the rule that"; \
214 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
215 echo "forbidden. See CodingStyle for replacements."; \
220 # Check that certain data structures are always declared "static".
221 ALL_LOCAL += static-check
223 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
224 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
226 echo "See above for list of violations of the rule that "; \
227 echo "certain data structures must always be 'static'"; \
232 # Check that assert.h is not used outside a whitelist of files.
233 ALL_LOCAL += check-assert-h-usage
234 check-assert-h-usage:
235 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
236 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
237 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
239 echo "Files listed above unexpectedly #include <""assert.h"">."; \
240 echo "Please use ovs_assert (from util.h) instead of assert."; \
243 .PHONY: check-assert-h-usage
245 ALL_LOCAL += thread-safety-check
247 @if test -e '$(srcdir)'/.git && (git --version) >/dev/null 2>&1 && \
248 grep -n -f '$(srcdir)'/build-aux/thread-safety-blacklist \
249 `git ls-files '$(srcdir)' | grep '\.[ch]$$' \
250 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` \
251 | $(EGREP) -v ':[ ]*/?\*'; \
253 echo "See above for list of calls to functions that are"; \
254 echo "blacklisted due to thread safety issues"; \
257 EXTRA_DIST += build-aux/thread-safety-blacklist
260 ALL_LOCAL += manpage-check
261 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
263 for manpage in $?; do \
264 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; \
265 if grep warning: $@.tmp; then error=:; fi; \
268 if $$error; then exit 1; else touch $@; fi
269 $(AM_V_GEN) touch -c $@
270 CLEANFILES += manpage-check
273 include $(srcdir)/manpages.mk
274 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
275 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
276 @if cmp -s $(@F).tmp $@; then \
282 CLEANFILES += manpage-dep-check
284 dist-hook: $(DIST_HOOKS)
285 all-local: $(ALL_LOCAL)
286 clean-local: $(CLEAN_LOCAL)
287 install-data-local: $(INSTALL_DATA_LOCAL)
288 uninstall-local: $(UNINSTALL_LOCAL)
289 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
293 cd datapath/linux && $(MAKE) modules_install
296 include m4/automake.mk
297 include lib/automake.mk
298 include ofproto/automake.mk
299 include utilities/automake.mk
300 include tests/automake.mk
301 include include/automake.mk
302 include third-party/automake.mk
303 include debian/automake.mk
304 include vswitchd/automake.mk
305 include ovsdb/automake.mk
306 include rhel/automake.mk
307 include xenserver/automake.mk
308 include python/automake.mk
309 include python/compat/automake.mk
310 include tutorial/automake.mk
311 include vtep/automake.mk