osuplusplus/Makefile
jacekpoz 19ff37e7b8
massively improve the awk fuckery
thank you krizej I actually forgot about g++ -D
2024-04-25 11:49:09 +02:00

54 lines
1.1 KiB
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_DEBUG gets rid of all the macros we don't need
# when debugging the preprocessed output
pp: dirs $(PP)
$(PREPROCESSED)/%.hpp: $(INCLUDE)/%.hpp
$(CXX) -DPP_DEBUG $(CXXFLAGS) -E $< > $@
clang-format -i $@
$(PREPROCESSED)/%.cpp: $(SRC)/%.cpp
$(CXX) -DPP_DEBUG $(CXXFLAGS) -E $< > $@
clang-format -i $@