Makefile.

This commit is contained in:
Jacob Signorovitch 2024-10-31 16:55:59 -04:00
parent 9e2f0dccc5
commit 91bf74d99e

View File

@ -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