-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (23 loc) · 1.16 KB
/
Copy pathMakefile
File metadata and controls
31 lines (23 loc) · 1.16 KB
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
BINARY=zaptecbot
COMMIT_HASH=`git rev-parse --short=8 HEAD 2>/dev/null`
BUILD_TIME=`date +%FT%T%z`
LDFLAGS=-ldflags "-s -w \
-X github.com/metskem/zaptecbot/conf.CommitHash=${COMMIT_HASH} \
-X github.com/metskem/zaptecbot/conf.BuildTime=${BUILD_TIME}"
clean:
go clean
if [ -f ./target/linux_amd64/${BINARY} ] ; then rm ./target/${BINARY}-linux_amd64 ; fi
if [ -f ./target/darwin_amd64/${BINARY} ] ; then rm ./target/${BINARY}-darwin_amd64 ; fi
if [ -f ./target/darwin_arm64/${BINARY} ] ; then rm ./target/${BINARY}-darwin_arm64 ; fi
if [ -f ./target/windows_amd64/${BINARY} ] ; then rm ./target/${BINARY}-windows_amd64 ; fi
release: clean linux_amd64 darwin_amd64 linux_arm64 darwin_arm64
deps:
go get -v ./...
linux_amd64: deps
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o ./target/linux_amd64/${BINARY} ${LDFLAGS} .
darwin_amd64: deps
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o ./target/darwin_amd64/${BINARY} ${LDFLAGS} .
linux_arm64: deps
GOOS=linux GOARCH=arm GOARM=7 go build -o ./target/linux_arm64/${BINARY} ${LDFLAGS} .
darwin_arm64: deps
GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 go build -o ./target/darwin_arm64/${BINARY} ${LDFLAGS} .