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-28 01:48:35 +02:00
|
|
|
OBJ = $(addprefix $(BIN)/, $(_PROG:.cpp=.o))
|
2024-03-18 11:25:15 +01:00
|
|
|
|
2024-04-29 19:45:45 +02:00
|
|
|
.PHONY: all clean test
|
2024-03-18 11:25:15 +01:00
|
|
|
|
|
|
|
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)
|
2024-04-28 01:48:35 +02:00
|
|
|
$(CXX) $^ $(LDFLAGS) -o $(BIN)/$@
|
2024-03-18 11:25:15 +01:00
|
|
|
|
2024-04-28 01:48:35 +02:00
|
|
|
$(BIN)/%.o: $(SRC)/%.cpp
|
|
|
|
$(CXX) -c $< $(CXXFLAGS) -o $@
|
2024-03-18 11:25:15 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(addprefix $(BIN)/, $(OBJ))
|
|
|
|
rm -rf $(BIN)/$(NAME)
|
2024-04-24 19:30:34 +02:00
|
|
|
rm -rf $(BIN)
|
|
|
|
rm -rf $(PREPROCESSED)
|
|
|
|
|
2024-04-24 20:03:18 +02:00
|
|
|
_PP_HXX = osuparser.hpp config.hpp
|
|
|
|
_PP_CXX = osuparser.cpp
|
|
|
|
_PP = $(_PP_HXX) $(_PP_CXX)
|
|
|
|
PP = $(addprefix $(PREPROCESSED)/, $(_PP))
|
|
|
|
|
2024-04-25 11:49:09 +02:00
|
|
|
# PP_DEBUG gets rid of all the macros we don't need
|
|
|
|
# when debugging the preprocessed output
|
2024-04-24 20:14:35 +02:00
|
|
|
pp: dirs $(PP)
|
2024-04-24 20:03:18 +02:00
|
|
|
|
|
|
|
$(PREPROCESSED)/%.hpp: $(INCLUDE)/%.hpp
|
2024-04-25 11:49:09 +02:00
|
|
|
$(CXX) -DPP_DEBUG $(CXXFLAGS) -E $< > $@
|
2024-04-24 20:09:04 +02:00
|
|
|
clang-format -i $@
|
2024-04-24 20:03:18 +02:00
|
|
|
|
|
|
|
$(PREPROCESSED)/%.cpp: $(SRC)/%.cpp
|
2024-04-25 11:49:09 +02:00
|
|
|
$(CXX) -DPP_DEBUG $(CXXFLAGS) -E $< > $@
|
2024-04-24 20:09:04 +02:00
|
|
|
clang-format -i $@
|
2024-04-28 17:43:53 +02:00
|
|
|
|
2024-04-29 19:45:45 +02:00
|
|
|
test:
|
|
|
|
@CXX="$(CXX)" \
|
|
|
|
CXXFLAGS="$(CXXFLAGS)" \
|
|
|
|
BIN="$(BIN)/test" \
|
|
|
|
INCLUDE="$(INCLUDE)" \
|
|
|
|
make -f test/Makefile
|