-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (40 loc) · 1.96 KB
/
Copy pathMakefile
File metadata and controls
58 lines (40 loc) · 1.96 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
.PHONY : test unittest clean
PLATFORMS := linux-amd64 windows-amd64.exe darwin-amd64 darwin-arm64 linux-arm linux-arm64 linux-mips linux-mipsle
releasebins := $(addprefix release/gonrg-, $(PLATFORMS))
GONRG_VERSION = $(shell awk -v FS="gonrg=" 'NF>1{print $$2}' VERSIONS)
GO_LDFLAGS := "\
-X 'github.com/lnobach/gonrg/version.GonrgVersion=$(GONRG_VERSION)' \
-extldflags '-static' -w -s"
GOENV :=
GO_FILES := $(wildcard **/*.go)
ALLSRC_FILES := go.mod go.sum VERSIONS $(GO_FILES)
all: gonrg
gonrg: $(ALLSRC_FILES)
$(GOENV) go build -v -ldflags $(GO_LDFLAGS) -o gonrg ./cmd/gonrg/.
gonrg-mock: $(ALLSRC_FILES)
$(GOENV) go build -v -ldflags $(GO_LDFLAGS) -tags gonrgmocks -o gonrg-mock ./cmd/gonrg/.
release: $(releasebins)
release/gonrg-linux-amd64: $(ALLSRC_FILES)
GOOS=linux GOARCH=amd64 go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
release/gonrg-windows-amd64.exe: $(ALLSRC_FILES)
GOOS=windows GOARCH=amd64 go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
release/gonrg-darwin-amd64: $(ALLSRC_FILES)
GOOS=darwin GOARCH=amd64 go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
release/gonrg-darwin-arm64: $(ALLSRC_FILES)
GOOS=darwin GOARCH=arm64 GOARM=8 go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
release/gonrg-linux-arm: $(ALLSRC_FILES)
GOOS=linux GOARCH=arm GOARM=6 go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
release/gonrg-linux-arm64: $(ALLSRC_FILES)
GOOS=linux GOARCH=arm64 GOARM=8 go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
release/gonrg-linux-mips: $(ALLSRC_FILES)
GOOS=linux GOARCH=mips GOMIPS=softfloat go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
release/gonrg-linux-mipsle: $(ALLSRC_FILES)
GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -v -ldflags $(GO_LDFLAGS) -o '$@' ./cmd/gonrg/.
releasegz: $(releasebins)
gzip -v9f $^
test: unittest
unittest:
$(GOENV) go test ./... -coverprofile coverage.out
$(GOENV) go tool cover -func=coverage.out
clean:
rm -f gonrg gonrg-mock release