roleplay/client/Makefile

70 lines
1.8 KiB
Makefile

2024-10-09 10:54:19 -06:00
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2024-10-28 13:47:54 -06:00
CFLAGS = -I $(ROOT_DIR)/include -I/usr/local/include -O0 -g -Wall -Wextra -fsanitize=address
2024-10-16 20:29:19 -06:00
LDFLAGS = -lfreetype -lz -lglfw -lvulkan -ldl -Xlinker -rpath -Xlinker /opt/homebrew/lib
2024-10-09 10:54:19 -06:00
SOURCES = src/main.c src/draw.c src/ui.c src/gpu.c lib/spng.c lib/vma.cpp
2024-10-09 10:54:19 -06:00
OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
VERT_SPV = $(addsuffix .vert.spv, $(basename $(wildcard shader_src/*.vert)))
FRAG_SPV = $(addsuffix .frag.spv, $(basename $(wildcard shader_src/*.frag)))
COMP_SPV = $(addsuffix .comp.spv, $(basename $(wildcard shader_src/*.comp)))
SPV_FILES = $(VERT_SPV) $(FRAG_SPV) $(COMP_SPV)
2024-10-09 10:54:19 -06:00
2024-10-15 10:37:56 -06:00
EXTRA_DEBUG_REQUIREMENTS :=
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
2024-10-16 15:28:42 -06:00
GDB = gdb
2024-10-21 15:52:16 -06:00
CFLAGS += -I /usr/include/freetype2
2024-10-15 10:37:56 -06:00
endif
ifeq ($(UNAME_S),Darwin)
2024-10-16 15:29:20 -06:00
export MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=1
2024-10-16 15:28:42 -06:00
DSYM = dsymutil
GDB = lldb
2024-10-15 10:37:56 -06:00
EXTRA_DEBUG_REQUIREMENTS = roleplay.dSYM
endif
2024-10-16 15:28:42 -06:00
CC ?= clang
CXX ?= clang++
2024-10-09 10:54:19 -06:00
.PHONY: all
all: roleplay $(SPV_FILES)
2024-10-09 10:54:19 -06:00
roleplay: $(OBJECTS)
2024-10-16 15:28:42 -06:00
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $^
2024-10-09 10:54:19 -06:00
%.o: %.cpp
2024-10-21 15:52:16 -06:00
$(CXX) $(CFLAGS) -std=c++17 -Wno-nullability-completeness -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-private-field -Wno-unused-variable -c -o $@ $<
2024-10-09 10:54:19 -06:00
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: clean clean_compdb
clean:
rm -f $(SPV_FILES)
2024-10-09 10:54:19 -06:00
rm -f $(OBJECTS)
rm -f roleplay
2024-10-15 10:37:56 -06:00
rm -rf $(EXTRA_DEBUG_REQUIREMENTS)
2024-10-09 10:54:19 -06:00
clean_compdb:
rm -rf .compdb
rm compile_commands.json
run: roleplay $(SPV_FILES)
2024-10-09 10:54:19 -06:00
./roleplay
roleplay.dSYM: roleplay
$(DSYM) roleplay
2024-10-15 10:37:56 -06:00
debug: roleplay $(EXTRA_DEBUG_REQUIREMENTS) $(SPV_FILES)
2024-10-09 10:54:19 -06:00
$(GDB) roleplay
%.vert.spv: %.vert
2024-10-28 22:49:57 -06:00
glslc --target-env=vulkan1.2 -o $@ $<
2024-10-09 10:54:19 -06:00
%.frag.spv: %.frag
2024-10-28 22:49:57 -06:00
glslc --target-env=vulkan1.2 -o $@ $<
%.comp.spv: %.comp
2024-10-28 22:49:57 -06:00
glslc --target-env=vulkan1.2 -o $@ $<