2024-10-09 10:54:19 -06:00
|
|
|
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
2024-10-28 22:57:25 -06:00
|
|
|
CFLAGS = -I $(ROOT_DIR)/include -I/usr/local/include -O0 -g -Wall -Wextra
|
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
|
|
|
|
2024-10-30 17:36:53 -06:00
|
|
|
SOURCES = src/main.c src/draw.c src/ui.c src/gpu.c src/hex.c lib/spng.c lib/vma.cpp
|
2024-10-09 10:54:19 -06:00
|
|
|
OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
|
2024-10-30 16:40:20 -06:00
|
|
|
VERT_SPV = $(addsuffix .vert.spv, $(basename $(wildcard shader/*.vert)))
|
|
|
|
FRAG_SPV = $(addsuffix .frag.spv, $(basename $(wildcard shader/*.frag)))
|
|
|
|
COMP_SPV = $(addsuffix .comp.spv, $(basename $(wildcard shader/*.comp)))
|
2024-10-15 00:06:46 -06:00
|
|
|
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
|
2024-10-15 00:06:46 -06:00
|
|
|
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 $@ $<
|
|
|
|
|
2024-11-04 00:46:36 -07:00
|
|
|
.PHONY: clean clean_compdb run
|
2024-10-09 10:54:19 -06:00
|
|
|
|
|
|
|
clean:
|
2024-10-15 00:06:46 -06:00
|
|
|
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
|
|
|
|
|
2024-10-15 00:06:46 -06:00
|
|
|
run: roleplay $(SPV_FILES)
|
2024-10-09 10:54:19 -06:00
|
|
|
./roleplay
|
|
|
|
|
2024-11-04 00:46:36 -07:00
|
|
|
.PHONY: debug-sign
|
|
|
|
debug-sign:
|
|
|
|
codesign --entitlements ./ent.plist -f -s "fake-apple-signing" ./roleplay
|
|
|
|
|
2024-10-09 10:54:19 -06:00
|
|
|
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-11-04 00:24:42 -07:00
|
|
|
glslc -o $@ $<
|
2024-10-09 10:54:19 -06:00
|
|
|
|
|
|
|
%.frag.spv: %.frag
|
2024-11-04 00:24:42 -07:00
|
|
|
glslc -o $@ $<
|
2024-10-15 00:06:46 -06:00
|
|
|
|
|
|
|
%.comp.spv: %.comp
|
2024-11-04 00:24:42 -07:00
|
|
|
glslc -o $@ $<
|