-
Notifications
You must be signed in to change notification settings - Fork 606
/
Makefile
65 lines (56 loc) · 3.52 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
60
61
62
63
64
65
.SILENT :
.PHONY : docker-gen clean fmt
TAG:=`git describe --tags`
LDFLAGS:=-X main.buildVersion=$(TAG)
all: docker-gen
docker-gen:
echo "Building docker-gen"
go build -ldflags "$(LDFLAGS)" ./cmd/docker-gen
dist-clean:
rm -rf dist
rm -f docker-gen-alpine-linux-*.tar.gz
rm -f docker-gen-linux-*.tar.gz
rm -f docker-gen-darwin-*.tar.gz
rm -f docker-gen-windows-*.tar.gz
dist: dist-clean
mkdir -p dist/alpine-linux/amd64 && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/alpine-linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/arm64/docker-gen ./cmd/docker-gen
mkdir -p dist/alpine-linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -a -tags netgo -installsuffix netgo -o dist/alpine-linux/armhf/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/amd64 && GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/linux/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/arm64 && GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/linux/arm64/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/i386 && GOOS=linux GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/linux/i386/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/armel && GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o dist/linux/armel/docker-gen ./cmd/docker-gen
mkdir -p dist/linux/armhf && GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -o dist/linux/armhf/docker-gen ./cmd/docker-gen
mkdir -p dist/darwin/amd64 && GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/darwin/amd64/docker-gen ./cmd/docker-gen
mkdir -p dist/darwin/arm64 && GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o dist/darwin/arm64/docker-gen ./cmd/docker-gen
mkdir -p dist/windows/i386 && GOOS=windows GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/windows/i386/docker-gen ./cmd/docker-gen
mkdir -p dist/windows/amd64 && GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/windows/amd64/docker-gen ./cmd/docker-gen
release: dist
go mod tidy
tar -cvzf docker-gen-alpine-linux-amd64-$(TAG).tar.gz -C dist/alpine-linux/amd64 docker-gen
tar -cvzf docker-gen-alpine-linux-arm64-$(TAG).tar.gz -C dist/alpine-linux/arm64 docker-gen
tar -cvzf docker-gen-alpine-linux-armhf-$(TAG).tar.gz -C dist/alpine-linux/armhf docker-gen
tar -cvzf docker-gen-linux-amd64-$(TAG).tar.gz -C dist/linux/amd64 docker-gen
tar -cvzf docker-gen-linux-arm64-$(TAG).tar.gz -C dist/linux/arm64 docker-gen
tar -cvzf docker-gen-linux-i386-$(TAG).tar.gz -C dist/linux/i386 docker-gen
tar -cvzf docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen
tar -cvzf docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen
tar -cvzf docker-gen-darwin-amd64-$(TAG).tar.gz -C dist/darwin/amd64 docker-gen
tar -cvzf docker-gen-darwin-arm64-$(TAG).tar.gz -C dist/darwin/arm64 docker-gen
tar -cvzf docker-gen-windows-amd64-$(TAG).tar.gz -C dist/windows/amd64 docker-gen
tar -cvzf docker-gen-windows-i386-$(TAG).tar.gz -C dist/windows/i386 docker-gen
get-deps:
go mod download
check-gofmt:
if [ -n "$(shell go fmt ./cmd/...)" ]; then \
echo 1>&2 'The following files need to be formatted:'; \
gofmt -l ./cmd/docker-gen; \
exit 1; \
fi
if [ -n "$(shell go fmt ./internal/...)" ]; then \
echo 1>&2 'The following files need to be formatted:'; \
gofmt -l ./internal; \
exit 1; \
fi
test:
go test -race ./internal/...