roleplay/client/Makefile

72 lines
1.9 KiB
Makefile

ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
CFLAGS = -I $(ROOT_DIR)/include -I/usr/local/include -O0 -g -Wall -Wextra
LDFLAGS = -lz -lglfw -lvulkan -ldl -Xlinker -rpath -Xlinker /opt/homebrew/lib
SOURCES = src/main.c src/render.c src/vma.cpp src/pipeline.c src/command.c src/spng.c
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)
EXTRA_DEBUG_REQUIREMENTS :=
UNAME_S := $(shell uname -s)
OS :=
ifeq ($(UNAME_S),Linux)
CC = clang
CPP = clang++
GDB = GDB
endif
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/lib
CC = /opt/homebrew/opt/llvm/bin/clang
CPP = /opt/homebrew/opt/llvm/bin/clang++
DSYM = /opt/homebrew/opt/llvm/bin/dsymutil
GDB = /opt/homebrew/opt/llvm/bin/lldb
EXTRA_DEBUG_REQUIREMENTS = roleplay.dSYM
endif
export MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=1
.PHONY: all
all: roleplay $(SPV_FILES)
roleplay: $(OBJECTS)
$(CPP) $(CFLAGS) $(LDFLAGS) -o $@ $^
%.o: %.cpp
$(CPP) $(CFLAGS) -Wno-nullability-completeness -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-private-field -Wno-unused-variable -c -o $@ $<
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: clean clean_compdb
clean:
rm -f $(SPV_FILES)
rm -f $(OBJECTS)
rm -f roleplay
rm -rf $(EXTRA_DEBUG_REQUIREMENTS)
clean_compdb:
rm -rf .compdb
rm compile_commands.json
run: roleplay $(SPV_FILES)
./roleplay
roleplay.dSYM: roleplay
$(DSYM) roleplay
debug: roleplay $(EXTRA_DEBUG_REQUIREMENTS) $(SPV_FILES)
$(GDB) roleplay
%.vert.spv: %.vert
glslangValidator -V -o $@ $<
%.frag.spv: %.frag
glslangValidator -V -o $@ $<
%.comp.spv: %.comp
glslangValidator -V -o $@ $<