mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 19:40:10 +01:00
We rename the generated lexer from yylex to glcpp_lex. Then we implement our own yylex function in glcpp-parse.y that calls glcpp_lex. This doesn't change the behavior at all yet, but gives us a place where we can do implement alternate lexing in the future. (We want this because instead of re-lexing from strings for macro expansion, we want to lex from pre-parsed token lists. We need this so that when we terminate recursion due to an already active macro expansion, we can ensure that that symbol never gets expanded again later.)
25 lines
659 B
Makefile
25 lines
659 B
Makefile
# 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 $^
|
|
|
|
%.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/*.gcc tests/*.expected tests/*~
|