-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (43 loc) · 1.28 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
60
61
62
63
64
NAME = scop
SRCS += $(wildcard $(addsuffix /*.cpp, ./Application))
BIN_DIR = Bin
OBJ_DIR = Objects
RES_DIR = Resources
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o))
CXX = clang++
CXXFLAGS = -std=c++20 -I ScopEngine/Runtime/Includes -I Application -I ScopEngine/ThirdParty/KVF -D KVF_IMPL_VK_NO_PROTOTYPES
LDFLAGS = -lSDL2 ScopEngine/Bin/engine.a
DEBUG ?= false
MODE = "release"
ifeq ($(DEBUG), true)
CXXFLAGS += -g -D DEBUG
MODE = "debug"
endif
JOBS = $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))
RM = rm -rf
$(OBJ_DIR)/%.o: %.cpp
@printf "\e[1;32m[compiling "$(MODE)" {"$(CXX)"}...]\e[1;00m "$<"\n"
@$(CXX) $(CXXFLAGS) $(COPTS) -c $< -o $@
all: $(NAME)
$(NAME): $(OBJ_DIR) $(BIN_DIR) engine $(OBJS)
@printf "\e[1;32m[linking "$(MODE)" {"$(CXX)"}...]\e[1;00m "$@"\n"
@$(CXX) -o $(BIN_DIR)/$(NAME) $(OBJS) $(LDFLAGS)
@printf "\e[1;32m[build finished]\e[1;00m\n"
engine:
@make -j$(JOBS) -C ScopEngine DEBUG=$(DEBUG)
$(OBJ_DIR):
@mkdir -p $(sort $(addprefix $(OBJ_DIR)/, $(dir $(SRCS))))
$(BIN_DIR):
@mkdir -p $(BIN_DIR)
run:
@$(BIN_DIR)/$(NAME) $(RES_DIR)/42.obj
re-shaders:
@make -C ScopEngine re-shaders
clean:
@$(RM) $(OBJ_DIR)
@make -C ScopEngine clean
fclean: clean
@$(RM) $(BIN_DIR)
@make -C ScopEngine fclean
re: fclean all
.PHONY: all run clean fclean re re-shaders