Makefile.
This commit is contained in:
parent
9e2f0dccc5
commit
91bf74d99e
18
Makefile
18
Makefile
@ -11,7 +11,7 @@ TEST_OBJ_DIR = $(TEST_BUILD_DIR)/obj
|
|||||||
|
|
||||||
CC = clang
|
CC = clang
|
||||||
LINK = clang
|
LINK = clang
|
||||||
CFLAGS = -Wall
|
CFLAGS = -Wall -DDBG -ggdb
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
|
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))
|
TEST_OBJ_FILES = $(patsubst $(TEST_DIR)/%.c, $(TEST_OBJ_DIR)/%.o, $(TEST_SRC_FILES))
|
||||||
|
|
||||||
# Stupid things.
|
# Stupid things.
|
||||||
RESETCOLOR = \x1b[0m
|
RESETCOLOR = \033[0m
|
||||||
WHITE = $(RESETCOLOR)\x1b[37m
|
WHITE = $(RESETCOLOR)\033[37m
|
||||||
WHITE_BOLD = $(RESETCOLOR)\x1b[37;1m
|
WHITE_BOLD = $(RESETCOLOR)\033[37;1m
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
release: clean
|
||||||
|
release: CFLAGS = -Wall -O2
|
||||||
|
release: $(TARGET)
|
||||||
|
|
||||||
|
run: $(TARGET)
|
||||||
|
@ echo -e "$(WHITE_BOLD)Running... $(RESETCOLOR)./$(TARGET)"
|
||||||
|
@ ./$(TARGET)
|
||||||
|
|
||||||
# Link to final binary.
|
# Link to final binary.
|
||||||
$(TARGET): $(OBJ_FILES)
|
$(TARGET): $(OBJ_FILES)
|
||||||
@ echo -e "$(WHITE_BOLD)Linking $(WHITE)$(TARGET)$(WHITE_BOLD)...$(RESETCOLOR) $(CC) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS)"
|
@ 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)"
|
@ 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)
|
@ 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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user