2024-10-04 19:56:58 -05:00
|
|
|
CPPFLAGS=-g
|
2024-10-14 09:17:17 -05:00
|
|
|
LDFLAGS=-lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -ltinyobjloader
|
2024-10-07 05:09:46 -05:00
|
|
|
DEBUGFLAGS=-DDEBUG -fsanitize=address
|
|
|
|
GDBFLAGS=
|
2024-10-09 02:53:44 -05:00
|
|
|
SRC = $(shell find . -name "*.cpp")
|
|
|
|
SHDRSRC = $(shell find . -name "*.frag" -o -name "*vert")
|
|
|
|
SPV = $(SHDRSRC:%.vert=%.spv) $(SHDRSRC:%.frag=%.spv)
|
2024-10-07 17:02:47 -05:00
|
|
|
OBJ = $(SRC:%.cpp=%.o)
|
2024-10-09 06:14:01 -05:00
|
|
|
MAKEFLAGS += -j16
|
2024-10-04 23:16:24 -05:00
|
|
|
BIN=build/agnosiaengine
|
2024-10-04 01:03:13 -05:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: $(BIN)
|
|
|
|
|
2024-10-04 03:36:56 -05:00
|
|
|
.PHONY: run
|
|
|
|
run: $(BIN)
|
|
|
|
./$(BIN)
|
2024-10-07 05:09:46 -05:00
|
|
|
|
|
|
|
.PHONY: gdb
|
|
|
|
gdb: LDFLAGS+=$(GDBFLAGS)
|
|
|
|
gdb: $(BIN)
|
|
|
|
gdb -q $(BIN)
|
2024-10-04 19:56:58 -05:00
|
|
|
.PHONY: debug
|
|
|
|
debug: LDFLAGS+=$(DEBUGFLAGS)
|
|
|
|
debug: $(BIN)
|
|
|
|
./$(BIN)
|
2024-10-07 05:09:46 -05:00
|
|
|
|
2024-10-04 01:03:13 -05:00
|
|
|
.PHONY: dep
|
|
|
|
dep:
|
2024-10-13 04:56:45 -05:00
|
|
|
sudo pacman -S gcc glfw glm shaderc libxi libxxf86vm gdb shaderc stb
|
2024-10-04 01:03:13 -05:00
|
|
|
.PHONY: info
|
|
|
|
info:
|
|
|
|
@echo "make: Build executable"
|
|
|
|
@echo "make dep: Make all required dependencies"
|
|
|
|
@echo "make debug: Make with Debug hooked in"
|
2024-10-09 02:53:44 -05:00
|
|
|
@echo "make gdb: Make with GDB hooked in"
|
2024-10-04 01:03:13 -05:00
|
|
|
@echo "make clean: Clean all files"
|
2024-10-04 03:36:56 -05:00
|
|
|
@echo "make run: Run the executable after building"
|
2024-10-04 01:03:13 -05:00
|
|
|
|
2024-10-09 02:53:44 -05:00
|
|
|
$(BIN): $(OBJ) $(SPV)
|
2024-10-04 01:03:13 -05:00
|
|
|
mkdir -p build
|
2024-10-04 03:36:56 -05:00
|
|
|
g++ $(CPPFLAGS) -o $(BIN) $(OBJ) $(LDFLAGS)
|
2024-10-04 01:03:13 -05:00
|
|
|
|
|
|
|
%.o: %.cpp
|
2024-10-07 05:09:46 -05:00
|
|
|
g++ -c -g $< -o $@ $(LDFLAGS)
|
2024-10-09 02:53:44 -05:00
|
|
|
|
|
|
|
%.spv: %.frag
|
|
|
|
glslc $< -o $@
|
|
|
|
%.spv: %.vert
|
2024-10-07 17:02:47 -05:00
|
|
|
glslc $< -o $@
|
2024-10-04 01:03:13 -05:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf build
|
2024-10-04 03:36:56 -05:00
|
|
|
find . -name "*.o" -type f -delete
|
2024-10-09 02:53:44 -05:00
|
|
|
find . -name "*.spv" -type f -delete
|