-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.93 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
56
57
58
59
ARTEFACTSDIR=.
GOCMD=go
GOBUILD=$(GOCMD) build -ldflags "-extldflags '-static'"
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
MAINGO=cmd/main.go
BINARYNAME=gitlab-sanity-cli
TAR=tar czvf
ZIP=zip --junk-paths
SHASUM=shasum
all: setmode clean test build
.PHONY: setmode
setmode:
# $(GOCMD) env -w GO111MODULE=off
build: freebsd darwin linux windows
freebsd: test
@echo "Build FreeBSD AMD64"
env GOOS=freebsd GOARCH=amd64 $(GOBUILD) -o $(ARTEFACTSDIR)/$(BINARYNAME).freebsd $(MAINGO)
linux: test
@echo "Build Linux AMD64"
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(ARTEFACTSDIR)/$(BINARYNAME).linux $(MAINGO)
darwin: test
@echo "Build MacOS AMD64"
env GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(ARTEFACTSDIR)/$(BINARYNAME).darwin $(MAINGO)
windows: test
@echo "Build Windows AMD64"
env GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(ARTEFACTSDIR)/$(BINARYNAME).windows $(MAINGO)
archive:
$(TAR) $(ARTEFACTSDIR)/$(BINARYNAME).freebsd.amd64.tar.gz $(ARTEFACTSDIR)/$(BINARYNAME).freebsd
$(TAR) $(ARTEFACTSDIR)/$(BINARYNAME).linux.amd64.tar.gz $(ARTEFACTSDIR)/$(BINARYNAME).linux
$(TAR) $(ARTEFACTSDIR)/$(BINARYNAME).darwin.amd64.tar.gz $(ARTEFACTSDIR)/$(BINARYNAME).darwin
$(ZIP) $(ARTEFACTSDIR)/$(BINARYNAME).windows.amd64.zip $(ARTEFACTSDIR)/$(BINARYNAME).windows
hash:
$(SHASUM) $(ARTEFACTSDIR)/$(BINARYNAME).freebsd.amd64.tar.gz > $(ARTEFACTSDIR)/$(BINARYNAME).freebsd.amd64.tar.gz.sha256
$(SHASUM) $(ARTEFACTSDIR)/$(BINARYNAME).linux.amd64.tar.gz > $(ARTEFACTSDIR)/$(BINARYNAME).linux.amd64.tar.gz.sha256
$(SHASUM) $(ARTEFACTSDIR)/$(BINARYNAME).darwin.amd64.tar.gz > $(ARTEFACTSDIR)/$(BINARYNAME).darwin.amd64.tar.gz.sha256
$(SHASUM) $(ARTEFACTSDIR)/$(BINARYNAME).windows.amd64.zip > $(ARTEFACTSDIR)/$(BINARYNAME).windows.amd64.zip.sha256
release: archive hash
# dbg-build:
# $(GOBUILD) -v -gcflags=all="-N -l" -tags debug $(MAINFOLDER)
test:
$(GOTEST) -v ./...
clean:
$(GOCLEAN)
@find . -name "gitlab-sanity-cli.*" -type f -delete