1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
# -*- makefile -*-
.PHONY: check units fuzz noise tmain tinst clean-units clean-tmain clean-gcov run-gcov codecheck cppcheck dicts cspell validate-input
check: tmain units
clean-local: clean-units clean-tmain
CTAGS_TEST = ./ctags$(EXEEXT)
READ_TEST = ./readtags$(EXEEXT)
if HAVE_TIMEOUT
TIMEOUT = 1
else
TIMEOUT = 0
endif
LANGUAGES=
CATEGORIES=
UNITS=
SILENT = $(SILENT_@AM_V@)
SILENT_ = $(SILENT_@AM_DEFAULT_V@)
SILENT_0 = @
V_RUN = $(V_RUN_@AM_V@)
V_RUN_ = $(V_RUN_@AM_DEFAULT_V@)
V_RUN_0 = @echo " RUN $@";
#
# FUZZ Target
#
# SHELL must be dash or bash.
#
fuzz: $(CTAGS_TEST)
$(V_RUN) \
if test -n "$${ZSH_VERSION+set}"; then set -o SH_WORD_SPLIT; fi; \
if test x$(VG) = x1; then \
VALGRIND=--with-valgrind; \
fi; \
c="$(srcdir)/misc/units fuzz \
--ctags=$(CTAGS_TEST) \
--languages=$(LANGUAGES) \
$${VALGRIND} --run-shrink \
--with-timeout=$(TIMEOUT)"; \
$(SHELL) $${c} $(srcdir)/Units
#
# NOISE Target
#
noise: $(CTAGS_TEST)
$(V_RUN) \
if test -n "$${ZSH_VERSION+set}"; then set -o SH_WORD_SPLIT; fi; \
if test x$(VG) = x1; then \
VALGRIND=--with-valgrind; \
fi; \
c="$(srcdir)/misc/units noise \
--ctags=$(CTAGS_TEST) \
--languages=$(LANGUAGES) \
$${VALGRIND} --run-shrink \
--with-timeout=$(TIMEOUT)"; \
$(SHELL) $${c} $(srcdir)/Units
#
# CHOP Target
#
chop: $(CTAGS_TEST)
$(V_RUN) \
if test -n "$${ZSH_VERSION+set}"; then set -o SH_WORD_SPLIT; fi; \
if test x$(VG) = x1; then \
VALGRIND=--with-valgrind; \
fi; \
c="$(srcdir)/misc/units chop \
--ctags=$(CTAGS_TEST) \
--languages=$(LANGUAGES) \
$${VALGRIND} --run-shrink \
--with-timeout=$(TIMEOUT)"; \
$(SHELL) $${c} $(srcdir)/Units
slap: $(CTAGS_TEST)
$(V_RUN) \
if test -n "$${ZSH_VERSION+set}"; then set -o SH_WORD_SPLIT; fi; \
if test x$(VG) = x1; then \
VALGRIND=--with-valgrind; \
fi; \
c="$(srcdir)/misc/units slap \
--ctags=$(CTAGS_TEST) \
--languages=$(LANGUAGES) \
$${VALGRIND} --run-shrink \
--with-timeout=$(TIMEOUT)"; \
$(SHELL) $${c} $(srcdir)/Units
#
# UNITS Target
#
units: $(CTAGS_TEST)
$(V_RUN) \
if test -n "$${ZSH_VERSION+set}"; then set -o SH_WORD_SPLIT; fi; \
if test x$(VG) = x1; then \
VALGRIND=--with-valgrind; \
fi; \
if ! test x$(TRAVIS)$(APPVEYOR)$(CIRCLECI) = x; then \
SHOW_DIFF_OUTPUT=--show-diff-output; \
fi; \
builddir=$$(pwd); \
mkdir -p $${builddir}/Units && \
\
c="$(srcdir)/misc/units run \
--ctags=$(CTAGS_TEST) \
--languages=$(LANGUAGES) \
--categories=$(CATEGORIES) \
--units=$(UNITS) \
$${VALGRIND} --run-shrink \
--with-timeout=`expr $(TIMEOUT) '*' 10`\
$${SHOW_DIFF_OUTPUT}"; \
TRAVIS=$(TRAVIS) APPVEYOR=$(APPVEYOR) CIRCLECI=$(CIRCLECI)\
$(SHELL) $${c} $(srcdir)/Units $${builddir}/Units
clean-units:
$(SILENT) echo Cleaning test units
$(SILENT) builddir=$$(pwd); \
$(SHELL) $(srcdir)/misc/units clean $${builddir}/Units
#
# VALIDATE-INPUT Target
#
validate-input:
$(V_RUN) \
if test -n "$${ZSH_VERSION+set}"; then set -o SH_WORD_SPLIT; fi; \
if test x$(VG) = x1; then \
VALGRIND=--with-valgrind; \
fi; \
if test -n "$(VALIDATORS)"; then \
VALIDATORS="--validators=$(VALIDATORS)"; \
fi; \
c="$(srcdir)/misc/units validate-input $${VALIDATORS}"; \
TRAVIS=$(TRAVIS) APPVEYOR=$(APPVEYOR) CIRCLECI=$(CIRCLECI)\
$(SHELL) $${c} $(srcdir)/Units $(srcdir)/misc/validators
#
# Test main part, not parsers
#
tmain: $(CTAGS_TEST)
$(V_RUN) \
if test -n "$${ZSH_VERSION+set}"; then set -o SH_WORD_SPLIT; fi; \
if test x$(VG) = x1; then \
VALGRIND=--with-valgrind; \
fi; \
if ! test x$(TRAVIS)$(APPVEYOR)$(CIRCLECI) = x; then \
SHOW_DIFF_OUTPUT=--show-diff-output; \
fi; \
builddir=$$(pwd); \
mkdir -p $${builddir}/Tmain && \
\
c="$(srcdir)/misc/units tmain \
--ctags=$(CTAGS_TEST) \
--units=$(UNITS) \
$${VALGRIND} \
$${SHOW_DIFF_OUTPUT}"; \
TRAVIS=$(TRAVIS) APPVEYOR=$(APPVEYOR) CIRCLECI=$(CIRCLECI)\
$(SHELL) $${c} $(srcdir)/Tmain $${builddir}/Tmain
clean-tmain:
$(SILENT) echo Cleaning main part tests
$(SILENT) builddir=$$(pwd); \
$(SHELL) $(srcdir)/misc/units clean-tmain $${builddir}/Tmain
#
# Test installation
#
tinst:
$(V_RUN) \
builddir=$$(pwd); \
rm -rf $$builddir/$(TINST_ROOT); \
$(SHELL) $(srcdir)/misc/tinst $(srcdir) $$builddir/$(TINST_ROOT)
#
# Test readtags
#
if USE_READCMD
roundtrip: $(READ_TEST)
$(V_RUN) \
builddir=$$(pwd); \
$(SHELL) $(srcdir)/misc/roundtrip $(READ_TEST) $${builddir}/Units
else
roundtrip:
endif
#
# Checking code in ctags own rules
#
codecheck:
$(SHELL) misc/src-check
#
# Report coverage (usable only if ctags is built with COVERAGE=1.)
#
run-gcov:
$(CTAGS_TEST) -o - $$(find ./Units -name 'input.*'| grep -v '.*b/.*') > /dev/null
gcov $$(find -name '*.gcda')
clean-gcov:
$(SILENT) echo Cleaning coverage reports
$(SILENT) rm -f $(ALL_SRCS:.c=.gcda)
$(SILENT) rm -f $(srcdir)/*.gcov
#
# Cppcheck
#
CPPCHECK_DEFS = -DHAVE_LIBYAML -DHAVE_LIBXML -DHAVE_COPROC -DHAVE_DECL___ENVIRON
CPPCHECK_UNDEFS = -UDEBUG -UMIO_DEBUG -UCXX_DEBUGGING_ENABLED
CPPCHECK_FLAGS = --enable=all
cppcheck:
cppcheck $(CPPCHECK_DEFS) $(CPPCHECK_UNDEFS) $(CPPCHECK_FLAGS) \
$$(git ls-files | grep '^\(parsers\|main\)/.*\.[ch]' )
#
# Spelling
#
dicts: $(CTAGS_TEST)
${SHELL} misc/make-dictfiles.sh
cspell: $(CTAGS_TEST)
${SHELL} misc/cspell
|