lang/Makefile
r4 63af3e907b add assignment operator and unify memory pools
The unification of memory pools also fixed some memory leaks and
hopefully reduced the mallocs of identifier strings significantly by
giving them the same pool as the token stream.
2021-12-21 11:40:49 +01:00

41 lines
1.1 KiB
Makefile

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
.PHONY: clean
clean:
rm -f $(OBJ) $(EXE) deps.mk gmon.out map_test pool_test
ifneq ($(MAKECMDGOALS),clean)
include deps.mk
endif