-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·62 lines (47 loc) · 1.68 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Paths to tools needed in dependencies
GO := $(shell which go)
GIT := $(shell which git)
# Build flags
BUILD_MODULE := $(shell go list -m)
BUILD_FLAGS = -ldflags "-s -w"
# Paths to locations, etc
BUILD_DIR := build
MODEL_DIR := models
CMD_DIR := $(wildcard cmd/*)
# TODO breadchris make this not mac specific
INCLUDE_PATH := "$(realpath third_party/whisper.cpp):/opt/homebrew/include/SDL2"
LIBRARY_PATH := "$(realpath third_party/whisper.cpp):/opt/homebrew/lib"
# Targets
all: clean third_party/whisper cmd
submodule:
@echo Update submodules
#@${GIT} submodule update --init --recursive --remote --force
whisper: submodule
@echo Build whisper
@make -C third_party/whisper.cpp libwhisper.a
@make -C third_party/whisper.cpp stream
model-downloader: submodule mkdir
@echo Build model-downloader
@make -C third_party/whisper.cpp/bindings/go examples/go-model-download
@install third_party/whisper.cpp/bindings/go/build/go-model-download ${BUILD_DIR}
models: model-downloader
@echo Downloading models
@${BUILD_DIR}/go-model-download -out ${MODEL_DIR} ggml-base.en
cmd: third_party/whisper $(wildcard cmd/*)
$(CMD_DIR): dependencies mkdir
@echo Build cmd $(notdir $@)
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} GOOS=darwin GOARCH=arm64 ${GO} build ${BUILD_FLAGS} -o ${BUILD_DIR}/$(notdir $@) ./$@
FORCE:
dependencies:
@test -f "${GO}" && test -x "${GO}" || (echo "Missing go binary" && exit 1)
@test -f "${GIT}" && test -x "${GIT}" || (echo "Missing git binary" && exit 1)
mkdir:
@echo Mkdir ${BUILD_DIR} ${MODEL_DIR}
@install -d ${BUILD_DIR}
@install -d ${MODEL_DIR}
clean:
@echo Clean
@rm -fr $(BUILD_DIR)
@${GIT} submodule deinit --all -f
@${GO} mod tidy
@${GO} clean