summaryrefslogtreecommitdiff
path: root/glcpp/Makefile
blob: 3fb44ac3b2ed88a5ffcd4918519f2693e075a2fb (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
# Debug symbols by default, but let the user avoid that with something
# like "make CFLAGS=-O2"
CFLAGS = -g

# But we use 'override' here so that "make CFLAGS=-O2" will still have
# all the warnings enabled.
override CFLAGS += -Wall -Wextra -Wwrite-strings -Wswitch-enum -Wno-unused

glcpp: glcpp.o glcpp-lex.o glcpp-parse.o hash_table.o xtalloc.o
	gcc -o $@ -ltalloc -lm $^

%.c %.h: %.y
	bison --debug --defines=$*.h --output=$*.c $^

%.c: %.l
	flex --prefix=glcpp_ --outfile=$@ $<

glcpp-lex.c: glcpp-parse.h

test: glcpp
	@(cd tests; ./glcpp-test)

clean:
	rm -f glcpp glcpp-lex.c glcpp-parse.c *.o *~
	rm -f tests/*.out tests/*~