lang/Makefile

41 lines
1.1 KiB
Makefile
Raw Normal View History

2021-12-21 01:18:22 +01:00
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
pool_test: pool_test.c util.c
$(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
run_pool_test: pool_test
valgrind ./pool_test
2021-12-21 01:18:22 +01:00
.PHONY: clean
clean:
rm -f $(OBJ) $(EXE) deps.mk gmon.out map_test pool_test
2021-12-21 01:18:22 +01:00
ifneq ($(MAKECMDGOALS),clean)
include deps.mk
endif