This commit is contained in:
r4
2021-12-21 01:18:22 +01:00
parent ab1887c28d
commit 21694f98ac
20 changed files with 1615 additions and 0 deletions

34
Makefile Normal file
View File

@@ -0,0 +1,34 @@
CFLAGS = -ggdb -std=c11 -Wall -Wextra -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition
#CFLAGS = -pg -std=c11 -Wall -Wextra -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition
#CFLAGS = -O3 -std=c11 -Wall -Wextra -pedantic -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition
LDFLAGS = -lm
SOURCE = main.c util.c tok.c lex.c ir.c parse.c runtime.c vm.c map.c
HEADERS = util.h tok.h lex.h ir.h parse.h runtime.h vm.h map.h
EXE = main
OBJ = $(SOURCE:.c=.o)
$(EXE): $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
deps.mk: $(SOURCE) $(HEADERS)
@echo "# Automatically generated by $(CC) -MM." > $@
$(CC) -MM $(SOURCE) >> $@
map_test: map_test.c util.c map.c
$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
run_map_test: map_test
valgrind ./map_test
.PHONY: clean
clean:
rm -f $(OBJ) $(EXE) deps.mk gmon.out map_test
ifneq ($(MAKECMDGOALS),clean)
include deps.mk
endif