roleplay/client/Makefile

87 lines
2.1 KiB
Makefile

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
SOURCES = src/draw.c src/ui.c src/gpu.c src/hex.c src/hsv.h lib/spng.c lib/vma.cpp
APP_SOURCES = src/main.c $(SOURCES)
TEST_SOURCES = test/hsv.c $(SOURCES)
APP_OBJECTS = $(addsuffix .o, $(basename $(APP_SOURCES)))
TEST_OBJECTS = $(addsuffix .o, $(basename $(TEST_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)))
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: $(APP_OBJECTS)
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $^
test/test_hsv: $(TEST_OBJECTS)
2024-10-16 15:28:42 -06:00
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $^
2024-10-09 10:54:19 -06:00
.PHONY: test
test: test/test_hsv
./test/test_hsv
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:
rm -f $(SPV_FILES)
rm -f $(APP_OBJECTS)
rm -f $(TEST_OBJECTS)
2024-10-09 10:54:19 -06:00
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
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
glslc -o $@ $<
2024-10-09 10:54:19 -06:00
%.frag.spv: %.frag
glslc -o $@ $<
%.comp.spv: %.comp
glslc -o $@ $<