-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
47 lines (33 loc) · 1005 Bytes
/
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
# Copyright State Street Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
PROJECT_VERSION=dev
GO_CMD ?= go
LINT_CMD ?= gobin -run github.com/golangci/golangci-lint/cmd/[email protected]
BIN_DIR := $(CURDIR)/bin
CMD_DIR := $(CURDIR)/cmd
PROJECT_NAME = hyperledger/fabric-cli
PKGNAME = github.com/$(PROJECT_NAME)
EXTRA_VERSION ?= $(shell git rev-parse --short HEAD)
# defined in common/metadata/metadata.go
METADATA_VAR = Version=$(PROJECT_VERSION)
METADATA_VAR += CommitSHA=$(EXTRA_VERSION)
GO_LDFLAGS = $(patsubst %,-X $(PKGNAME)/common/metadata.%,$(METADATA_VAR))
export GO111MODULE := on
all: clean build
.PHONY: clean
clean:
rm -rf $(BIN_DIR)
find . -name "mocks" -type d -print0 | xargs -0 /bin/rm -rf
.PHONY: generate
generate:
$(GO_CMD) generate ./...
.PHONY: lint
lint: generate
$(LINT_CMD) run
.PHONY: test
test: generate
$(GO_CMD) test -cover ./...
.PHONY: build
build:
$(GO_CMD) build -o $(BIN_DIR)/fabric -ldflags "$(GO_LDFLAGS)" $(CMD_DIR)/fabric.go