--- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ C2IEC=c2iec TESTS=$(patsubst %.c, %.test, $(wildcard test/*.c)) TEST_LOGS=$(patsubst %.c, %.test.log, $(wildcard test/*.c)) + +# if parameter "DEBUG" is set, we set debug flags for lex/yacc +ifneq (${DEBUG},) +DEBUG_FLAGS += -d +endif all: ${C2IEC} @@ -8,10 +13,10 @@ gcc -o $@ $^ lex.yy.c: ${C2IEC}.l - flex -d $^ + flex ${DEBUG_FLAGS} $^ y.tab.c: ${C2IEC}.y - yacc -d $^ + yacc ${DEBUG_FLAGS} $^ y.dot: ${C2IEC}.y yacc -g $^ @@ -23,6 +28,8 @@ clean: rm -f ${C2IEC} rm -f ${TEST_LOGS} + rm -f lex.yy.c + rm -f y.tab.c .PHONY: test test: ${TESTS}