FYI: Reply from HP-UX
[git/dscho.git] / flex-2.5.33 / tests / test-table-opts / Makefile.am
blob4380e3d38d376957074d6899b0a705752f2d8b71
1 # This file is part of flex.
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
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.
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.
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.
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 # ------------------------------------------------
32 FLEX = $(top_builddir)/flex
34 testname  := test-table-opts
35 allopts   := -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem
37 # the test names themselves
38 opttests :=  $(foreach opt,$(allopts), test-opt-nr$(opt) test-opt-r$(opt))
39 sertests :=  $(foreach opt,$(allopts), test-ser-nr$(opt) test-ser-r$(opt))
40 vertests :=  $(foreach opt,$(allopts), test-ver-nr$(opt) test-ver-r$(opt))
41 alltests  := $(opttests) $(vertests) $(sertests) test-mul
43 # the executables to build
44 optexe := $(addsuffix $(EXEEXT),$(opttests))
45 verexe := $(addsuffix $(EXEEXT),$(vertests))
46 serexe := $(addsuffix $(EXEEXT),$(sertests))
47 allexe := $(optexe) $(verexe) $(serexe)
49 # the .c files
50 optsrc := $(addsuffix .c,$(opttests))
51 versrc := $(addsuffix .c,$(vertests))
52 sersrc := $(addsuffix .c,$(sertests))
53 allsrc := $(optsrc) $(versrc) $(sersrc)
55 # the .o files
56 optobj := $(addsuffix .o,$(opttests))
57 verobj := $(addsuffix .o,$(vertests))
58 serobj := $(addsuffix .o,$(sertests))
59 allobj := $(optobj) $(verobj) $(serobj)
61 # the .tables files
62 sertables  := $(addsuffix .tables,$(sertests))
63 alltables  := $(addsuffix .tables,$(alltests))
65 EXTRA_DIST = scanner.l test.input
66 CLEANFILES = scanner.c OUTPUT test-*.o test-*.c test-*.tables \
67              all-ser.tables core $(alltests)
68 AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
70 test: test-table-opts
71 test-table-opts: $(alltests)
73 test-opt-r%.c: $(srcdir)/scanner.l
74         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --reentrant $*  -o $@ $<
76 test-opt-nr%.c: $(srcdir)/scanner.l
77         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) $* -o $@ $<
79 test-ser-r%.c: $(srcdir)/scanner.l
80         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R --tables-file="test-ser-r$*.tables" $*  -o $@ $<
82 test-ser-nr%.c: $(srcdir)/scanner.l
83         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --tables-file="test-ser-nr$*.tables"  $* -o $@ $<
85 test-ver-r%.c: $(srcdir)/scanner.l
86         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R --tables-file="test-ver-r$*.tables" --tables-verify $*  -o $@ $<
88 test-ver-nr%.c: $(srcdir)/scanner.l
89         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --tables-file="test-ver-nr$*.tables" --tables-verify $* -o $@ $<
91 test-opt%$(EXEEXT): test-opt%.o
92         $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
94 test-ser%$(EXEEXT): test-ser%.o
95         $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
97 test-ver%$(EXEEXT): test-ver%.o
98         $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
100 test-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
106 test-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
112 test-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
118 test-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
125 .c.o:
126         $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
128 .PHONY: test-table-opts test test-opt test-ser test-ver test-mul
129 .SECONDARY: $(allobj) $(allsrc)