From 91bf74d99e5003d3b42b3f5a3445f2a07ca7fce8 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 31 Oct 2024 16:55:59 -0400 Subject: [PATCH] Makefile. --- Makefile | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 24d16ee..babf93a 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ TEST_OBJ_DIR = $(TEST_BUILD_DIR)/obj CC = clang LINK = clang -CFLAGS = -Wall +CFLAGS = -Wall -DDBG -ggdb LDFLAGS = SRC_FILES = $(wildcard $(SRC_DIR)/*.c) @@ -22,12 +22,20 @@ TEST_SRC_FILES = $(wildcard $(TEST_DIR)/*.c) TEST_OBJ_FILES = $(patsubst $(TEST_DIR)/%.c, $(TEST_OBJ_DIR)/%.o, $(TEST_SRC_FILES)) # Stupid things. -RESETCOLOR = \x1b[0m -WHITE = $(RESETCOLOR)\x1b[37m -WHITE_BOLD = $(RESETCOLOR)\x1b[37;1m +RESETCOLOR = \033[0m +WHITE = $(RESETCOLOR)\033[37m +WHITE_BOLD = $(RESETCOLOR)\033[37;1m all: $(TARGET) +release: clean +release: CFLAGS = -Wall -O2 +release: $(TARGET) + +run: $(TARGET) + @ echo -e "$(WHITE_BOLD)Running... $(RESETCOLOR)./$(TARGET)" + @ ./$(TARGET) + # Link to final binary. $(TARGET): $(OBJ_FILES) @ echo -e "$(WHITE_BOLD)Linking $(WHITE)$(TARGET)$(WHITE_BOLD)...$(RESETCOLOR) $(CC) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS)" @@ -56,5 +64,5 @@ clean: @ echo -e "$(WHITE_BOLD)Cleaning up...$(WHITE) $(OBJ_DIR)/*.o $(TEST_OBJ_DIR)/*.o $(TEST_BUILD_DIR)/test.out $(TARGET)$(RESETCOLOR)" @ rm -rf $(OBJ_DIR)/*.o $(TEST_OBJ_DIR)/*.o $(TEST_BUILD_DIR)/test.out $(TARGET) -.PHONY: all clean test nocolor +.PHONY: all clean test nocolor release run