56 lines
1.4 KiB
Makefile
56 lines
1.4 KiB
Makefile
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
|
CFLAGS = -I $(ROOT_DIR)/include -I/usr/local/include -O0 -g -Wall -Wextra
|
|
LDFLAGS = -L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/lib -lglfw -lvulkan -ldl -Xlinker -rpath -Xlinker /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
|
|
|
|
SOURCES = src/main.c src/render.c src/vma.cpp src/pipeline.c src/command.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)))
|
|
|
|
export MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=1
|
|
|
|
.PHONY: all
|
|
all: roleplay $(VERT_SPV) $(FRAG_SPV)
|
|
|
|
roleplay: $(OBJECTS)
|
|
$(CPP) $(CFLAGS) $(LDFLAGS) -o $@ $^
|
|
|
|
%.o: %.cpp
|
|
$(CPP) $(CFLAGS) -c -o $@ $<
|
|
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
.PHONY: clean clean_compdb
|
|
|
|
clean:
|
|
rm -f $(FRAG_SPV)
|
|
rm -f $(VERT_SPV)
|
|
rm -f $(OBJECTS)
|
|
rm -f roleplay
|
|
rm -rf roleplay.dSYM
|
|
|
|
clean_compdb:
|
|
rm -rf .compdb
|
|
rm compile_commands.json
|
|
|
|
run: roleplay $(VERT_SPV) $(FRAG_SPV)
|
|
./roleplay
|
|
|
|
roleplay.dSYM: roleplay
|
|
$(DSYM) roleplay
|
|
|
|
debug: roleplay roleplay.dSYM $(VERT_SPV) $(FRAG_SPV)
|
|
$(GDB) roleplay
|
|
|
|
|
|
%.vert.spv: %.vert
|
|
glslangValidator -V -o $@ $<
|
|
|
|
%.frag.spv: %.frag
|
|
glslangValidator -V -o $@ $<
|