aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile26
1 files changed, 18 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 9a48a80..5e637d8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,19 @@
CC=gcc
-CFLAGS=-Wall -Wextra -Wpedantic -g
-LDFLAGS=-lncurses -lmagic
-
-#CFLAGS = -Wall -Wextra -Wpedantic -g -fsanitize=address
-#LDFLAGS = -lncurses -fsanitize=address
+#CFLAGS=-Wall -Wextra -Wpedantic -g
+#LDFLAGS=-lncurses -lmagic
+CFLAGS=-Wall -Wextra -Wpedantic -Wstrict-prototypes -Wmissing-prototypes -g
+LDFLAGS=-lncurses -lmagic -fsanitize=address -fsanitize=undefined
+#LDFLAGS=-lncurses -lmagic
TARGET=sf
SRCS=$(wildcard *.c)
OBJS=$(SRCS:.c=.o)
+TEST_SRC=test/fm_draw_entries.c
+TEST_OBJ=dir.o mem.o err.o log.o
+TEST_BIN=fm_draw_entries
+
.PHONY: all test clean
all: $(TARGET)
@@ -20,10 +24,16 @@ $(TARGET): $(OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
+test: $(TEST_OBJ) $(TEST_SRC)
+ $(CC) $(CFLAGS) $(TEST_SRC) $(TEST_OBJ) -o $(TEST_BIN) $(TESTLDFLAGS)
+ ./$(TEST_BIN)
+ @rm -f $(TEST_BIN)
+
+debug: $(TARGET)
+ $(CC) $(OBJS) $(LDFLAGS) -O0 -o $@
+ valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --undef-value-errors=no --log-file=log ./sf
-test: $(TARGET)
- DEBUG=true ./\$<
clean:
rm -f $(OBJS) $(TARGET)
- rm ./asan.log*
+ rm -f ./asan*