-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.pref
31 lines (24 loc) · 736 Bytes
/
Makefile.pref
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
SRC_DIR = ../../src
SRC = $(wildcard $(SRC_DIR)/*.cpp)
OBJ_DIR = obj
OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(SRC:.cpp=.o)))
EXEC = main$(EXEC_SUFFIX)
STRIPPED = main_stripped$(EXEC_SUFFIX)
INCLUDE = ../../include
ARCH_INCLUDE = ../include
CXXFLAGS := -I$(ARCH_INCLUDE) -I$(INCLUDE) -Wall -g3 -std=c++20
CXX = $(addprefix $(PREFIX),g++)
STRIP = $(addprefix $(PREFIX),strip)
all: $(STRIPPED)
$(OBJ_DIR):
mkdir -p $@
%.o $(OBJ_DIR)/%.o : $(SRC_DIR)/%.cpp | $(OBJ_DIR) $(PCH)
$(CXX) $(CXXFLAGS) -include pch.hpp -c $< -o $@
$(EXEC): $(OBJECTS)
$(CXX) $(CXXFLAGS) -o $@ $(OBJECTS)
$(STRIPPED): $(EXEC)
$(STRIP) $< -o $@
clean:
rm -rf $(OBJ_DIR) $(INCLUDE_DIR) $(EXEC) $(STRIPPED)
fullclean: clean
rm -rf $(ARCH_INCLUDE)