osuplusplus/Makefile
jacekpoz 3c4f5ababa
rename make preprocess to make pp
thanks for the suggestion krizej
2024-04-24 20:14:35 +02:00

52 lines
1,014 B
Makefile

CXX = g++
CXXFLAGS = -std=c++20 -O3 -Wall -Wextra -Wpedantic
LDFLAGS = -lsfml-graphics -lsfml-window -lsfml-system
NAME = osu++
INCLUDE = include
CXXFLAGS += -I$(INCLUDE)
SRC = src
BIN = target
PREPROCESSED = preprocessed
_PROG = HitObjectDrawable.cpp main.cpp osuparser.cpp TextureManager.cpp
PROG = $(addprefix $(SRC)/, $(_PROG))
OBJ = $(_PROG:.cpp=.o)
.PHONY: all clean
all: dirs $(NAME)
dirs:
mkdir -p $(BIN)
mkdir -p $(PREPROCESSED)
$(NAME): $(OBJ)
$(CXX) $(addprefix $(BIN)/, $^) $(LDFLAGS) -o $(BIN)/$@
%.o: $(SRC)/%.cpp
$(CXX) -c $< $(CXXFLAGS) -o $(BIN)/$@
clean:
rm -rf $(addprefix $(BIN)/, $(OBJ))
rm -rf $(BIN)/$(NAME)
rm -rf $(BIN)
rm -rf $(PREPROCESSED)
_PP_HXX = osuparser.hpp config.hpp
_PP_CXX = osuparser.cpp
_PP = $(_PP_HXX) $(_PP_CXX)
PP = $(addprefix $(PREPROCESSED)/, $(_PP))
pp: dirs $(PP)
$(PREPROCESSED)/%.hpp: $(INCLUDE)/%.hpp
$(CXX) $(CXXFLAGS) -E $< > $@
clang-format -i $@
$(PREPROCESSED)/%.cpp: $(SRC)/%.cpp
$(CXX) $(CXXFLAGS) -E $< > $@
clang-format -i $@