source: trunk/essentials/sys-devel/flex/tests/test-table-opts/Makefile.am

Last change on this file was 3031, checked in by bird, 18 years ago

flex 2.5.33.

File size: 4.5 KB
Line 
1# This file is part of flex.
2
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions
5# are met:
6
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10# notice, this list of conditions and the following disclaimer in the
11# documentation and/or other materials provided with the distribution.
12
13# Neither the name of the University 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20# PURPOSE.
21
22# ------------------------------------------------
23# This test is really a set of tests, one for
24# each compression flag. -Ca, -Cem, etc..
25# 'test-opt' builds non-serialized scanners with various table options.
26# 'test-ver' verifies that the serialized tables match the in-code tables.
27# 'test-ser' deserializes the tables at runtime.
28# 'test-mul' checks that we can store multiple tables in a single file.
29# ------------------------------------------------
30
31
32FLEX = $(top_builddir)/flex
33
34testname := test-table-opts
35allopts := -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem
36
37# the test names themselves
38opttests := $(foreach opt,$(allopts), test-opt-nr$(opt) test-opt-r$(opt))
39sertests := $(foreach opt,$(allopts), test-ser-nr$(opt) test-ser-r$(opt))
40vertests := $(foreach opt,$(allopts), test-ver-nr$(opt) test-ver-r$(opt))
41alltests := $(opttests) $(vertests) $(sertests) test-mul
42
43# the executables to build
44optexe := $(addsuffix $(EXEEXT),$(opttests))
45verexe := $(addsuffix $(EXEEXT),$(vertests))
46serexe := $(addsuffix $(EXEEXT),$(sertests))
47allexe := $(optexe) $(verexe) $(serexe)
48
49# the .c files
50optsrc := $(addsuffix .c,$(opttests))
51versrc := $(addsuffix .c,$(vertests))
52sersrc := $(addsuffix .c,$(sertests))
53allsrc := $(optsrc) $(versrc) $(sersrc)
54
55# the .o files
56optobj := $(addsuffix .o,$(opttests))
57verobj := $(addsuffix .o,$(vertests))
58serobj := $(addsuffix .o,$(sertests))
59allobj := $(optobj) $(verobj) $(serobj)
60
61# the .tables files
62sertables := $(addsuffix .tables,$(sertests))
63alltables := $(addsuffix .tables,$(alltests))
64
65EXTRA_DIST = scanner.l test.input
66CLEANFILES = scanner.c OUTPUT test-*.o test-*.c test-*.tables \
67 all-ser.tables core $(alltests)
68AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
69
70test: test-table-opts
71test-table-opts: $(alltests)
72
73test-opt-r%.c: $(srcdir)/scanner.l
74 $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --reentrant $* -o $@ $<
75
76test-opt-nr%.c: $(srcdir)/scanner.l
77 $(FLEX) -L -P $(subst -,_,$(basename $(@F))) $* -o $@ $<
78
79test-ser-r%.c: $(srcdir)/scanner.l
80 $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R --tables-file="test-ser-r$*.tables" $* -o $@ $<
81
82test-ser-nr%.c: $(srcdir)/scanner.l
83 $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --tables-file="test-ser-nr$*.tables" $* -o $@ $<
84
85test-ver-r%.c: $(srcdir)/scanner.l
86 $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R --tables-file="test-ver-r$*.tables" --tables-verify $* -o $@ $<
87
88test-ver-nr%.c: $(srcdir)/scanner.l
89 $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --tables-file="test-ver-nr$*.tables" --tables-verify $* -o $@ $<
90
91test-opt%$(EXEEXT): test-opt%.o
92 $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
93
94test-ser%$(EXEEXT): test-ser%.o
95 $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
96
97test-ver%$(EXEEXT): test-ver%.o
98 $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
99
100test-opt: $(optexe)
101 for t in $(optexe) ; do \
102 ./$$t `basename $$t $(EXEEXT)`.tables < $(srcdir)/test.input \
103 || { echo $t FAILED ; exit 1 ; } ; \
104 done
105
106test-ver: $(verexe)
107 for t in $(verexe) ; do \
108 ./$$t `basename $$t $(EXEEXT)`.tables < $(srcdir)/test.input \
109 || { echo $t FAILED ; exit 1 ; } ; \
110 done
111
112test-ser: $(serexe)
113 for t in $(serexe) ; do \
114 ./$$t `basename $$t $(EXEEXT)`.tables < $(srcdir)/test.input \
115 || { echo $t FAILED ; exit 1 ; } ; \
116 done
117
118test-mul: $(serexe)
119 $(RM) all-ser.tables
120 cat $(sertables) > all-ser.tables
121 for t in $(serexe) ; do \
122 ./$$t all-ser.tables < $(srcdir)/test.input || { echo $$t FAILED; exit 1; } ; \
123 done
124
125.c.o:
126 $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
127
128.PHONY: test-table-opts test test-opt test-ser test-ver test-mul
129.SECONDARY: $(allobj) $(allsrc)
Note: See TracBrowser for help on using the repository browser.