xref: /netbsd-src/external/bsd/flex/dist/tests/tableopts.sh (revision 463ae347b383ca644b1399e7e5228310d0bdf969)
1*463ae347Schristos#!/bin/sh
2*463ae347Schristosset -eu
3*463ae347Schristos# IFS=$'\n\t'
4*463ae347SchristosIFS='
5*463ae347Schristos''	'
630da1778Schristos
730da1778Schristos# This script is present to generate the automake _SOURCES variables
830da1778Schristos# for the tableopts_* tests. It also generates the linking rules for
930da1778Schristos# each test since automake isn't able to handle the pattern rules that
1030da1778Schristos# would be natural to use. Output is written to standard output for
11*463ae347Schristos# inclusion in a Makefile.am, typically by redirecting the output and
12*463ae347Schristos# then an automake include directive.
1330da1778Schristos
1430da1778SchristosTABLEOPTS_TESTS=""
1530da1778Schristostableopts_tables=""
1630da1778Schristos
1730da1778Schristosfor kind in opt ser ver ; do
1830da1778Schristos    for threading in nr r ; do
1930da1778Schristos        for opt in -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem ; do
2030da1778Schristos            testname=tableopts_${kind}_${threading}${opt}.${kind}
2130da1778Schristos            if [ "${TABLEOPTS_TESTS}" = "" ] ;then
2230da1778Schristos                TABLEOPTS_TESTS=${testname}
23*463ae347Schristos                if [ "$kind" = "ser" ] || [ "$kind" = "ver" ] ; then
2430da1778Schristos                    tableopts_tables=${testname}.tables
2530da1778Schristos                fi
2630da1778Schristos            else
2730da1778Schristos                TABLEOPTS_TESTS="${TABLEOPTS_TESTS} ${testname}"
28*463ae347Schristos                if [ "$kind" = "ser" ] || [ "$kind" = "ver" ] ; then
2930da1778Schristos                    tableopts_tables="${tableopts_tables} ${testname}.tables"
3030da1778Schristos                fi
3130da1778Schristos            fi
3230da1778Schristos
3330da1778Schristos            bare_opt=${opt#-}
3430da1778Schristos            cat << EOF
3530da1778Schristostableopts_${kind}_${threading}_${bare_opt}_${kind}_SOURCES = tableopts.l4
3630da1778Schristos
3730da1778Schristos${testname}\$(EXEEXT): tableopts_${kind}_${threading}${opt}.\$(OBJEXT)
38*463ae347Schristos	\$(AM_V_CCLD)\$(LINK) -o \$@ \$<
3930da1778Schristos
4030da1778SchristosEOF
4130da1778Schristos        done
4230da1778Schristos    done
4330da1778Schristosdone
4430da1778Schristos
4530da1778Schristosecho TABLEOPTS_TESTS = ${TABLEOPTS_TESTS}
4630da1778Schristosecho
4730da1778Schristosecho tableopts_tables = ${tableopts_tables}
48