39 lines
791 B
Makefile
39 lines
791 B
Makefile
# Compiler and linker settings
|
|
CXX = g++
|
|
LDFLAGS = -lSDL3 -lSDL3_image
|
|
CXXFLAGS = -pedantic -std=c++17 -I include -I /usr/include/SDL3_image -I /usr/include/SDL3
|
|
|
|
# Source and object files
|
|
SRC = $(wildcard src/*.cpp)
|
|
OBJ = $(addprefix build/, $(notdir $(SRC:.cpp=.o)))
|
|
|
|
# Target executable
|
|
TARGET = build/x86_64/main.x86_64
|
|
|
|
# Default target
|
|
all: clean dirs $(TARGET)
|
|
|
|
# development target with debugging
|
|
dev: CXXFLAGS += -g
|
|
dev: all
|
|
|
|
# Release target
|
|
release: CXXFLAGS += -O3
|
|
release: all
|
|
|
|
# Create build directory if it doesn't exist
|
|
dirs:
|
|
@mkdir -p build/x86_64
|
|
|
|
# Build target
|
|
$(TARGET): $(OBJ)
|
|
$(CXX) -o $@ $^ $(LDFLAGS)
|
|
|
|
# Build object files
|
|
build/%.o: src/%.cpp
|
|
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
|
|
|
# Clean up build files
|
|
clean:
|
|
@rm -f $(OBJ) $(TARGET)
|
|
@echo "Cleaned up build files."
|