1 # Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 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)
15 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
18 AM_CPPFLAGS += -I $(top_srcdir)/include
19 AM_CPPFLAGS += -I $(top_srcdir)/lib
20 AM_CPPFLAGS += -I $(top_builddir)/lib
22 AM_CFLAGS = -Wstrict-prototypes
23 AM_CFLAGS += $(WARNING_FLAGS)
26 AM_CPPFLAGS += -DNDEBUG
27 AM_CFLAGS += -fomit-frame-pointer
35 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
36 # files. Creating .py[co] works OK for any given version of Open
37 # vSwitch, but it causes trouble if you switch from a version with
38 # foo/__init__.py into an (older) version with plain foo.py, since
39 # foo/__init__.pyc will cause Python to ignore foo.py.
40 if INCLUDE_PYTHON_COMPAT
41 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
43 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
45 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
53 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
81 build-aux/sodepends.pl \
82 build-aux/soexpand.pl \
91 dist_pkgdata_SCRIPTS =
93 dist_scripts_SCRIPTS =
114 scriptsdir = $(pkgdatadir)/scripts
116 # This ensures that files added to EXTRA_DIST are always distributed,
117 # even if they are inside an Automake if...endif conditional block that is
118 # disabled by some particular "configure" run. For more information, see:
119 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
120 noinst_HEADERS += $(EXTRA_DIST)
122 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
123 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
127 $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
129 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
130 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
131 -e 's,[@]DBDIR[@],$(DBDIR),g' \
132 -e 's,[@]PERL[@],$(PERL),g' \
133 -e 's,[@]PYTHON[@],$(PYTHON),g' \
134 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
135 -e 's,[@]VERSION[@],$(VERSION),g' \
136 -e 's,[@]localstatedir[@],$(localstatedir),g' \
137 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
138 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
139 -e 's,[@]bindir[@],$(bindir),g' \
140 -e 's,[@]sbindir[@],$(sbindir),g' \
141 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
142 -e 's,[@]ovsdbmonitordir[@],$(ovsdbmonitordir),g' \
144 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
145 echo chmod +x $@.tmp; \
152 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
153 CLEAN_LOCAL += clean-pycov
155 # If we're checked out from a Git repository, make sure that every
156 # file that is in Git is distributed.
158 # We only enable this check when GNU make is in use because the
159 # Makefile in datapath/linux, needed to get the list of files to
160 # distribute, requires GNU make extensions.
162 ALL_LOCAL += dist-hook-git
163 dist-hook-git: distfiles
164 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
165 (cd datapath && $(MAKE) distfiles); \
166 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
167 LC_ALL=C sort -u > all-distfiles; \
168 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
169 LC_ALL=C sort -u > all-gitfiles; \
170 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
171 if test -s missing-distfiles; then \
172 echo "The distribution is missing the following files:"; \
173 cat missing-distfiles; \
177 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
178 # The following is based on commands for the Automake "distdir" target.
180 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
181 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
182 list='$(DISTFILES)'; \
183 for file in $$list; do echo $$file; done | \
184 sed -e "s|^$$srcdirstrip/||;t" \
185 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
186 LC_ALL=C sort -u > $@
187 CLEANFILES += distfiles
189 .PHONY: dist-hook-git
191 # Check that every .c file includes <config.h>.
192 ALL_LOCAL += config-h-check
195 if test -e .git && (git --version) >/dev/null 2>&1 && \
196 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
197 grep -vE '^datapath|^lib/sflow|^third-party'`; \
199 echo "See above for list of violations of the rule that"; \
200 echo "every C source file must #include <config.h>."; \
203 .PHONY: config-h-check
205 # Check for printf() type modifiers that MSVC doesn't support.
206 ALL_LOCAL += printf-check
208 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
209 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files $(srcdir) | grep '\.[ch]$$'`; \
211 echo "See above for list of violations of the rule that"; \
212 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
213 echo "forbidden. See CodingStyle for replacements."; \
218 # Check that certain data structures are always declared "static".
219 ALL_LOCAL += static-check
221 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
222 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
224 echo "See above for list of violations of the rule that "; \
225 echo "certain data structures must always be 'static'"; \
230 # Check that assert.h is not used outside a whitelist of files.
231 ALL_LOCAL += check-assert-h-usage
232 check-assert-h-usage:
233 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
234 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
235 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
237 echo "Files listed above unexpectedly #include <""assert.h"">."; \
238 echo "Please use ovs_assert (from util.h) instead of assert."; \
241 .PHONY: check-assert-h-usage
243 ALL_LOCAL += thread-safety-check
245 @if test -e '$(srcdir)'/.git && (git --version) >/dev/null 2>&1 && \
246 grep -n -f '$(srcdir)'/build-aux/thread-safety-blacklist \
247 `git ls-files '$(srcdir)' | grep '\.[ch]$$' \
248 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` \
249 | $(EGREP) -v ':[ ]*/?\*'; \
251 echo "See above for list of calls to functions that are"; \
252 echo "blacklisted due to thread safety issues"; \
255 EXTRA_DIST += build-aux/thread-safety-blacklist
258 ALL_LOCAL += manpage-check
259 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
261 for manpage in $?; do \
262 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; \
263 if grep warning: $@.tmp; then error=:; fi; \
266 if $$error; then exit 1; else echo touch $@; touch $@; fi
267 CLEANFILES += manpage-check
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 \
279 CLEANFILES += manpage-dep-check
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)
290 cd datapath/linux && $(MAKE) modules_install
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