2023-01-06 17:32:28 +00:00
|
|
|
BUILD_DIR := build
|
|
|
|
MODELS_DIR := models
|
2022-12-20 06:54:33 +00:00
|
|
|
EXAMPLES_DIR := $(wildcard examples/*)
|
2023-01-06 17:32:28 +00:00
|
|
|
INCLUDE_PATH := $(abspath ../..)
|
|
|
|
LIBRARY_PATH := $(abspath ../..)
|
2022-12-20 06:54:33 +00:00
|
|
|
|
|
|
|
all: clean whisper examples
|
|
|
|
|
|
|
|
whisper: mkdir
|
|
|
|
@echo Build whisper
|
2023-01-06 17:32:28 +00:00
|
|
|
@${MAKE} -C ../.. libwhisper.a
|
2022-12-20 06:54:33 +00:00
|
|
|
|
2022-12-22 14:34:20 +00:00
|
|
|
test: model-small whisper modtidy
|
2023-01-06 17:32:28 +00:00
|
|
|
@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/...
|
2022-12-20 06:54:33 +00:00
|
|
|
|
|
|
|
examples: $(EXAMPLES_DIR)
|
|
|
|
|
|
|
|
model-small: mkdir examples/go-model-download
|
2023-01-06 17:32:28 +00:00
|
|
|
@${BUILD_DIR}/go-model-download -out models ggml-small.en.bin
|
2022-12-20 06:54:33 +00:00
|
|
|
|
2022-12-22 14:34:20 +00:00
|
|
|
$(EXAMPLES_DIR): mkdir whisper modtidy
|
2022-12-20 06:54:33 +00:00
|
|
|
@echo Build example $(notdir $@)
|
2023-01-06 17:32:28 +00:00
|
|
|
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go build ${BUILD_FLAGS} -o ${BUILD_DIR}/$(notdir $@) ./$@
|
2022-12-20 06:54:33 +00:00
|
|
|
|
|
|
|
mkdir:
|
|
|
|
@echo Mkdir ${BUILD_DIR}
|
|
|
|
@install -d ${BUILD_DIR}
|
|
|
|
@echo Mkdir ${MODELS_DIR}
|
|
|
|
@install -d ${MODELS_DIR}
|
|
|
|
|
2022-12-22 14:34:20 +00:00
|
|
|
modtidy:
|
|
|
|
@go mod tidy
|
|
|
|
|
2023-06-25 11:07:55 +00:00
|
|
|
clean:
|
2022-12-20 06:54:33 +00:00
|
|
|
@echo Clean
|
|
|
|
@rm -fr $(BUILD_DIR)
|
|
|
|
@go clean
|