2023-11-22 11:58:21 +00:00
|
|
|
|
|
|
|
BUILDDIR = build
|
2023-11-29 12:57:06 +00:00
|
|
|
OUT = main
|
|
|
|
SRC_DIR = src
|
|
|
|
INCLUDE_DIR = inc
|
2023-11-22 11:58:21 +00:00
|
|
|
|
|
|
|
build: mkdir main
|
|
|
|
all: mkdir main run
|
|
|
|
|
|
|
|
mkdir: # create build directory
|
|
|
|
mkdir -p $(BUILDDIR)
|
|
|
|
|
|
|
|
run: # run binary
|
|
|
|
./$(BUILDDIR)/main
|
|
|
|
|
|
|
|
main: lex.yy.c yacc.yy.c
|
2023-11-29 12:57:06 +00:00
|
|
|
cc -Wall -I$(INCLUDE_DIR) $(SRC_DIR)/extio.c $(BUILDDIR)/yacc.yy.c $(BUILDDIR)/lex.yy.c -o $(BUILDDIR)/$(OUT)
|
2023-11-22 11:58:21 +00:00
|
|
|
|
|
|
|
# generate c file for lex
|
|
|
|
lex.yy.c:
|
2023-11-29 12:57:06 +00:00
|
|
|
flex -o $(BUILDDIR)/lex.yy.c $(SRC_DIR)/lexer.l
|
2023-11-22 11:58:21 +00:00
|
|
|
|
|
|
|
# generate c file for yacc
|
|
|
|
yacc.yy.c:
|
2023-11-29 12:57:06 +00:00
|
|
|
yacc -d -o $(BUILDDIR)/yacc.yy.c $(SRC_DIR)/parser.y
|
2023-11-22 11:58:21 +00:00
|
|
|
|
|
|
|
clean: # wipe the build directory
|
|
|
|
rm -f $(BUILDDIR)/*
|