forked from kevinanielsen/go-fast-cdn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (28 loc) · 735 Bytes
/
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
BINARY_NAME=go-fast-cdn
OS_NAME := $(shell uname -s | tr A-Z a-z)
ARCH := $(shell arch | tr A-Z a-z | sed 's/^aarch/arm/')
prep:
go mod tidy
go mod download
cd ui && pnpm i
build: build_ui build_bin
build_ui:
pnpm --dir ./ui build
build_bin:
GOARCH=${ARCH} GOOS=darwin CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-darwin
CC="x86_64-linux-musl-gcc" GOARCH=${ARCH} GOOS=linux CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-linux
CC="x86_64-w64-mingw32-gcc" GOARCH=${ARCH} GOOS=windows CGO_ENABLED=0 go build -o bin/${BINARY_NAME}-windows
run: build
ifeq ($(OS_NAME),)
bin/${BINARY_NAME}-windows
else
bin/${BINARY_NAME}-${OS_NAME}
endif
clean:
go clean
rm -rf bin/*
rm -rf ui/build/*
vet:
go vet
test:
go test ./...