This repository has been archived by the owner on Apr 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·59 lines (39 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
NAME = endgame
SRC_DIR = src
OBJ_DIR = obj
INC_DIR = inc
SDL = -F resource/framework -I resource/framework/SDL2.framework/SDL2 -I resource/framework/SDL2_image.framework/SDL2_image \
-I resource/framework/SDL2_mixer.framework/SDL2_mixer -I resource/framework/SDL2_ttf.framework/SDL2_ttf
SRC_FILES = $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES = $(addprefix $(OBJ_DIR)/, $(notdir $(SRC_FILES:%.c=%.o)))
INC_FILES = $(wildcard $(INC_DIR)/*.h)
CC = clang
CFLAGS = -std=c11 $(addprefix -W, all extra error pedantic) -g \
SDL_FLAGS = -rpath resource/framework -framework SDL2 \
-framework SDL2_image \
-I resource/framework/SDL2_image.framework/Headers \
-framework SDL2_mixer \
-I resource/framework/SDL2_mixer.framework/Headers \
-framework SDL2_ttf \
-I resource/framework/SDL2_ttf.framework/Headers \
MKDIR = mkdir -p
RM = rm -rf
all: $(NAME) clean
$(NAME): $(OBJ_FILES)
@$(CC) $(CFLAGS) $^ -o $@ -I $(INC_DIR) $(SDL_FLAGS) $(SDL)
@printf "\r\33[2K$@\t \033[32;1mcreated\033[0m\n"
$(OBJ_FILES): | $(OBJ_DIR)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(INC_FILES)
@$(CC) $(CFLAGS) -c $< -o $@ -I $(INC_DIR) $(SDL)
@printf "\r\33[2K$(NAME)\033[33;1m\t compile \033[0m$(<:$(SRC_DIR)/%.c=%)\r"
$(OBJ_DIR):
@$(MKDIR) $@
clean:
@$(RM) $(OBJ_DIR)
@printf "$(OBJ_DIR) in $(NAME)\t \033[31;1mdeleted\033[0m\n"
uninstall:
@$(RM) $(OBJ_DIR)
@$(RM) $(NAME)
@@printf "$(NAME)\t \033[31;1muninstalled\033[0m\n"
reinstall: uninstall all
.PHONY: all uninstall clean reinstall