1 # Copyright (C) 2007-2015 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_CFLAGS += -D_FILE_OFFSET_BITS=64
40 AM_CPPFLAGS += -DNDEBUG
41 AM_CFLAGS += -fomit-frame-pointer
49 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
50 # files. Creating .py[co] works OK for any given version of Open
51 # vSwitch, but it causes trouble if you switch from a version with
52 # foo/__init__.py into an (older) version with plain foo.py, since
53 # foo/__init__.pyc will cause Python to ignore foo.py.
54 if INCLUDE_PYTHON_COMPAT
55 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
57 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
59 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
67 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
69 # A list of Markdown-formatted documentation that will automatically be
70 # included in the "make dist-docs" output.
87 INSTALL.XenServer.md \
88 INSTALL.userspace.md \
95 README-native-tunneling.md \
108 build-aux/dist-docs \
109 build-aux/sodepends.pl \
110 build-aux/soexpand.pl \
111 build-aux/xml2nroff \
121 dist_pkgdata_SCRIPTS =
123 dist_scripts_SCRIPTS =
147 scriptsdir = $(pkgdatadir)/scripts
148 completiondir = $(sysconfdir)/bash_completion.d
149 pkgconfigdir = $(libdir)/pkgconfig
151 # This ensures that files added to EXTRA_DIST are always distributed,
152 # even if they are inside an Automake if...endif conditional block that is
153 # disabled by some particular "configure" run. For more information, see:
154 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
155 noinst_HEADERS += $(EXTRA_DIST)
157 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
158 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
162 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
164 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
165 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
166 -e 's,[@]DBDIR[@],$(DBDIR),g' \
167 -e 's,[@]PERL[@],$(PERL),g' \
168 -e 's,[@]PYTHON[@],$(PYTHON),g' \
169 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
170 -e 's,[@]VERSION[@],$(VERSION),g' \
171 -e 's,[@]localstatedir[@],$(localstatedir),g' \
172 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
173 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
174 -e 's,[@]bindir[@],$(bindir),g' \
175 -e 's,[@]sbindir[@],$(sbindir),g' \
176 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
178 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
181 $(AM_V_at) mv $@.tmp $@
185 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
186 CLEAN_LOCAL += clean-pycov
188 # If we're checked out from a Git repository, make sure that every
189 # file that is in Git is distributed.
191 # We only enable this check when GNU make is in use because the
192 # Makefile in datapath/linux, needed to get the list of files to
193 # distribute, requires GNU make extensions.
195 ALL_LOCAL += dist-hook-git
196 dist-hook-git: distfiles
197 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
198 (cd datapath && $(MAKE) distfiles); \
199 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
200 LC_ALL=C sort -u > all-distfiles; \
201 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
202 LC_ALL=C sort -u > all-gitfiles; \
203 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
204 if test -s missing-distfiles; then \
205 echo "The following files are in git but not the distribution:"; \
206 cat missing-distfiles; \
210 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
211 # The following is based on commands for the Automake "distdir" target.
213 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
214 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
215 list='$(DISTFILES)'; \
216 for file in $$list; do echo $$file; done | \
217 sed -e "s|^$$srcdirstrip/||;t" \
218 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
219 LC_ALL=C sort -u > $@
220 CLEANFILES += distfiles
222 .PHONY: dist-hook-git
224 # Check that every .c file includes <config.h>.
225 ALL_LOCAL += config-h-check
228 if test -e .git && (git --version) >/dev/null 2>&1 && \
229 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
230 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
232 echo "See above for list of violations of the rule that"; \
233 echo "every C source file must #include <config.h>."; \
236 .PHONY: config-h-check
238 # Check for printf() type modifiers that MSVC doesn't support.
239 ALL_LOCAL += printf-check
242 if test -e .git && (git --version) >/dev/null 2>&1 && \
243 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
244 grep -vE '^datapath|^lib/sflow|^third-party'`; \
246 echo "See above for list of violations of the rule that"; \
247 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
248 echo "forbidden. See CodingStyle.md for replacements."; \
253 # Check that certain data structures are always declared "static".
254 ALL_LOCAL += static-check
256 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
257 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
259 echo "See above for list of violations of the rule that "; \
260 echo "certain data structures must always be 'static'"; \
265 # Check that assert.h is not used outside a whitelist of files.
266 ALL_LOCAL += check-assert-h-usage
267 check-assert-h-usage:
268 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
269 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
270 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
272 echo "Files listed above unexpectedly #include <""assert.h"">."; \
273 echo "Please use ovs_assert (from util.h) instead of assert."; \
276 .PHONY: check-assert-h-usage
278 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
279 # also mentioned. (<endian.h> always defines the former two constants. They
280 # must be compared to BYTE_ORDER to get the machine's correct endianness. But
281 # it is better to use WORDS_BIGENDIAN.)
282 ALL_LOCAL += check-endian
284 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
285 (cd $(srcdir) && git --no-pager grep -l -E \
286 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
287 $(EGREP) -v '^datapath/'); \
289 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
290 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
295 ALL_LOCAL += thread-safety-check
298 if test -e .git && (git --version) >/dev/null 2>&1 && \
299 grep -n -f build-aux/thread-safety-blacklist \
300 `git ls-files | grep '\.[ch]$$' \
301 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
302 | $(EGREP) -v ':[ ]*/?\*'; \
304 echo "See above for list of calls to functions that are"; \
305 echo "blacklisted due to thread safety issues"; \
308 EXTRA_DIST += build-aux/thread-safety-blacklist
311 ALL_LOCAL += manpage-check
312 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
314 for manpage in $?; do \
315 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; \
316 if grep warning: $@.tmp; then error=:; fi; \
319 if $$error; then exit 1; else touch $@; fi
320 $(AM_V_GEN) touch -c $@
321 CLEANFILES += manpage-check
324 include $(srcdir)/manpages.mk
325 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
326 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
327 @if cmp -s $(@F).tmp $@; then \
333 CLEANFILES += manpage-dep-check
336 ALL_LOCAL += ovsext_make
337 ovsext_make: datapath-windows/ovsext.sln
338 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="$(VSTUDIO_CONFIG)"
340 CLEAN_LOCAL += ovsext_clean
341 ovsext_clean: datapath-windows/ovsext.sln
342 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="$(VSTUDIO_CONFIG)"
345 dist-hook: $(DIST_HOOKS)
346 all-local: $(ALL_LOCAL)
347 clean-local: $(CLEAN_LOCAL)
348 install-data-local: $(INSTALL_DATA_LOCAL)
349 uninstall-local: $(UNINSTALL_LOCAL)
350 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
354 cd datapath/linux && $(MAKE) modules_install
358 VERSION=$(VERSION) $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
361 include Documentation/automake.mk
362 include m4/automake.mk
363 include lib/automake.mk
364 include ofproto/automake.mk
365 include utilities/automake.mk
366 include tests/automake.mk
367 include include/automake.mk
368 include third-party/automake.mk
369 include debian/automake.mk
370 include vswitchd/automake.mk
371 include ovsdb/automake.mk
372 include rhel/automake.mk
373 include xenserver/automake.mk
374 include python/automake.mk
375 include python/compat/automake.mk
376 include tutorial/automake.mk
377 include vtep/automake.mk
378 include datapath-windows/automake.mk
379 include datapath-windows/include/automake.mk