New Makefile
This commit is contained in:
parent
ec57ce7418
commit
9b08c057e0
39
cpp/Makefile
39
cpp/Makefile
@ -1,9 +1,34 @@
|
|||||||
all: test pathfinding
|
# ---------------------------------
|
||||||
# TODO add extra warnings
|
# Generated by Kimi K2
|
||||||
# TODO linter?
|
#---------- configurable ----------
|
||||||
|
CXX := g++
|
||||||
|
CXXFLAGS := -std=c++23 -Wall -Wextra -Wpedantic -ggdb3
|
||||||
|
LDFLAGS :=
|
||||||
|
LDLIBS := -lSDL3 -lSDL3_image -lGLEW -lGL
|
||||||
|
|
||||||
pathfinding:
|
SRC_DIR := src
|
||||||
g++ -Wall -ggdb3 -lSDL3 -lSDL3_image -std=c++23 -lGLEW -lGL -o pathfinding src/main.cpp src/sprite.cpp src/entities.cpp src/gameloop.cpp src/map.cpp src/pathfindingdemo.cpp src/tile.cpp src/user_input.cpp src/window.cpp
|
BUILD_DIR:= build
|
||||||
|
TARGET := pathfinding
|
||||||
|
|
||||||
test: src/test.cpp src/array.hpp
|
#----------------------------------
|
||||||
g++ -Wall -Wextra -Wpedantic -ggdb3 -std=c++23 -lgtest -o test src/test.cpp
|
SOURCES := $(wildcard $(SRC_DIR)/*.cpp)
|
||||||
|
OBJECTS := $(SOURCES:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o)
|
||||||
|
|
||||||
|
#----------------------------------
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
# link step
|
||||||
|
$(TARGET): $(OBJECTS)
|
||||||
|
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||||
|
|
||||||
|
# compile step
|
||||||
|
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp | $(BUILD_DIR)
|
||||||
|
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(BUILD_DIR) $(TARGET)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user