Made makefile compile on macos/linux

main
noah metz 2024-10-15 10:37:56 -06:00
parent 6e778e7d22
commit 77c83b21a1
1 changed files with 20 additions and 7 deletions

@ -1,10 +1,6 @@
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
CFLAGS = -I $(ROOT_DIR)/include -I/usr/local/include -O0 -g -Wall -Wextra 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 -lz -lglfw -lvulkan -ldl -Xlinker -rpath -Xlinker /opt/homebrew/lib LDFLAGS = -lz -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 src/spng.c SOURCES = src/main.c src/render.c src/vma.cpp src/pipeline.c src/command.c src/spng.c
OBJECTS = $(addsuffix .o, $(basename $(SOURCES))) OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))
@ -13,6 +9,23 @@ FRAG_SPV = $(addsuffix .frag.spv, $(basename $(wildcard shader_src/*.frag)))
COMP_SPV = $(addsuffix .comp.spv, $(basename $(wildcard shader_src/*.comp))) COMP_SPV = $(addsuffix .comp.spv, $(basename $(wildcard shader_src/*.comp)))
SPV_FILES = $(VERT_SPV) $(FRAG_SPV) $(COMP_SPV) 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 export MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS=1
.PHONY: all .PHONY: all
@ -33,7 +46,7 @@ clean:
rm -f $(SPV_FILES) rm -f $(SPV_FILES)
rm -f $(OBJECTS) rm -f $(OBJECTS)
rm -f roleplay rm -f roleplay
rm -rf roleplay.dSYM rm -rf $(EXTRA_DEBUG_REQUIREMENTS)
clean_compdb: clean_compdb:
rm -rf .compdb rm -rf .compdb
@ -45,7 +58,7 @@ run: roleplay $(SPV_FILES)
roleplay.dSYM: roleplay roleplay.dSYM: roleplay
$(DSYM) roleplay $(DSYM) roleplay
debug: roleplay roleplay.dSYM $(SPV_FILES) debug: roleplay $(EXTRA_DEBUG_REQUIREMENTS) $(SPV_FILES)
$(GDB) roleplay $(GDB) roleplay
%.vert.spv: %.vert %.vert.spv: %.vert