osuplusplus/Makefile

51 lines
1.1 KiB
Makefile
Raw Normal View History

2024-03-18 11:25:15 +01:00
CXX = g++
CXXFLAGS = -std=c++20 -O3 -Wall -Wextra -Wpedantic
LDFLAGS = -lsfml-graphics -lsfml-window -lsfml-system
NAME = osu++
2024-04-24 19:30:34 +02:00
INCLUDE = include
CXXFLAGS += -I$(INCLUDE)
2024-03-18 11:25:15 +01:00
SRC = src
BIN = target
2024-04-24 19:30:34 +02:00
PREPROCESSED = preprocessed
2024-03-18 11:25:15 +01:00
_PROG = HitObjectDrawable.cpp main.cpp osuparser.cpp TextureManager.cpp
PROG = $(addprefix $(SRC)/, $(_PROG))
2024-04-24 19:30:34 +02:00
PP_HXX = osuparser.hpp config.hpp
PP_CXX = osuparser.cpp
PP = $(PP_HXX) $(PP_CXX)
2024-03-18 11:25:15 +01:00
OBJ = $(_PROG:.cpp=.o)
.PHONY: all clean
all: dirs $(NAME)
dirs:
mkdir -p $(BIN)
2024-04-24 19:30:34 +02:00
mkdir -p $(PREPROCESSED)
2024-03-18 11:25:15 +01:00
$(NAME): $(OBJ)
$(CXX) $(addprefix $(BIN)/, $^) $(LDFLAGS) -o $(BIN)/$@
2024-04-24 19:53:08 +02:00
%.o: $(SRC)/%.cpp
2024-03-18 11:25:15 +01:00
$(CXX) -c $< $(CXXFLAGS) -o $(BIN)/$@
clean:
rm -rf $(addprefix $(BIN)/, $(OBJ))
rm -rf $(BIN)/$(NAME)
2024-04-24 19:30:34 +02:00
rm -rf $(BIN)
rm -rf $(PREPROCESSED)
TMP = temp
preprocess: dirs
mkdir -p $(TMP)
$(foreach file, $(PP_HXX), $(CXX) $(CXXFLAGS) -E $(INCLUDE)/$(file) > $(TMP)/$(file);)
$(foreach file, $(PP_CXX), $(CXX) $(CXXFLAGS) -E $(SRC)/$(file) > $(TMP)/$(file);)
$(foreach file, $(PP), clang-format $(TMP)/$(file) > $(PREPROCESSED)/$(file);)
rm -rf $(TMP)