-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (25 loc) · 853 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=gotime
INSTALL_DIR=/usr/local/bin
KERNEL := $(shell uname | awk '{print tolower($0)}')
# BUILD_ARGS=-linkshared
ifeq ($(shell uname -m),arm64)
ARCH := arm64
else
ARCH := amd64
endif
tests:
go test ./...
build:
go build ${BUILD_ARGS} -o dist/${BINARY_NAME}-${KERNEL}-${ARCH} main.go
build-all:
GOARCH=amd64 GOOS=darwin go build ${BUILD_ARGS} -o dist/${BINARY_NAME}-darwin-amd64 main.go
GOARCH=amd64 GOOS=linux go build ${BUILD_ARGS} -o dist/${BINARY_NAME}-linux-amd64 main.go
GOARCH=amd64 GOOS=darwin go build ${BUILD_ARGS} -o dist/${BINARY_NAME}-darwin-amd64 main.go
GOARCH=arm64 GOOS=linux go build ${BUILD_ARGS} -o dist/${BINARY_NAME}-linux-arm64 main.go
clean:
go clean
rm dist/*
install: build
cp dist/${BINARY_NAME}-${KERNEL}-${ARCH} ${INSTALL_DIR}/${BINARY_NAME}
uninstall:
rm ${INSTALL_DIR}/${BINARY_NAME}