-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (30 loc) · 1010 Bytes
/
Copy pathMakefile
File metadata and controls
45 lines (30 loc) · 1010 Bytes
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
NAME=uddns
ENTRIES=.
BINDIR=bin
VERSION?=dev
GIT_REV=$$(git rev-parse HEAD)
BUILD_TIME=$$(date -Iseconds)
BUILD_OPTS=-trimpath
LDFLAGS+=-s -w -X main.version=${VERSION}
BUILD_OPTS+=-ldflags="${LDFLAGS}"
.PHONY: default build clean darwin-amd64 linux-amd64 all test cov
build: clean
go build -o ${BINDIR}/${NAME} ${ENTRIES}
release-build: clean
go build ${BUILD_OPTS} ${GCFLAGS} -o ${NAME} ${ENTRIES}
clean:
@rm -rf ${BINDIR} || true
darwin-amd64:
GOARCH=amd64 GOOS=darwin go build ${BUILD_OPTS} -o ${BINDIR}/${NAME}-darwin-amd64 ${ENTRIES}
darwin-arm64:
GOARCH=arm64 GOOS=darwin go build ${BUILD_OPTS} -o ${BINDIR}/${NAME}-darwin-arm64 ${ENTRIES}
linux-amd64:
GOARCH=amd64 GOOS=linux go build ${BUILD_OPTS} -o ${BINDIR}/${NAME}-linux-amd64 ${ENTRIES}
linux-arm64:
GOARCH=arm64 GOOS=linux go build ${BUILD_OPTS} -o ${BINDIR}/${NAME}-linux-arm64 ${ENTRIES}
all: clean linux-amd64 linux-arm64 darwin-amd64 darwin-arm64
test:
go test ./...
cov:
go test ./... -coverpkg=./...
default: build