forked from Hyperledger-TWGC/tape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (43 loc) · 1.54 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
# -------------------------------------------------------------
# This makefile defines the following targets
# - tape - builds a binary program
# - docker - build the tape image
# - unit-test - runs the go-test based unit tests
# - integration-test - runs the integration tests
FABRIC_VERSION = latest
INTERGATION_CASE = ANDLogic
BASE_VERSION = 0.0.2
PREV_VERSION = 0.0.1
PROJECT_NAME = tape
DOCKERIMAGE = guoger/tape
export DOCKERIMAGE
EXTRA_VERSION ?= $(shell git rev-parse --short HEAD)
BuiltTime ?= $(shell date)
PROJECT_VERSION=$(BASE_APISERVER_VERSION)-snapshot-$(EXTRA_VERSION)
PKGNAME = github.com/guoger/$(PROJECT_NAME)
CGO_FLAGS = CGO_CFLAGS=" "
ARCH=$(shell go env GOARCH)
MARCH=$(shell go env GOOS)-$(shell go env GOARCH)
# defined in pkg/infra/version.go
METADATA_VAR = Version=$(BASE_VERSION)
METADATA_VAR += CommitSHA=$(EXTRA_VERSION)
GO_LDFLAGS = $(patsubst %,-X $(PROJECT_NAME)/pkg/infra.%,$(METADATA_VAR))
GO_LDFLAGS += -X '$(PROJECT_NAME)/pkg/infra.BuiltTime=$(BuiltTime)'
GO_TAGS ?=
export GO_LDFLAGS GO_TAGS FABRIC_VERSION INTERGATION_CASE
#.PHONY: tape
tape:
@echo "Building tape program......"
go build -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" ./cmd/tape
.PHONY: docker
docker:
@echo "Building tape docker......"
docker build .
.PHONY: unit-test
unit-test:
@echo "Run unit test......"
go test -v ./... --bench=. -cover
.PHONY: integration-test
integration-test:
@echo "Run integration test......"
./test/integration-test.sh $(FABRIC_VERSION) $(INTERGATION_CASE)