-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
36 lines (31 loc) · 1.66 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
.PHONY: default build clean install build-all
default: build
build:
go build -o build/bin/basic examples/basic/main.go
go build -o build/bin/text-generation examples/text-generation/main.go
go build -o build/bin/hosted-models examples/hosted-models/main.go
clean:
go clean
rm -rf build/*
mkdir -p build/bin
touch build/bin/.gitkeep
install: build
cp ./build/bin/basic /usr/local/bin/basic
cp ./build/bin/text-generation /usr/local/bin/text-generation
cp ./build/bin/hosted-models /usr/local/bin/hosted-models
NAME := hosted-models
MAIN_SRC := examples/hosted-models/main.go
build-all: clean default
mkdir -p build/package/$(NAME)-macos build/package/$(NAME)-windows build/package/$(NAME)-linux-x64 build/package/$(NAME)-linux-arm7 build/package/$(NAME)-linux-arm6
GOOS=darwin GOARCH=amd64 go build -o build/package/$(NAME)-macos/$(NAME) $(MAIN_SRC)
GOOS=windows GOARCH=amd64 go build -o build/package/$(NAME)-windows/$(NAME) $(MAIN_SRC)
GOOS=linux GOARCH=amd64 go build -o build/package/$(NAME)-linux-x64/$(NAME) $(MAIN_SRC)
GOOS=linux GOARCH=arm GOARM=7 go build -o build/package/$(NAME)-linux-arm7/$(NAME) $(MAIN_SRC)
GOOS=linux GOARCH=arm GOARM=6 go build -o build/package/$(NAME)-linux-arm6/$(NAME) $(MAIN_SRC)
cd build/package/ && \
tar czf $(NAME)-linux-x64.tar.gz $(NAME)-linux-x64/ && \
tar czf $(NAME)-linux-arm7.tar.gz $(NAME)-linux-arm7/ && \
tar czf $(NAME)-linux-arm6.tar.gz $(NAME)-linux-arm6/ && \
zip -r -9 $(NAME)-macos.zip $(NAME)-macos/ && \
zip -r -9 $(NAME)-windows.zip $(NAME)-windows/
rm -rf build/package/$(NAME)-macos build/package/$(NAME)-windows build/package/$(NAME)-linux-x64 build/package/$(NAME)-linux-arm7 build/package/$(NAME)-linux-arm6