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)
14 AM_LDFLAGS += $(OVS_LDFLAGS)
17 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
18 AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
19 AM_CPPFLAGS += $(PTHREAD_INCLUDES)
20 AM_CPPFLAGS += $(MSVC_CFLAGS)
21 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
24 AM_CPPFLAGS += -I $(top_srcdir)/include
25 AM_CPPFLAGS += -I $(top_builddir)/include
26 AM_CPPFLAGS += -I $(top_srcdir)/lib
27 AM_CPPFLAGS += -I $(top_builddir)/lib
29 AM_CPPFLAGS += $(SSL_INCLUDES)
31 AM_CFLAGS = -Wstrict-prototypes
32 AM_CFLAGS += $(WARNING_FLAGS)
33 AM_CFLAGS += $(OVS_CFLAGS)
36 AM_CPPFLAGS += -DNDEBUG
37 AM_CFLAGS += -fomit-frame-pointer
45 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
46 # files. Creating .py[co] works OK for any given version of Open
47 # vSwitch, but it causes trouble if you switch from a version with
48 # foo/__init__.py into an (older) version with plain foo.py, since
49 # foo/__init__.pyc will cause Python to ignore foo.py.
50 if INCLUDE_PYTHON_COMPAT
51 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
53 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
55 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
63 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
79 INSTALL.XenServer.md \
80 INSTALL.userspace.md \
88 README-native-tunneling.md \
97 build-aux/sodepends.pl \
98 build-aux/soexpand.pl \
107 dist_pkgdata_SCRIPTS =
109 dist_scripts_SCRIPTS =
131 scriptsdir = $(pkgdatadir)/scripts
132 pkgconfigdir = $(libdir)/pkgconfig
134 # This ensures that files added to EXTRA_DIST are always distributed,
135 # even if they are inside an Automake if...endif conditional block that is
136 # disabled by some particular "configure" run. For more information, see:
137 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
138 noinst_HEADERS += $(EXTRA_DIST)
140 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
141 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
145 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
147 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
148 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
149 -e 's,[@]DBDIR[@],$(DBDIR),g' \
150 -e 's,[@]PERL[@],$(PERL),g' \
151 -e 's,[@]PYTHON[@],$(PYTHON),g' \
152 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
153 -e 's,[@]VERSION[@],$(VERSION),g' \
154 -e 's,[@]localstatedir[@],$(localstatedir),g' \
155 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
156 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
157 -e 's,[@]bindir[@],$(bindir),g' \
158 -e 's,[@]sbindir[@],$(sbindir),g' \
159 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
161 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
164 $(AM_V_at) mv $@.tmp $@
168 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
169 CLEAN_LOCAL += clean-pycov
171 # If we're checked out from a Git repository, make sure that every
172 # file that is in Git is distributed.
174 # We only enable this check when GNU make is in use because the
175 # Makefile in datapath/linux, needed to get the list of files to
176 # distribute, requires GNU make extensions.
178 ALL_LOCAL += dist-hook-git
179 dist-hook-git: distfiles
180 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
181 (cd datapath && $(MAKE) distfiles); \
182 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
183 LC_ALL=C sort -u > all-distfiles; \
184 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
185 LC_ALL=C sort -u > all-gitfiles; \
186 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
187 if test -s missing-distfiles; then \
188 echo "The distribution is missing the following files:"; \
189 cat missing-distfiles; \
193 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
194 # The following is based on commands for the Automake "distdir" target.
196 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
197 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
198 list='$(DISTFILES)'; \
199 for file in $$list; do echo $$file; done | \
200 sed -e "s|^$$srcdirstrip/||;t" \
201 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
202 LC_ALL=C sort -u > $@
203 CLEANFILES += distfiles
205 .PHONY: dist-hook-git
207 # Check that every .c file includes <config.h>.
208 ALL_LOCAL += config-h-check
211 if test -e .git && (git --version) >/dev/null 2>&1 && \
212 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
213 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
215 echo "See above for list of violations of the rule that"; \
216 echo "every C source file must #include <config.h>."; \
219 .PHONY: config-h-check
221 # Check for printf() type modifiers that MSVC doesn't support.
222 ALL_LOCAL += printf-check
225 if test -e .git && (git --version) >/dev/null 2>&1 && \
226 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
227 grep -vE '^datapath|^lib/sflow|^third-party'`; \
229 echo "See above for list of violations of the rule that"; \
230 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
231 echo "forbidden. See CodingStyle.md for replacements."; \
236 # Check that certain data structures are always declared "static".
237 ALL_LOCAL += static-check
239 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
240 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
242 echo "See above for list of violations of the rule that "; \
243 echo "certain data structures must always be 'static'"; \
248 # Check that assert.h is not used outside a whitelist of files.
249 ALL_LOCAL += check-assert-h-usage
250 check-assert-h-usage:
251 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
252 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
253 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
255 echo "Files listed above unexpectedly #include <""assert.h"">."; \
256 echo "Please use ovs_assert (from util.h) instead of assert."; \
259 .PHONY: check-assert-h-usage
261 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
262 # also mentioned. (<endian.h> always defines the former two constants. They
263 # must be compared to BYTE_ORDER to get the machine's correct endianness. But
264 # it is better to use WORDS_BIGENDIAN.)
265 ALL_LOCAL += check-endian
267 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
268 (cd $(srcdir) && git --no-pager grep -l -E \
269 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
270 $(EGREP) -v '^datapath/'); \
272 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
273 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
278 ALL_LOCAL += thread-safety-check
281 if test -e .git && (git --version) >/dev/null 2>&1 && \
282 grep -n -f build-aux/thread-safety-blacklist \
283 `git ls-files | grep '\.[ch]$$' \
284 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
285 | $(EGREP) -v ':[ ]*/?\*'; \
287 echo "See above for list of calls to functions that are"; \
288 echo "blacklisted due to thread safety issues"; \
291 EXTRA_DIST += build-aux/thread-safety-blacklist
294 ALL_LOCAL += manpage-check
295 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
297 for manpage in $?; do \
298 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; \
299 if grep warning: $@.tmp; then error=:; fi; \
302 if $$error; then exit 1; else touch $@; fi
303 $(AM_V_GEN) touch -c $@
304 CLEANFILES += manpage-check
307 include $(srcdir)/manpages.mk
308 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
309 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
310 @if cmp -s $(@F).tmp $@; then \
316 CLEANFILES += manpage-dep-check
319 ALL_LOCAL += ovsext_make
320 ovsext_make: datapath-windows/ovsext.sln
321 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="$(VSTUDIO_CONFIG)"
323 CLEAN_LOCAL += ovsext_clean
324 ovsext_clean: datapath-windows/ovsext.sln
325 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="$(VSTUDIO_CONFIG)"
328 dist-hook: $(DIST_HOOKS)
329 all-local: $(ALL_LOCAL)
330 clean-local: $(CLEAN_LOCAL)
331 install-data-local: $(INSTALL_DATA_LOCAL)
332 uninstall-local: $(UNINSTALL_LOCAL)
333 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
337 cd datapath/linux && $(MAKE) modules_install
340 include m4/automake.mk
341 include lib/automake.mk
342 include ofproto/automake.mk
343 include utilities/automake.mk
344 include tests/automake.mk
345 include include/automake.mk
346 include third-party/automake.mk
347 include debian/automake.mk
348 include vswitchd/automake.mk
349 include ovsdb/automake.mk
350 include rhel/automake.mk
351 include xenserver/automake.mk
352 include python/automake.mk
353 include python/compat/automake.mk
354 include tutorial/automake.mk
355 include vtep/automake.mk
356 include datapath-windows/automake.mk
357 include datapath-windows/include/automake.mk