v2
This commit is contained in:
31
makefile
31
makefile
@@ -1,20 +1,39 @@
|
||||
# Compiler and linker settings
|
||||
CXX = g++
|
||||
LDFLAGS = `sdl2-config --libs` -l SDL2_ttf -l SDL2_mixer
|
||||
CXXFLAGS = `sdl2-config --cflags` -pedantic -O2 -std=c++17 -lX11 -lstdc++fs -I include
|
||||
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
|
||||
|
||||
all: dirs $(TARGET)
|
||||
# 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)
|
||||
$(CXX) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
# Build object files
|
||||
build/%.o: src/%.cpp
|
||||
@$(CXX) -c -o $@ $< $(CXXFLAGS)
|
||||
$(CXX) -c -o $@ $< $(CXXFLAGS)
|
||||
|
||||
# Clean up build files
|
||||
clean:
|
||||
@rm -f $(OBJ) $(TARGET)
|
||||
@rm -f $(OBJ) $(TARGET)
|
||||
@echo "Cleaned up build files."
|
Reference in New Issue
Block a user