44 lines
519 B
Makefile
44 lines
519 B
Makefile
|
LEXER := flex
|
||
|
YACC := bison
|
||
|
CC := gcc
|
||
|
|
||
|
YACC_FLAGS := -yd
|
||
|
LEXER_FLAGS :=
|
||
|
|
||
|
LANG_NAME := lang
|
||
|
|
||
|
|
||
|
ifneq ($(VERBOSE),true)
|
||
|
QUIET=@
|
||
|
else
|
||
|
QUIET=
|
||
|
endif
|
||
|
|
||
|
default: test
|
||
|
|
||
|
y.tab.c: $(LANG_NAME).yacc
|
||
|
$(QUIET)echo "[$(YACC)] $@"
|
||
|
$(QUIET)$(YACC) $(YACC_FLAGS) $<
|
||
|
|
||
|
lex.yy.c: $(LANG_NAME).lex
|
||
|
$(QUIET)echo "[$(LEXER)] $@"
|
||
|
$(QUIET)$(LEXER) $^
|
||
|
|
||
|
test: y.tab.c lex.yy.c
|
||
|
$(QUIET)echo "[CC] $@"
|
||
|
$(QUIET)$(CC) -o $@ $^
|
||
|
|
||
|
|
||
|
|
||
|
.PHONY: clean run
|
||
|
|
||
|
run: test
|
||
|
./test
|
||
|
|
||
|
clean:
|
||
|
$(QUIET)echo "Clean up..."
|
||
|
$(QUIET)rm -f *.c *.o y.tab.h test
|
||
|
|
||
|
|
||
|
|