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_CPPFLAGS += $(MSVC_CFLAGS)
20 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
23 AM_CPPFLAGS += -I $(top_srcdir)/include
24 AM_CPPFLAGS += -I $(top_builddir)/include
25 AM_CPPFLAGS += -I $(top_srcdir)/lib
26 AM_CPPFLAGS += -I $(top_builddir)/lib
28 AM_CPPFLAGS += $(SSL_INCLUDES)
30 AM_CFLAGS = -Wstrict-prototypes
31 AM_CFLAGS += $(WARNING_FLAGS)
34 AM_CPPFLAGS += -DNDEBUG
35 AM_CFLAGS += -fomit-frame-pointer
43 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
44 # files. Creating .py[co] works OK for any given version of Open
45 # vSwitch, but it causes trouble if you switch from a version with
46 # foo/__init__.py into an (older) version with plain foo.py, since
47 # foo/__init__.pyc will cause Python to ignore foo.py.
48 if INCLUDE_PYTHON_COMPAT
49 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
51 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
53 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
61 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
92 build-aux/sodepends.pl \
93 build-aux/soexpand.pl \
102 dist_pkgdata_SCRIPTS =
104 dist_scripts_SCRIPTS =
125 scriptsdir = $(pkgdatadir)/scripts
127 # This ensures that files added to EXTRA_DIST are always distributed,
128 # even if they are inside an Automake if...endif conditional block that is
129 # disabled by some particular "configure" run. For more information, see:
130 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
131 noinst_HEADERS += $(EXTRA_DIST)
133 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
134 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
138 $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
140 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
141 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
142 -e 's,[@]DBDIR[@],$(DBDIR),g' \
143 -e 's,[@]PERL[@],$(PERL),g' \
144 -e 's,[@]PYTHON[@],$(PYTHON),g' \
145 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
146 -e 's,[@]VERSION[@],$(VERSION),g' \
147 -e 's,[@]localstatedir[@],$(localstatedir),g' \
148 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
149 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
150 -e 's,[@]bindir[@],$(bindir),g' \
151 -e 's,[@]sbindir[@],$(sbindir),g' \
152 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
154 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
157 $(AM_V_GEN) mv $@.tmp $@
161 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
162 CLEAN_LOCAL += clean-pycov
164 # If we're checked out from a Git repository, make sure that every
165 # file that is in Git is distributed.
167 # We only enable this check when GNU make is in use because the
168 # Makefile in datapath/linux, needed to get the list of files to
169 # distribute, requires GNU make extensions.
171 ALL_LOCAL += dist-hook-git
172 dist-hook-git: distfiles
173 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
174 (cd datapath && $(MAKE) distfiles); \
175 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
176 LC_ALL=C sort -u > all-distfiles; \
177 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
178 LC_ALL=C sort -u > all-gitfiles; \
179 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
180 if test -s missing-distfiles; then \
181 echo "The distribution is missing the following files:"; \
182 cat missing-distfiles; \
186 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
187 # The following is based on commands for the Automake "distdir" target.
189 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
190 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
191 list='$(DISTFILES)'; \
192 for file in $$list; do echo $$file; done | \
193 sed -e "s|^$$srcdirstrip/||;t" \
194 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
195 LC_ALL=C sort -u > $@
196 CLEANFILES += distfiles
198 .PHONY: dist-hook-git
200 # Check that every .c file includes <config.h>.
201 ALL_LOCAL += config-h-check
204 if test -e .git && (git --version) >/dev/null 2>&1 && \
205 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
206 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
208 echo "See above for list of violations of the rule that"; \
209 echo "every C source file must #include <config.h>."; \
212 .PHONY: config-h-check
214 # Check for printf() type modifiers that MSVC doesn't support.
215 ALL_LOCAL += printf-check
218 if test -e .git && (git --version) >/dev/null 2>&1 && \
219 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
220 grep -vE '^datapath|^lib/sflow|^third-party'`; \
222 echo "See above for list of violations of the rule that"; \
223 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
224 echo "forbidden. See CodingStyle for replacements."; \
229 # Check that certain data structures are always declared "static".
230 ALL_LOCAL += static-check
232 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
233 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
235 echo "See above for list of violations of the rule that "; \
236 echo "certain data structures must always be 'static'"; \
241 # Check that assert.h is not used outside a whitelist of files.
242 ALL_LOCAL += check-assert-h-usage
243 check-assert-h-usage:
244 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
245 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
246 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
248 echo "Files listed above unexpectedly #include <""assert.h"">."; \
249 echo "Please use ovs_assert (from util.h) instead of assert."; \
252 .PHONY: check-assert-h-usage
254 ALL_LOCAL += thread-safety-check
257 if test -e .git && (git --version) >/dev/null 2>&1 && \
258 grep -n -f build-aux/thread-safety-blacklist \
259 `git ls-files | grep '\.[ch]$$' \
260 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
261 | $(EGREP) -v ':[ ]*/?\*'; \
263 echo "See above for list of calls to functions that are"; \
264 echo "blacklisted due to thread safety issues"; \
267 EXTRA_DIST += build-aux/thread-safety-blacklist
270 ALL_LOCAL += manpage-check
271 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
273 for manpage in $?; do \
274 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; \
275 if grep warning: $@.tmp; then error=:; fi; \
278 if $$error; then exit 1; else touch $@; fi
279 $(AM_V_GEN) touch -c $@
280 CLEANFILES += manpage-check
283 include $(srcdir)/manpages.mk
284 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
285 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
286 @if cmp -s $(@F).tmp $@; then \
292 CLEANFILES += manpage-dep-check
295 ALL_LOCAL += ovsext_make
296 ovsext_make: datapath-windows/ovsext.sln
297 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="$(VSTUDIO_CONFIG)"
299 CLEAN_LOCAL += ovsext_clean
300 ovsext_clean: datapath-windows/ovsext.sln
301 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="$(VSTUDIO_CONFIG)"
304 dist-hook: $(DIST_HOOKS)
305 all-local: $(ALL_LOCAL)
306 clean-local: $(CLEAN_LOCAL)
307 install-data-local: $(INSTALL_DATA_LOCAL)
308 uninstall-local: $(UNINSTALL_LOCAL)
309 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
313 cd datapath/linux && $(MAKE) modules_install
316 include m4/automake.mk
317 include lib/automake.mk
318 include ofproto/automake.mk
319 include utilities/automake.mk
320 include tests/automake.mk
321 include include/automake.mk
322 include third-party/automake.mk
323 include debian/automake.mk
324 include vswitchd/automake.mk
325 include ovsdb/automake.mk
326 include rhel/automake.mk
327 include xenserver/automake.mk
328 include python/automake.mk
329 include python/compat/automake.mk
330 include tutorial/automake.mk
331 include vtep/automake.mk
332 include datapath-windows/automake.mk
333 include datapath-windows/include/automake.mk