-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
55 lines (42 loc) · 1.09 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
# Requirements: git, go, vgo
NAME := gitpanda
VERSION := $(shell cat VERSION)
REVISION := $(shell git rev-parse --short HEAD)
SRCS := $(shell find . -type f -name '*.go')
LDFLAGS := "-s -w -X \"main.Version=$(VERSION)\" -X \"main.Revision=$(REVISION)\" -extldflags \"-static\""
.DEFAULT_GOAL := bin/$(NAME)
bin/$(NAME): $(SRCS)
GO111MODULE=on go build -ldflags=$(LDFLAGS) -o bin/$(NAME)
.PHONY: linux_amd64
linux_amd64: $(SRCS)
GO111MODULE=on GOOS=linux GOARCH=amd64 go build -ldflags=$(LDFLAGS) -o bin/$(NAME)_linux_amd64
.PHONY: gox
gox:
gox -osarch="$${GOX_OSARCH}" -ldflags=$(LDFLAGS) -output="bin/gitpanda_{{.OS}}_{{.Arch}}"
.PHONY: zip
zip:
cd bin ; \
for file in *; do \
zip $${file}.zip $${file} ; \
done
.PHONY: gox_with_zip
gox_with_zip: clean gox zip
.PHONY: clean
clean:
rm -rf bin/*
.PHONY: tag
tag:
git tag -a $(VERSION) -m "Release $(VERSION)"
git push --tags
.PHONY: release
release: tag
git push origin main
.PHONY: test
test:
go test -count=1 $${TEST_ARGS} ./...
.PHONY: testrace
testrace:
go test -count=1 $${TEST_ARGS} -race ./...
.PHONY: fmt
fmt:
go fmt ./...