-
Notifications
You must be signed in to change notification settings - Fork 135
/
Makefile
55 lines (45 loc) · 1.82 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
BINARY_DEFAULT="build/myurls"
BINARY_LINUX="build/myurls-linux-amd64"
BINARY_DARWIN="build/myurls-darwin-amd64"
BINARY_DARWIN_ARM64="build/myurls-darwin-arm64"
BINARY_WINDOWS="build/myurls-windows-x64"
BINARY_ARM64="build/myurls-linux-arm64"
VERSION=1.0.0
BUILD=`date +%FT%T%z`
default:
@echo ${BINARY_DEFAULT}
@CGO_ENABLED=0 go build -ldflags="-s -w" -o ${BINARY_DEFAULT}
all:
@echo ${BINARY_LINUX}
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ${BINARY_LINUX}
# @echo ${BINARY_DARWIN}
# @CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ${BINARY_DARWIN}
# @echo ${BINARY_DARWIN_ARM64}
# @CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o ${BINARY_DARWIN_ARM64}
@echo ${BINARY_WINDOWS}
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o ${BINARY_WINDOWS}
@echo ${BINARY_ARM64}
@CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ${BINARY_ARM64}
linux:
@echo ${BINARY_LINUX}
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ${BINARY_LINUX}
darwin:
@echo ${BINARY_DARWIN}
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ${BINARY_DARWIN}
windows:
@echo ${BINARY_WINDOWS}
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o ${BINARY_WINDOWS}
aarch64:
@echo ${BINARY_ARM64}
@CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o ${BINARY_ARM64}
install:
@go mod tidy
fmt:
@go fmt ./...
clean:
@if [ -f ${BINARY_DEFAULT} ] ; then rm ${BINARY_DEFAULT} ; fi
@if [ -f ${BINARY_LINUX} ] ; then rm ${BINARY_LINUX} ; fi
@if [ -f ${BINARY_DARWIN} ] ; then rm ${BINARY_DARWIN} ; fi
@if [ -f ${BINARY_DARWIN_ARM64} ] ; then rm ${BINARY_DARWIN_ARM64} ; fi
@if [ -f ${BINARY_WINDOWS} ] ; then rm ${BINARY_WINDOWS} ; fi
@if [ -f ${BINARY_ARM64} ] ; then rm ${BINARY_ARM64} ; fi