]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/kyua/Makefile.am
bhnd(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / contrib / kyua / Makefile.am
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
29 ACLOCAL_AMFLAGS = -I m4
30
31 CHECK_BOOTSTRAP_DEPS =
32 CHECK_KYUA_DEPS =
33 CHECK_LOCAL =
34 CLEAN_TARGETS =
35 DIST_HOOKS =
36 PHONY_TARGETS =
37 CLEANFILES =
38
39 EXTRA_DIST =
40 noinst_DATA =
41 noinst_LIBRARIES =
42 noinst_SCRIPTS =
43
44 doc_DATA = AUTHORS CONTRIBUTING.md CONTRIBUTORS LICENSE NEWS.md
45 noinst_DATA += INSTALL.md README.md
46 EXTRA_DIST += $(doc_DATA) INSTALL.md README.md
47
48 if WITH_ATF
49 tests_topdir = $(pkgtestsdir)
50
51 tests_top_DATA = Kyuafile
52 EXTRA_DIST += $(tests_top_DATA)
53 endif
54
55 include admin/Makefile.am.inc
56 include bootstrap/Makefile.am.inc
57 include cli/Makefile.am.inc
58 include doc/Makefile.am.inc
59 include drivers/Makefile.am.inc
60 include engine/Makefile.am.inc
61 include examples/Makefile.am.inc
62 include integration/Makefile.am.inc
63 include misc/Makefile.am.inc
64 include model/Makefile.am.inc
65 include store/Makefile.am.inc
66 include utils/Makefile.am.inc
67
68 bin_PROGRAMS = kyua
69 kyua_SOURCES = main.cpp
70 kyua_CXXFLAGS = $(CLI_CFLAGS) $(ENGINE_CFLAGS) $(UTILS_CFLAGS)
71 kyua_LDADD = $(CLI_LIBS) $(ENGINE_LIBS) $(UTILS_LIBS)
72
73 CHECK_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}"
80 INSTALLCHECK_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.
86 noinst_SCRIPTS += local-kyua
87 CLEANFILES += local-kyua local-kyua.tmp
88 local-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
97 if WITH_ATF
98 CHECK_LOCAL += dump-ulimits check-kyua
99 PHONY_TARGETS += check-kyua
100 check-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
111 installcheck-local: dump-ulimits installcheck-kyua
112 PHONY_TARGETS += installcheck-kyua
113 installcheck-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.
128 PHONY_TARGETS += dump-ulimits
129 dump-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
136 else
137 DIST_HOOKS += forbid-dist
138 PHONY_TARGETS += forbid-dist
139 forbid-dist:
140         @echo "Sorry; cannot make dist without atf."
141         @false
142 endif
143 check-local: $(CHECK_LOCAL)
144
145 if 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.
150 PHONY_TARGETS += check-api-docs
151 check-api-docs: api-docs/api-docs.tag
152         @$(AWK) -f $(srcdir)/admin/check-api-docs.awk api-docs/doxygen.out
153
154 api-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
161 CLEAN_TARGETS += clean-api-docs
162 clean-api-docs:
163         rm -rf api-docs
164 endif
165
166 # Replace Automake's builtin check-news functionality so that we can validate
167 # the NEWS.md file instead of NEWS.
168 DIST_HOOKS += check-news
169 PHONY_TARGETS += check-news
170 check-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
179 clean-local: $(CLEAN_TARGETS)
180 dist-hook: $(DIST_HOOKS)
181
182 PHONY_TARGETS += clean-all
183 clean-all:
184         GIT="$(GIT)" $(SH) $(srcdir)/admin/clean-all.sh
185
186 .PHONY: $(PHONY_TARGETS)