diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -2,7 +2,7 @@ CC := clang INCLUDES := -I./include -Ideps/glfw-3.3.8/include/GLFW -Ideps/stb_image CFLAGS := -Wall -Wextra -O2 -fPIC $(INCLUDES) # TODO(low prio): split static object files and shared object files so we can remove -fPIC from static lib builds -LDFLAGS := -lglfw +LDFLAGS := -lglfw -lvulkan # Detect OS UNAME_S := $(shell uname -s) @@ -67,22 +67,27 @@ shared: $(SHARED_LIB) static: $(STATIC_LIB) -# Shaders +# Metal shader compilation +ifeq ($(UNAME_S),Darwin) $(SHADER_OUT_DIR)/%.air: $(SHADER_DIR)/%.metal @mkdir -p $(SHADER_OUT_DIR) xcrun -sdk macosx metal -c $< -o $@ $(METAL_LIB): $(METAL_AIR_FILES) xcrun -sdk macosx metallib $^ -o $(SHADER_OUT_DIR)/default.metallib +endif .PHONY: all all: shared static .PHONY: triangle -triangle: $(EXAMPLES_DIR)/triangle.c $(SHARED_LIB) $(SHADER_OUT_DIR)/triangle.air $(METAL_LIB) +triangle: $(EXAMPLES_DIR)/triangle.c $(SHARED_LIB) # $(SHADER_OUT_DIR)/triangle.air $(METAL_LIB) @mkdir -p $(BUILD_DIR) +ifeq ($(UNAME_S),Darwin) + $(MAKE) $(SHADER_OUT_DIR)/triangle.air $(METAL_LIB) +endif $(CC) $(CFLAGS) $(EXAMPLES_DIR)/triangle.c -L$(BUILD_DIR) -lceleritas $(LDFLAGS) -o $(BUILD_DIR)/triangle.bin - MTL_DEBUG_LAYER=1 build/triangle.bin + MTL_DEBUG_LAYER=1 LD_LIBRARY_PATH=$(BUILD_DIR) build/triangle.bin .PHONY: cube cube: $(EXAMPLES_DIR)/cube.c $(SHARED_LIB) $(SHADER_OUT_DIR)/cube.air $(METAL_LIB) |