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)
13 AM_CPPFLAGS += -I $(top_srcdir)/include
14 AM_CPPFLAGS += -I $(top_srcdir)/lib
15 AM_CPPFLAGS += -I $(top_builddir)/lib
17 AM_CFLAGS = -Wstrict-prototypes
18 AM_CFLAGS += $(WARNING_FLAGS)
21 AM_CPPFLAGS += -DNDEBUG
22 AM_CFLAGS += -fomit-frame-pointer
30 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
31 # files. Creating .py[co] works OK for any given version of Open
32 # vSwitch, but it causes trouble if you switch from a version with
33 # foo/__init__.py into an (older) version with plain foo.py, since
34 # foo/__init__.pyc will cause Python to ignore foo.py.
35 if INCLUDE_PYTHON_COMPAT
36 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
38 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
40 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
48 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
75 build-aux/sodepends.pl \
76 build-aux/soexpand.pl \
85 dist_pkgdata_SCRIPTS =
87 dist_scripts_SCRIPTS =
108 scriptsdir = $(pkgdatadir)/scripts
110 # This ensures that files added to EXTRA_DIST are always distributed,
111 # even if they are inside an Automake if...endif conditional block that is
112 # disabled by some particular "configure" run. For more information, see:
113 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
114 noinst_HEADERS += $(EXTRA_DIST)
116 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
117 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
121 $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
123 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
124 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
125 -e 's,[@]DBDIR[@],$(DBDIR),g' \
126 -e 's,[@]PERL[@],$(PERL),g' \
127 -e 's,[@]PYTHON[@],$(PYTHON),g' \
128 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
129 -e 's,[@]VERSION[@],$(VERSION),g' \
130 -e 's,[@]localstatedir[@],$(localstatedir),g' \
131 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
132 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
133 -e 's,[@]bindir[@],$(bindir),g' \
134 -e 's,[@]sbindir[@],$(sbindir),g' \
135 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
136 -e 's,[@]ovsdbmonitordir[@],$(ovsdbmonitordir),g' \
138 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
139 echo chmod +x $@.tmp; \
146 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
147 CLEAN_LOCAL += clean-pycov
149 # If we're checked out from a Git repository, make sure that every
150 # file that is in Git is distributed.
152 # We only enable this check when GNU make is in use because the
153 # Makefile in datapath/linux, needed to get the list of files to
154 # distribute, requires GNU make extensions.
156 ALL_LOCAL += dist-hook-git
157 dist-hook-git: distfiles
158 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
159 (cd datapath && $(MAKE) distfiles); \
160 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
161 sort -u > all-distfiles; \
162 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
163 sort -u > all-gitfiles; \
164 comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
165 if test -s missing-distfiles; then \
166 echo "The distribution is missing the following files:"; \
167 cat missing-distfiles; \
171 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
172 # The following is based on commands for the Automake "distdir" target.
174 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
175 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
176 list='$(DISTFILES)'; \
177 for file in $$list; do echo $$file; done | \
178 sed -e "s|^$$srcdirstrip/||;t" \
179 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
180 CLEANFILES += distfiles
182 .PHONY: dist-hook-git
184 # Check that every .c file includes <config.h>.
185 ALL_LOCAL += config-h-check
188 if test -e .git && (git --version) >/dev/null 2>&1 && \
189 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
190 grep -vE '^datapath|^lib/sflow|^third-party'`; \
192 echo "See above for list of violations of the rule that"; \
193 echo "every C source file must #include <config.h>."; \
196 .PHONY: config-h-check
198 # Check for printf() type modifiers that MSVC doesn't support.
199 ALL_LOCAL += printf-check
201 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
202 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files $(srcdir) | grep '\.[ch]$$'`; \
204 echo "See above for list of violations of the rule that"; \
205 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
206 echo "forbidden. See CodingStyle for replacements."; \
211 # Check that certain data structures are always declared "static".
212 ALL_LOCAL += static-check
214 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
215 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
217 echo "See above for list of violations of the rule that "; \
218 echo "certain data structures must always be 'static'"; \
223 # Check that assert.h is not used outside a whitelist of files.
224 ALL_LOCAL += check-assert-h-usage
225 check-assert-h-usage:
226 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
227 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
228 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
230 echo "Files listed above unexpectedly #include <""assert.h"">."; \
231 echo "Please use ovs_assert (from util.h) instead of assert."; \
234 .PHONY: check-assert-h-usage
236 ALL_LOCAL += thread-safety-check
238 @if test -e '$(srcdir)'/.git && (git --version) >/dev/null 2>&1 && \
239 grep -n -f '$(srcdir)'/build-aux/thread-safety-blacklist \
240 `git ls-files '$(srcdir)' | grep '\.[ch]$$' \
241 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` \
242 | $(EGREP) -v ':[ ]*/?\*'; \
244 echo "See above for list of calls to functions that are"; \
245 echo "blacklisted due to thread safety issues"; \
248 EXTRA_DIST += build-aux/thread-safety-blacklist
251 ALL_LOCAL += manpage-check
252 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
254 for manpage in $?; do \
255 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; \
256 if grep warning: $@.tmp; then error=:; fi; \
259 if $$error; then exit 1; else echo touch $@; touch $@; fi
260 CLEANFILES += manpage-check
263 include $(srcdir)/manpages.mk
264 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
265 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
266 @if cmp -s $(@F).tmp $@; then \
272 CLEANFILES += manpage-dep-check
274 dist-hook: $(DIST_HOOKS)
275 all-local: $(ALL_LOCAL)
276 clean-local: $(CLEAN_LOCAL)
277 install-data-local: $(INSTALL_DATA_LOCAL)
278 uninstall-local: $(UNINSTALL_LOCAL)
279 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
283 cd datapath/linux && $(MAKE) modules_install
286 include lib/automake.mk
287 include ofproto/automake.mk
288 include utilities/automake.mk
289 include tests/automake.mk
290 include include/automake.mk
291 include third-party/automake.mk
292 include debian/automake.mk
293 include vswitchd/automake.mk
294 include ovsdb/automake.mk
295 include rhel/automake.mk
296 include xenserver/automake.mk
297 include python/automake.mk
298 include python/compat/automake.mk
299 include tutorial/automake.mk
300 include vtep/automake.mk