Skip to content

Commit

Permalink
Fixed Makefile for MacOS ARM 64 based on ggerganov#1344 + proper ggml…
Browse files Browse the repository at this point in the history
…-metal env var setting
  • Loading branch information
gleicon committed Nov 20, 2023
1 parent eff3570 commit cbd284d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bindings/go/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
GGML_METAL_PATH_RESOURCES := $(abspath ../..)
BUILD_DIR := build
MODELS_DIR := models
EXAMPLES_DIR := $(wildcard examples/*)
INCLUDE_PATH := $(abspath ../..)
LIBRARY_PATH := $(abspath ../..)
EXT_LDFLAGS := -framework Foundation -framework Metal -framework MetalKit

all: clean whisper examples

Expand All @@ -11,17 +13,18 @@ whisper: mkdir
@${MAKE} -C ../.. libwhisper.a

test: model-small whisper modtidy
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go test -v .
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go test -v ./pkg/whisper/...

@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} GGML_METAL_PATH_RESOURCES=${GGML_METAL_PATH_RESOURCES} go test -ldflags "-extldflags '$(EXT_LDFLAGS)'" -v .
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} GGML_METAL_PATH_RESOURCES=${GGML_METAL_PATH_RESOURCES} go test -ldflags "-extldflags '$(EXT_LDFLAGS)'" -v ./pkg/whisper/...
examples: $(EXAMPLES_DIR)

model-small: mkdir examples/go-model-download
@${BUILD_DIR}/go-model-download -out models ggml-small.en.bin

$(EXAMPLES_DIR): mkdir whisper modtidy
@echo Build example $(notdir $@)
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go build ${BUILD_FLAGS} -o ${BUILD_DIR}/$(notdir $@) ./$@
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} GGML_METAL_PATH_RESOURCES=${GGML_METAL_PATH_RESOURCES} go build ${BUILD_FLAGS} -ldflags "-extldflags '$(EXT_LDFLAGS)'" -o ${BUILD_DIR}/$(notdir $@) ./$@


mkdir:
@echo Mkdir ${BUILD_DIR}
Expand Down

0 comments on commit cbd284d

Please sign in to comment.