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
23FLEX = $(top_builddir)/flex
24
25EXTRA_DIST = scanner.l test.input
26CLEANFILES = scanner.c $(testname)$(EXEEXT)-* OUTPUT $(OBJS)
27OBJS = test-reject-nr.o test-reject-r.o test-reject-ver.o \
28       test-reject-ser.o
29
30AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)
31
32tests = test-reject-nr$(EXEEXT) test-reject-r$(EXEEXT) \
33        test-reject-ser$(EXEEXT) test-reject-ver$(EXEEXT)
34testname = test-reject
35
36test-reject-nr.c: $(srcdir)/scanner.l
37	$(FLEX) -o $@ $(LFLAGS) $<
38
39test-reject-ver.c: $(srcdir)/scanner.l
40	$(FLEX) -o $@  --tables-verify --tables-file=`basename $@ .c`.tables $(LFLAGS) $<
41
42test-reject-ser.c: $(srcdir)/scanner.l
43	$(FLEX) -o $@ --tables-file=`basename $@ .c`.tables $(LFLAGS) $<
44
45test-reject-r.c: $(srcdir)/scanner.l
46	$(FLEX) --reentrant -o $@ $(LFLAGS) $<
47
48test-reject-nr$(EXEEXT): test-reject-nr.o
49	$(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
50
51test-reject-ver$(EXEEXT): test-reject-ver.o
52	$(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
53
54test-reject-ser$(EXEEXT): test-reject-ser.o
55	$(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
56
57test-reject-r$(EXEEXT): test-reject-r.o
58	$(CC) -o $@ $(LDFLAGS) $< $(LOADLIBES)
59
60$(testname)$(EXEEXT): $(OBJS)
61
62test: $(tests)
63	./$(testname)-nr$(EXEEXT) < $(srcdir)/test.input
64	./$(testname)-r$(EXEEXT) < $(srcdir)/test.input
65	./$(testname)-ver$(EXEEXT) $(testname)-ver.tables < $(srcdir)/test.input
66	./$(testname)-ser$(EXEEXT) $(testname)-ser.tables < $(srcdir)/test.input
67
68test-reject-nr.o: test-reject-nr.c
69	$(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
70
71test-reject-ver.o: test-reject-ver.c
72	$(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL $(CFLAGS) $<
73
74test-reject-ser.o: test-reject-ser.c
75	$(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_HAS_TABLES_EXTERNAL $(CFLAGS) $<
76
77test-reject-r.o: test-reject-r.c
78	$(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) -DTEST_IS_REENTRANT $(CFLAGS) $<
79
80
81