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.
55 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
56 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
63 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
65 # A list of Markdown-formatted documentation that will automatically be
66 # included in the "make dist-docs" output.
83 INSTALL.XenServer.md \
84 INSTALL.userspace.md \
91 README-native-tunneling.md \
104 build-aux/dist-docs \
105 build-aux/sodepends.pl \
106 build-aux/soexpand.pl \
107 build-aux/xml2nroff \
117 dist_pkgdata_SCRIPTS =
119 dist_scripts_SCRIPTS =
143 scriptsdir = $(pkgdatadir)/scripts
144 completiondir = $(sysconfdir)/bash_completion.d
145 pkgconfigdir = $(libdir)/pkgconfig
147 # This ensures that files added to EXTRA_DIST are always distributed,
148 # even if they are inside an Automake if...endif conditional block that is
149 # disabled by some particular "configure" run. For more information, see:
150 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
151 noinst_HEADERS += $(EXTRA_DIST)
153 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
154 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
158 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
160 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
161 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
162 -e 's,[@]DBDIR[@],$(DBDIR),g' \
163 -e 's,[@]PERL[@],$(PERL),g' \
164 -e 's,[@]PYTHON[@],$(PYTHON),g' \
165 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
166 -e 's,[@]VERSION[@],$(VERSION),g' \
167 -e 's,[@]localstatedir[@],$(localstatedir),g' \
168 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
169 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
170 -e 's,[@]bindir[@],$(bindir),g' \
171 -e 's,[@]sbindir[@],$(sbindir),g' \
172 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
173 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
175 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
178 $(AM_V_at) mv $@.tmp $@
182 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
183 CLEAN_LOCAL += clean-pycov
185 # If we're checked out from a Git repository, make sure that every
186 # file that is in Git is distributed.
188 # We only enable this check when GNU make is in use because the
189 # Makefile in datapath/linux, needed to get the list of files to
190 # distribute, requires GNU make extensions.
192 ALL_LOCAL += dist-hook-git
193 dist-hook-git: distfiles
194 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
195 (cd datapath && $(MAKE) distfiles); \
196 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
197 LC_ALL=C sort -u > all-distfiles; \
198 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
199 LC_ALL=C sort -u > all-gitfiles; \
200 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
201 if test -s missing-distfiles; then \
202 echo "The following files are in git but not the distribution:"; \
203 cat missing-distfiles; \
207 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
208 # The following is based on commands for the Automake "distdir" target.
210 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
211 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
212 list='$(DISTFILES)'; \
213 for file in $$list; do echo $$file; done | \
214 sed -e "s|^$$srcdirstrip/||;t" \
215 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
216 LC_ALL=C sort -u > $@
217 CLEANFILES += distfiles
219 .PHONY: dist-hook-git
221 # Check that every .c file includes <config.h>.
222 ALL_LOCAL += config-h-check
225 if test -e .git && (git --version) >/dev/null 2>&1 && \
226 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
227 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
229 echo "See above for list of violations of the rule that"; \
230 echo "every C source file must #include <config.h>."; \
233 .PHONY: config-h-check
235 # Check for printf() type modifiers that MSVC doesn't support.
236 ALL_LOCAL += printf-check
239 if test -e .git && (git --version) >/dev/null 2>&1 && \
240 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
241 grep -vE '^datapath|^lib/sflow|^third-party'`; \
243 echo "See above for list of violations of the rule that"; \
244 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
245 echo "forbidden. See CodingStyle.md for replacements."; \
250 # Check that certain data structures are always declared "static".
251 ALL_LOCAL += static-check
253 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
254 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
256 echo "See above for list of violations of the rule that "; \
257 echo "certain data structures must always be 'static'"; \
262 # Check that assert.h is not used outside a whitelist of files.
263 ALL_LOCAL += check-assert-h-usage
264 check-assert-h-usage:
265 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
266 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
267 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
269 echo "Files listed above unexpectedly #include <""assert.h"">."; \
270 echo "Please use ovs_assert (from util.h) instead of assert."; \
273 .PHONY: check-assert-h-usage
275 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
276 # also mentioned. (<endian.h> always defines the former two constants. They
277 # must be compared to BYTE_ORDER to get the machine's correct endianness. But
278 # it is better to use WORDS_BIGENDIAN.)
279 ALL_LOCAL += check-endian
281 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
282 (cd $(srcdir) && git --no-pager grep -l -E \
283 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
284 $(EGREP) -v '^datapath/'); \
286 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
287 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
292 ALL_LOCAL += thread-safety-check
295 if test -e .git && (git --version) >/dev/null 2>&1 && \
296 grep -n -f build-aux/thread-safety-blacklist \
297 `git ls-files | grep '\.[ch]$$' \
298 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
299 | $(EGREP) -v ':[ ]*/?\*'; \
301 echo "See above for list of calls to functions that are"; \
302 echo "blacklisted due to thread safety issues"; \
305 EXTRA_DIST += build-aux/thread-safety-blacklist
308 ALL_LOCAL += manpage-check
309 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
311 for manpage in $?; do \
312 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; \
313 if grep warning: $@.tmp; then error=:; fi; \
316 if $$error; then exit 1; else touch $@; fi
317 $(AM_V_GEN) touch -c $@
318 CLEANFILES += manpage-check
321 include $(srcdir)/manpages.mk
322 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
323 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
324 @if cmp -s $(@F).tmp $@; then \
330 CLEANFILES += manpage-dep-check
333 ALL_LOCAL += ovsext_make
334 ovsext_make: datapath-windows/ovsext.sln
335 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)"
336 MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
338 CLEAN_LOCAL += ovsext_clean
339 ovsext_clean: datapath-windows/ovsext.sln
340 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)"
341 MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
344 dist-hook: $(DIST_HOOKS)
345 all-local: $(ALL_LOCAL)
346 clean-local: $(CLEAN_LOCAL)
347 install-data-local: $(INSTALL_DATA_LOCAL)
348 uninstall-local: $(UNINSTALL_LOCAL)
349 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
353 cd datapath/linux && $(MAKE) modules_install
357 VERSION=$(VERSION) $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
360 include Documentation/automake.mk
361 include m4/automake.mk
362 include lib/automake.mk
363 include ofproto/automake.mk
364 include utilities/automake.mk
365 include tests/automake.mk
366 include include/automake.mk
367 include third-party/automake.mk
368 include debian/automake.mk
369 include vswitchd/automake.mk
370 include ovsdb/automake.mk
371 include rhel/automake.mk
372 include xenserver/automake.mk
373 include python/automake.mk
374 include tutorial/automake.mk
375 include vtep/automake.mk
376 include datapath-windows/automake.mk
377 include datapath-windows/include/automake.mk
378 include windows/automake.mk
379 include ovn/automake.mk