summaryrefslogtreecommitdiff
path: root/tests/test-bison-yylval/Makefile.in
blob: b2507f16b42404fdb6b499371756b18ca5d9650a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Makefile.in for a single TEST.
#
# By default this Makefile will build the target "$(TESTNAME)"
# from the sources "scanner.l" and "parser.y".
#
# $(TESTNAME) is supplied by the calling Makefile.
# "parser.y"  is not necessary. You may delete this file
#             if you do not require a parser.
# "scanner.l" is necessary. It should build "scanner.c".
#

@SET_MAKE@

CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
DEFS = @DEFS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
LN_S = @LN_S@
YACC = @YACC@
CC = @CC@
AR = ar
RANLIB = @RANLIB@
YACC = @YACC@

# Edit these if necessary for your specific test.
FLEX = ../../flex
YFLAGS = --defines --output-file="parser.c" --name-prefix="test" 

# Force YACC to be bison (autoconf generates 'bison -y')
YACC = @BISON@

TESTNAME = test-bison-yylval
all: $(TESTNAME)

$(TESTNAME): parser.y scanner.l 
	if test "$(YACC)" = "bison" ; then \
		$(FLEX) $(srcdir)/scanner.l ; \
		$(YACC) $(YFLAGS) $(srcdir)/parser.y ; \
		$(CC) $(CPPFLAGS) $(CFLAGS) -c scanner.c ;\
		$(CC) $(CPPFLAGS) $(CFLAGS) -c parser.c ; \
		$(CC) $(CFLAGS) -o $(TESTNAME) scanner.o parser.o $(LDFLAGS) $(LIBS) ; \
	fi

test: check

check: $(TESTNAME)
	if test "$(YACC)" = "bison" ; then \
        ./$(TESTNAME) < $(srcdir)/test.input  ; \
    else \
        echo "Test skipped because GNU bison was not detected by configure." ;\
        exit 2; \
    fi

clean:
	rm -f scanner.o scanner.c parser.o parser.c  parser.h $(TESTNAME)


distclean: clean
	rm -f Makefile