From fa9621e5e90d7674a12b2aa54c73d8aeeb1944b1 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov <ggerganov@gmail.com> Date: Sat, 12 Nov 2022 08:32:03 +0200 Subject: [PATCH] mtl : update Makefile to support Metal --- Makefile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c20bd551..523b1626 100644 --- a/Makefile +++ b/Makefile @@ -58,8 +58,8 @@ endif ifndef WHISPER_NO_ACCELERATE # Mac M1 - include Accelerate framework ifeq ($(UNAME_S),Darwin) - CFLAGS += -DGGML_USE_ACCELERATE - LDFLAGS += -framework Accelerate + CFLAGS += -DGGML_USE_ACCELERATE -DGGML_PERF + LDFLAGS += -framework Foundation -framework Accelerate -framework Metal -framework MetalKit -framework MetalPerformanceShaders endif endif ifneq ($(filter aarch64%,$(UNAME_M)),) @@ -81,18 +81,21 @@ endif # Build library + main # -main: examples/main/main.cpp ggml.o whisper.o - $(CXX) $(CXXFLAGS) examples/main/main.cpp whisper.o ggml.o -o main $(LDFLAGS) +main: examples/main/main.cpp ggml.o ggml-mtl.o whisper.o + $(CXX) $(CXXFLAGS) examples/main/main.cpp whisper.o ggml.o ggml-mtl.o -o main $(LDFLAGS) ./main -h ggml.o: ggml.c ggml.h $(CC) $(CFLAGS) -c ggml.c -o ggml.o +ggml-mtl.o: ggml-mtl.m ggml-mtl.h + $(CC) $(CFLAGS) -c ggml-mtl.m -o ggml-mtl.o + whisper.o: whisper.cpp whisper.h $(CXX) $(CXXFLAGS) -c whisper.cpp -o whisper.o -libwhisper.a: ggml.o whisper.o - $(AR) rcs libwhisper.a ggml.o whisper.o +libwhisper.a: ggml.o ggml-mtl.o whisper.o + $(AR) rcs libwhisper.a ggml.o ggml-mtl.o whisper.o clean: rm -f *.o main stream bench libwhisper.a