xref: /netbsd-src/external/bsd/flex/dist/tests/tableopts.sh (revision 463ae347b383ca644b1399e7e5228310d0bdf969)
1#!/bin/sh
2set -eu
3# IFS=$'\n\t'
4IFS='
5''	'
6
7# This script is present to generate the automake _SOURCES variables
8# for the tableopts_* tests. It also generates the linking rules for
9# each test since automake isn't able to handle the pattern rules that
10# would be natural to use. Output is written to standard output for
11# inclusion in a Makefile.am, typically by redirecting the output and
12# then an automake include directive.
13
14TABLEOPTS_TESTS=""
15tableopts_tables=""
16
17for kind in opt ser ver ; do
18    for threading in nr r ; do
19        for opt in -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem ; do
20            testname=tableopts_${kind}_${threading}${opt}.${kind}
21            if [ "${TABLEOPTS_TESTS}" = "" ] ;then
22                TABLEOPTS_TESTS=${testname}
23                if [ "$kind" = "ser" ] || [ "$kind" = "ver" ] ; then
24                    tableopts_tables=${testname}.tables
25                fi
26            else
27                TABLEOPTS_TESTS="${TABLEOPTS_TESTS} ${testname}"
28                if [ "$kind" = "ser" ] || [ "$kind" = "ver" ] ; then
29                    tableopts_tables="${tableopts_tables} ${testname}.tables"
30                fi
31            fi
32
33            bare_opt=${opt#-}
34            cat << EOF
35tableopts_${kind}_${threading}_${bare_opt}_${kind}_SOURCES = tableopts.l4
36
37${testname}\$(EXEEXT): tableopts_${kind}_${threading}${opt}.\$(OBJEXT)
38	\$(AM_V_CCLD)\$(LINK) -o \$@ \$<
39
40EOF
41        done
42    done
43done
44
45echo TABLEOPTS_TESTS = ${TABLEOPTS_TESTS}
46echo
47echo tableopts_tables = ${tableopts_tables}
48