AgnosiaEngine/Makefile

59 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2024-10-24 20:21:10 -05:00
CPPFLAGS=-std=c++23 -g
2024-11-11 21:43:56 -06:00
CFLAGS = -g
LDFLAGS=-lglfw -Ilib -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi -ltinyobjloader -Ilib/imgui -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES
MAKEFLAGS += -j16
SRC = $(shell find . -name "*.cpp")
2024-11-11 21:43:56 -06:00
CSRC = $(shell find . -name "*.c")
SHDRSRC = $(shell find . -name "*.frag" -o -name "*.vert")
SPV = $(SHDRSRC:%.vert=%.spv) $(SHDRSRC:%.frag=%.spv)
OBJ = $(SRC:%.cpp=%.o)
2024-11-11 21:43:56 -06:00
COBJ=$(CSRC:%.c=%.o)
2024-10-04 23:16:24 -05:00
BIN=build/agnosiaengine
.PHONY: all
all: $(BIN)
.PHONY: run
run: $(BIN)
./$(BIN)
.PHONY: gdb
gdb: $(BIN)
gdb -q $(BIN)
.PHONY: debug
debug: $(BIN)
./$(BIN)
.PHONY: dep
dep:
sudo pacman -S gcc glfw glm shaderc libxi libxxf86vm gdb shaderc stb
.PHONY: info
info:
@echo "make: Build executable"
@echo "make dep: Make all required dependencies"
@echo "make debug: Make with Debug hooked in"
@echo "make gdb: Make with GDB hooked in"
@echo "make clean: Clean all files"
@echo "make run: Run the executable after building"
2024-11-11 21:43:56 -06:00
$(BIN): $(OBJ) $(COBJ) $(SPV)
mkdir -p build
2024-11-11 21:43:56 -06:00
g++ $(CPPFLAGS) -o $(BIN) $(OBJ) $(COBJ) $(LDFLAGS)
%.o: %.cpp
2024-10-24 20:21:10 -05:00
g++ -c $(CPPFLAGS) $< -o $@ $(LDFLAGS)
2024-11-11 21:43:56 -06:00
%.o : %.c
gcc -c $(CFLAGS) $< -o $@ $(LDFLAGS)
%.spv: %.frag
glslc $< -o $@
%.spv: %.vert
glslc $< -o $@
%.spv: %.glsl
glslc $< -o $@
.PHONY: clean
clean:
rm -rf build
find . -name "*.o" -type f -delete
find . -name "*.spv" -type f -delete