From 4092446825e763bd7ee2595ca42f4a0ae538b5f1 Mon Sep 17 00:00:00 2001 From: nova Date: Sun, 13 Jul 2025 21:50:20 +0200 Subject: [PATCH] actual decent makefile whoa --- Makefile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 45adea2..3629459 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,24 @@ +CC := gcc +CFLAGS := -Wall -Wextra -O2 -flto=auto +CURSES := -lncursesw -ltinfow #utf8 support +#CURSES := -lncurses -tinfo #no utf8 +CFLAGS_DEBUG := $(CFLAGS) -g +GDB := gdb --tui ./th +VALGRIND := valgrind --leak-check=full --track-origins=yes --show-leak-kinds=all --log-fd=9 9>>valgrind.log ./th +HELGRIND := valgrind --tool=helgrind --log-fd=9 9>>helgrind.log ./th + + all: - gcc ./main.c -std=c89 -o th -lncursesw -ltinfow -Wall + $(CC) ./main.c -o th -std=c89 $(CFLAGS) $(CURSES) d: - gcc -g -std=c89 ./main.c -o th -lncursesw -ltinfow -Wall && gdb --tui ./th + $(CC) ./main.c -o th -std=c89 $(CFLAGS_DEBUG) $(CURSES) + $(GDB) v: - gcc -g -std=c89 ./main.c -o th -lncurses -ltinfo -O3 && valgrind --leak-check=full --track-origins=yes --show-leak-kinds=all --log-fd=9 9>>valgrind.log ./th - -rel: - gcc ./main.c -std=c89 -o th -lncursesw -ltinfow -Wall -O2 -flto + $(CC) ./main.c -o th -std=c89 $(CFLAGS_DEBUG) $(CURSES) + $(VALGRIND) +h: + $(CC) ./main.c -o th -std=c89 $(CFLAGS_DEBUG) $(CURSES) + $(HELGRIND)