blob: 5c77dfee41ac3f50c173d8f9192d9dfa6adb9523 (
plain)
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
|
#!/bin/sh
# Generate rules to make .l for testing files from rulesets. Also set up SOURCES
# variables for link time. Pass it a list of back-end suffixes.
#
# This script exists automake isn't able to handle the pattern rules that
# would be natural to use. Output is written to standard output for
# inclusion in a Makefile.am, typically by redirecting the output and
# then an automake include directive.
set -eu
RULESET_TESTS=""
RULESET_REMOVABLES=""
printf "\n# Begin generated test rules\n\n"
for backend in $* ; do
for ruleset in *.rules; do
testname=${ruleset%.*}_${backend}
echo "${testname}_SOURCES = ${testname}.l"
echo "${testname}.l: \$(srcdir)/${ruleset} \$(srcdir)/testmaker.sh \$(srcdir)/testmaker.m4"
# we're deliberately single-quoting this because we _don't_ want those variables to be expanded yet
# shellcheck disable=2016
printf '\t$(SHELL) $(srcdir)/testmaker.sh $@\n\n'
RULESET_TESTS="${RULESET_TESTS} ${testname}"
RULESET_REMOVABLES="${RULESET_REMOVABLES} ${testname} ${testname}.c ${testname}.l"
done
for kind in opt ser ver ; do
for opt in -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem ; do
bare_opt=${opt#-}
# The filenames must work on case-insensitive filesystems.
bare_opt=$(echo ${bare_opt}| sed 's/F$/xF/')
testname=tableopts_${kind}_${backend}-${bare_opt}.${kind}
RULESET_TESTS="${RULESET_TESTS} ${testname}"
RULESET_REMOVABLES="${RULESET_REMOVABLES} ${testname} ${testname}.c ${testname}.l ${testname}.tables"
cat << EOF
tableopts_${kind}_${backend}_${bare_opt}_${kind}_SOURCES = ${testname}.l
${testname}.l: \$(srcdir)/tableopts.rules \$(srcdir)/testmaker.sh \$(srcdir)/testmaker.m4
\$(SHELL) \$(srcdir)/testmaker.sh \$@
EOF
done
done
done
for backend in $* ; do
case $backend in
nr|r|c99) ext="c" ;;
*) ext=${backend} ;;
esac
printf "posixlycorrect_${backend}.${ext}: posixlycorrect_${backend}.l \$(FLEX)\n"
printf "\t\$(AM_V_LEX)POSIXLY_CORRECT=1 \$(FLEX) \$(TESTOPTS) -o \$@ \$<\n"
done
printf "# End generated test rules\n"
echo RULESET_TESTS = "${RULESET_TESTS}"
echo RULESET_REMOVABLES = "${RULESET_REMOVABLES}"
echo
|