1# Copyright 2010 The Kyua Authors. 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: 7# 8# * Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# * Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# * Neither the name of Google Inc. nor the names of its contributors 14# may be used to endorse or promote products derived from this software 15# without specific prior written permission. 16# 17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29ACLOCAL_AMFLAGS = -I m4 30 31CHECK_BOOTSTRAP_DEPS = 32CHECK_KYUA_DEPS = 33CHECK_LOCAL = 34CLEAN_TARGETS = 35DIST_HOOKS = 36PHONY_TARGETS = 37CLEANFILES = 38 39EXTRA_DIST = 40noinst_DATA = 41noinst_LIBRARIES = 42noinst_SCRIPTS = 43 44doc_DATA = AUTHORS CONTRIBUTING.md CONTRIBUTORS LICENSE NEWS.md 45noinst_DATA += INSTALL.md README.md 46EXTRA_DIST += $(doc_DATA) INSTALL.md README.md 47 48if WITH_ATF 49tests_topdir = $(pkgtestsdir) 50 51tests_top_DATA = Kyuafile 52EXTRA_DIST += $(tests_top_DATA) 53endif 54 55include admin/Makefile.am.inc 56include bootstrap/Makefile.am.inc 57include cli/Makefile.am.inc 58include doc/Makefile.am.inc 59include drivers/Makefile.am.inc 60include engine/Makefile.am.inc 61include examples/Makefile.am.inc 62include integration/Makefile.am.inc 63include misc/Makefile.am.inc 64include model/Makefile.am.inc 65include store/Makefile.am.inc 66include utils/Makefile.am.inc 67 68bin_PROGRAMS = kyua 69kyua_SOURCES = main.cpp 70kyua_CXXFLAGS = $(CLI_CFLAGS) $(ENGINE_CFLAGS) $(UTILS_CFLAGS) 71kyua_LDADD = $(CLI_LIBS) $(ENGINE_LIBS) $(UTILS_LIBS) 72 73CHECK_ENVIRONMENT = KYUA_CONFDIR="/non-existent" \ 74 KYUA_DOCDIR="$(abs_top_srcdir)" \ 75 KYUA_EXAMPLESDIR="$(abs_top_srcdir)/examples" \ 76 KYUA_MISCDIR="$(abs_top_srcdir)/misc" \ 77 KYUA_STOREDIR="$(abs_top_srcdir)/store" \ 78 KYUA_STORETESTDATADIR="$(abs_top_srcdir)/store" \ 79 PATH="$(abs_top_builddir):$${PATH}" 80INSTALLCHECK_ENVIRONMENT = KYUA_CONFDIR="/non-existent" \ 81 PATH="$(prefix)/bin:$${PATH}" 82 83# Generate local-kyua, a wrapper shell script to run the just-built 'kyua' 84# binary by pointing it to the possibly not-yet-installed data files in the 85# build tree. 86noinst_SCRIPTS += local-kyua 87CLEANFILES += local-kyua local-kyua.tmp 88local-kyua: Makefile 89 $(AM_V_GEN)echo '#!/bin/sh' >local-kyua.tmp; \ 90 echo 'env $(CHECK_ENVIRONMENT) $(TESTS_ENVIRONMENT)' \ 91 '"$(abs_top_builddir)/kyua" \ 92 --config='$(KYUA_CONFIG_FILE_FOR_CHECK)' \ 93 "$${@}"' >>local-kyua.tmp; \ 94 chmod +x local-kyua.tmp; \ 95 mv -f local-kyua.tmp local-kyua 96 97if WITH_ATF 98CHECK_LOCAL += dump-ulimits check-kyua 99PHONY_TARGETS += check-kyua 100check-kyua: $(CHECK_KYUA_DEPS) 101 @failed=no; \ 102 ./local-kyua test \ 103 --kyuafile='$(top_srcdir)/Kyuafile' --build-root='$(top_builddir)' \ 104 || failed=yes; \ 105 if [ "$${failed}" = yes ]; then \ 106 ./local-kyua report --results-file='$(abs_top_srcdir)' \ 107 --verbose --results-filter=broken,failed; \ 108 exit 1; \ 109 fi 110 111installcheck-local: dump-ulimits installcheck-kyua 112PHONY_TARGETS += installcheck-kyua 113installcheck-kyua: 114 @failed=no; \ 115 cd $(pkgtestsdir) && $(INSTALLCHECK_ENVIRONMENT) $(TESTS_ENVIRONMENT) \ 116 kyua --config='$(KYUA_CONFIG_FILE_FOR_CHECK)' test \ 117 || failed=yes; \ 118 if [ "$${failed}" = yes ]; then \ 119 cd $(pkgtestsdir) && $(INSTALLCHECK_ENVIRONMENT) \ 120 $(TESTS_ENVIRONMENT) \ 121 kyua --config='$(KYUA_CONFIG_FILE_FOR_CHECK)' report \ 122 --verbose --results-filter=broken,failed; \ 123 exit 1; \ 124 fi 125 126# TODO(jmmv): kyua should probably be recording this information itself as part 127# of the execution context, just as we record environment variables. 128PHONY_TARGETS += dump-ulimits 129dump-ulimits: 130 @echo "Resource limits:" 131 @{ \ 132 ulimit -a | sed -e 's,$$, (soft),'; \ 133 ulimit -a -H | sed -e 's,$$, (hard),'; \ 134 } | sort | sed -e 's,^, ,' 135 @echo 136else 137DIST_HOOKS += forbid-dist 138PHONY_TARGETS += forbid-dist 139forbid-dist: 140 @echo "Sorry; cannot make dist without atf." 141 @false 142endif 143check-local: $(CHECK_LOCAL) 144 145if WITH_DOXYGEN 146# Runs doxygen on the source tree and validates the contents of the docstrings. 147# We do not do this by default, even if doxygen has been enabled, because this 148# step takes a long time. Instead, we just rely on a Travis CI build to catch 149# inconsistencies. 150PHONY_TARGETS += check-api-docs 151check-api-docs: api-docs/api-docs.tag 152 @$(AWK) -f $(srcdir)/admin/check-api-docs.awk api-docs/doxygen.out 153 154api-docs/api-docs.tag: $(builddir)/Doxyfile $(SOURCES) 155 @$(MKDIR_P) api-docs 156 @rm -f api-docs/doxygen.out api-docs/doxygen.out.tmp 157 $(AM_V_GEN)$(DOXYGEN) $(builddir)/Doxyfile \ 158 >api-docs/doxygen.out.tmp 2>&1 && \ 159 mv api-docs/doxygen.out.tmp api-docs/doxygen.out 160 161CLEAN_TARGETS += clean-api-docs 162clean-api-docs: 163 rm -rf api-docs 164endif 165 166# Replace Automake's builtin check-news functionality so that we can validate 167# the NEWS.md file instead of NEWS. 168DIST_HOOKS += check-news 169PHONY_TARGETS += check-news 170check-news: 171 @case "$$(sed 15q "$(srcdir)/NEWS.md")" in \ 172 *"$(VERSION)"*) : ;; \ 173 *) \ 174 echo "NEWS.md not updated; not releasing" 1>&2; \ 175 exit 1 \ 176 ;; \ 177 esac 178 179clean-local: $(CLEAN_TARGETS) 180dist-hook: $(DIST_HOOKS) 181 182PHONY_TARGETS += clean-all 183clean-all: 184 GIT="$(GIT)" $(SH) $(srcdir)/admin/clean-all.sh 185 186.PHONY: $(PHONY_TARGETS) 187