-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (28 loc) · 1.06 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
PROJECT_NAME ?= whispergo
OUTPUT := build/bin/$(PROJECT_NAME)
UPX_EXECUTABLE := upx
MODEL_FILE := ggml-tiny-q5_1.bin
MODEL_URL := https://huggingface.co/ggerganov/whisper.cpp/resolve/main/$(MODEL_FILE)
ifeq ($(WHISPER_CUDA), 1)
CUDA_PATH ?= /usr/local/cuda
CUDA_LIBPATH ?= $(CUDA_PATH)/lib64
CGO_LDFLAGS += -lcublas -lcudart -lcuda -L$(CUDA_LIBPATH) -L$(CUDA_LIBPATH)/stubs
endif
CC ?= gcc
INCLUDE_PATH := $(abspath external/whisper.cpp)
LIBRARY_PATH := $(abspath external/whisper.cpp)
.PHONY: whisper release compressed dev clean
whisper:
echo Build whisper
@${MAKE} CC=$(CC) -C external/whisper.cpp libwhisper.a
models/$(MODEL_FILE):
echo Download tiny model
@wget -q -nc $(MODEL_URL) -P models
release: whisper models/$(MODEL_FILE)
CGO_LDFLAGS="$(CGO_LDFLAGS)" C_INCLUDE_PATH=$(INCLUDE_PATH) LIBRARY_PATH=$(LIBRARY_PATH) wails build $(BUILD_ARGS) -o $(PROJECT_NAME)
dev: whisper models/$(MODEL_FILE)
C_INCLUDE_PATH=$(INCLUDE_PATH) LIBRARY_PATH=$(LIBRARY_PATH) wails dev
clean:
rm -rf build/bin
@${MAKE} -C external/whisper.cpp clean
.DEFAULT_GOAL := release