-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
71 lines (53 loc) · 1.47 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
66
67
68
69
70
71
# Requirements: git, go, vgo
PACKAGE := github.com/sue445/plant_erd
NAME := plant_erd
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)\""
.DEFAULT_GOAL := bin/$(NAME)
export GO111MODULE ?= on
bin/%: cmd/%/main.go
go build -ldflags=$(LDFLAGS) -o bin/$(NAME) -o $@ $<
.PHONY: build
build: bin/plant_erd
.PHONY: build-oracle
build-oracle: bin/plant_erd-oracle
.PHONY: gox-plant_erd
gox-plant_erd:
gox -osarch="$${GOX_OSARCH}" -ldflags=$(LDFLAGS) -output="bin/$(NAME)_{{.OS}}_{{.Arch}}" $(PACKAGE)/cmd/plant_erd
.PHONY: gox-plant_erd-oracle
gox-plant_erd-oracle:
gox -osarch="$${GOX_OSARCH}" -ldflags=$(LDFLAGS) -output="bin/$(NAME)-oracle_{{.OS}}_{{.Arch}}" -cgo $(PACKAGE)/cmd/plant_erd-oracle
.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 master
.PHONY: test
test:
go test -count=1 $${TEST_ARGS} ./...
.PHONY: testrace
testrace:
go test -count=1 $${TEST_ARGS} -race ./...
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: integration_test
integration_test: build build-oracle
go test _integration/check_readme_test.go
.PHONY: test_all
test_all: test testrace fmt integration_test