Do not use macro for installation
[profile/ivi/flex.git] / tests / test-table-opts / Makefile.am
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 FLEX = $(top_builddir)/flex
32
33 testname  := test-table-opts
34 allopts   := -Ca -Ce -Cf -CF -Cm -Cem -Cae -Caef -CaeF -Cam -Caem
35
36 # the test names themselves
37 opttests :=  $(foreach opt,$(allopts), test-opt-nr$(opt) test-opt-r$(opt))
38 sertests :=  $(foreach opt,$(allopts), test-ser-nr$(opt) test-ser-r$(opt))
39 vertests :=  $(foreach opt,$(allopts), test-ver-nr$(opt) test-ver-r$(opt))
40 alltests  := $(opttests) $(vertests) $(sertests) test-mul
41
42 # the executables to build
43 optexe := $(addsuffix $(EXEEXT),$(opttests))
44 verexe := $(addsuffix $(EXEEXT),$(vertests))
45 serexe := $(addsuffix $(EXEEXT),$(sertests))
46 allexe := $(optexe) $(verexe) $(serexe)
47
48 # the .c files
49 optsrc := $(addsuffix .c,$(opttests))
50 versrc := $(addsuffix .c,$(vertests))
51 sersrc := $(addsuffix .c,$(sertests))
52 allsrc := $(optsrc) $(versrc) $(sersrc)
53
54 # the .o files
55 optobj := $(addsuffix .o,$(opttests))
56 verobj := $(addsuffix .o,$(vertests))
57 serobj := $(addsuffix .o,$(sertests))
58 allobj := $(optobj) $(verobj) $(serobj)
59
60 # the .tables files
61 sertables  := $(addsuffix .tables,$(sertests))
62 alltables  := $(addsuffix .tables,$(alltests))
63
64 EXTRA_DIST = scanner.l test.input
65 CLEANFILES = scanner.c OUTPUT $(allobj) $(allsrc) $(alltables) \
66              all-ser.tables $(allexe)
67 AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
68
69 test: test-opt test-ser test-ver test-mul
70
71 test-opt-r%.c: $(srcdir)/scanner.l
72         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --reentrant $*  -o $@ $<
73
74 test-opt-nr%.c: $(srcdir)/scanner.l
75         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) $* -o $@ $<
76
77 test-ser-r%.c: $(srcdir)/scanner.l
78         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R --tables-file="test-ser-r$*.tables" $*  -o $@ $<
79
80 test-ser-nr%.c: $(srcdir)/scanner.l
81         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --tables-file="test-ser-nr$*.tables"  $* -o $@ $<
82
83 test-ver-r%.c: $(srcdir)/scanner.l
84         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) -R --tables-file="test-ver-r$*.tables" --tables-verify $*  -o $@ $<
85
86 test-ver-nr%.c: $(srcdir)/scanner.l
87         $(FLEX) -L -P $(subst -,_,$(basename $(@F))) --tables-file="test-ver-nr$*.tables" --tables-verify $* -o $@ $<
88
89 test-opt%$(EXEEXT): test-opt%.o
90         $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
91
92 test-ser%$(EXEEXT): test-ser%.o
93         $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
94
95 test-ver%$(EXEEXT): test-ver%.o
96         $(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
97
98 test-opt: $(optexe)
99         for t in $(optexe) ; do \
100                 ./$$t `basename $$t $(EXEEXT)`.tables < $(srcdir)/test.input \
101           || { echo $t FAILED ; exit 1 ; } ; \
102         done
103
104 test-ver: $(verexe)
105         for t in $(verexe) ; do \
106                 ./$$t `basename $$t $(EXEEXT)`.tables < $(srcdir)/test.input \
107           || { echo $t FAILED ; exit 1 ; } ; \
108         done
109
110 test-ser: $(serexe)
111         for t in $(serexe) ; do \
112                 ./$$t `basename $$t $(EXEEXT)`.tables < $(srcdir)/test.input \
113           || { echo $t FAILED ; exit 1 ; } ; \
114         done
115
116 test-mul: $(serexe)
117         $(RM) all-ser.tables
118         cat $(sertables) > all-ser.tables
119         for t in $(serexe) ; do \
120                 ./$$t all-ser.tables < $(srcdir)/test.input || { echo $$t FAILED; exit 1; } ;  \
121         done
122
123 test-opt-nr-%.o: test-opt-nr-%.c ; $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
124 test-ser-nr-%.o: test-ser-nr-%.c ; $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL $(CFLAGS) $<
125 test-ver-nr-%.o: test-ver-nr-%.c ; $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL $(CFLAGS) $<
126
127 test-opt-r-%.o:  test-opt-r-%.c  ; $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_IS_REENTRANT $(CFLAGS) $<
128 test-ser-r-%.o:  test-ser-r-%.c  ; $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT $(CFLAGS) $<
129 test-ver-r-%.o:  test-ver-r-%.c  ; $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL -DTEST_IS_REENTRANT $(CFLAGS) $<
130
131 .PHONY: test test-opt test-ser test-ver test-mul
132 .SECONDARY: $(allobj) $(allsrc)