【翻译】fabric工程项目构建Makefile翻译及解析

Makefile是构建编译fabric的入口,了解项目的构建过程,对整个工程了解以及做项目定制化都有意义。对Makefile立面的部分注释和命令做了翻译和一定阐述。 因水平有限,对疏漏和理解错误欢迎指正和交流探讨。


# Copyright IBM Corp All Rights Reserved.
# Copyright London Stock Exchange Group All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# -------------------------------------------------------------
# This makefile defines the following targets
#
# - all (default) - builds all targets and runs all tests/checks
# 创建所有目标,并且运行测试/检查
# - checks - runs all tests/checks
# 运行所有的测试和检查
# - desk-check - runs linters and verify to test changed packages
# 运行linters和verify来测试更改的包
# - configtxgen - builds a native configtxgen binary
# 创建configtxgen
# - configtxlator - builds a native configtxlator binary
# 创建configtxlator
# - cryptogen - builds a native cryptogen binary
# 创建cryptogen
# - peer - builds a native fabric peer binary
# 创建fabric
# - orderer - builds a native fabric orderer binary
# 创建orderer
# - release - builds release packages for the host platform
# 为主机平台创建发布包
# - release-all - builds release packages for all target platforms
# 为所有目标平台创建发布包
# - unit-test - runs the go-test based unit tests
# 运行基于go-test的单元测试
# - verify - runs unit tests for only the changed package tree
# 为更改过的包路径运行单元测试
# - test-cmd - generates a "go test" string suitable for manual customization
# 创建一个go test的字符串,可以用这个字符串来做自定义配置
# - behave - runs the behave test
# 运行行为(behave)测试
# - behave-deps - ensures pre-requisites are available for running behave manually
# 确保有合适先行依赖条件来手动运行behave
# - gotools - installs go tools like golint
# 安装go tools,比如golint等
# - linter - runs all code checks
# 运行所有代码检查
# - license - checks go sourrce files for Apache license header
# 检查go源文件是否含有Apache许可头部
# - native - ensures all native binaries are available
# 检查所有本地运行程序是否有效
# - docker[-clean] - ensures all docker images are available[/cleaned]
# 确保所有docker镜像是有效的(-clean 被清除的)
# - peer-docker[-clean] - ensures the peer container is available[/cleaned]
# 确保所有的peer容器是有效的(清除的)
# - orderer-docker[-clean] - ensures the orderer container is available[/cleaned]
# 确保所有的orderer容器是有效的(清除的)
# - tools-docker[-clean] - ensures the tools container is available[/cleaned]
# 确保工具容器是有效的(清除的)
# - protos - generate all protobuf artifacts based on .proto files
# 基于.proto文件产生所有的protobuf的artifacts
# - clean - cleans the build area
# 清除工作区间
# - clean-all - superset of 'clean' that also removes persistent state
# 为clean命令的超集,除了clean能够做的事情外,还能够清除持久化的状态
# - dist-clean - clean release packages for all target platforms
# 清除所有目标平台的发布包
# - unit-test-clean - cleans unit test state (particularly from docker)
# 清除所有的单元测试状态(特别是docker)

#项目名称
PROJECT_NAME = hyperledger/fabric
#基准版本
BASE_VERSION = 1.0.0-rc2
#先前版本
PREV_VERSION = 1.0.0-rc1
#是否发布
IS_RELEASE = false

#根据是否是发布版本来绝对工程版本
ifneq ($(IS_RELEASE),true)
EXTRA_VERSION ?= snapshot-$(shell git rev-parse --short HEAD)
PROJECT_VERSION=$(BASE_VERSION)-$(EXTRA_VERSION)
else
PROJECT_VERSION=$(BASE_VERSION)
endif

#包名称
PKGNAME = github.com/$(PROJECT_NAME)
CGO_FLAGS = CGO_CFLAGS=" "
#平台名称(X86_64)
ARCH=$(shell uname -m)
#平台名称(darwin_amd64)
MARCH=$(shell go env GOOS)-$(shell go env GOARCH)
#链工具发布版本 v0.10.3
CHAINTOOL_RELEASE=v0.10.3
#基础镜像的发布版本 0.3.1
BASEIMAGE_RELEASE=$(shell cat ./.baseimage-release)

# defined in common/metadata/metadata.go
METADATA_VAR = Version=$(PROJECT_VERSION)
METADATA_VAR += BaseVersion=$(BASEIMAGE_RELEASE)
METADATA_VAR += BaseDockerLabel=$(BASE_DOCKER_LABEL)
METADATA_VAR += DockerNamespace=$(DOCKER_NS)
METADATA_VAR += BaseDockerNamespace=$(BASE_DOCKER_NS)

#patsubst 模式替换
#
GO_LDFLAGS = $(patsubst %,-X $(PKGNAME)/common/metadata.%,$(METADATA_VAR))

GO_TAGS ?=

#链工具下载链接
CHAINTOOL_URL ?= https://github.com/hyperledger/fabric-chaintool/releases/download/$(CHAINTOOL_RELEASE)/chaintool

export GO_LDFLAGS

#检查依赖,需要go docker git curl 环境
EXECUTABLES = go docker git curl
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH: Check dependencies")))

#go的shim依赖
GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh $(PKGNAME)/core/chaincode/shim)
#java的shim依赖
JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
#找到*.proto带vendor(并没有找到)
PROTOS = $(shell git ls-files *.proto | grep -v vendor)
# No sense rebuilding when non production code is changed
#所有的工程文件,这里并不包括test,git,example,dev等等不相关的东西
#这样就不会再这些东西变动的时候重建工程
#后面构建工程的时候回查看这些文件的变动情况
PROJECT_FILES = $(shell git ls-files | grep -v ^test | grep -v ^unit-test | \
grep -v ^bddtests | grep -v ^docs | grep -v _test.go$ | grep -v .md$ | \
grep -v ^.git | grep -v ^examples | grep -v ^devenv | grep -v .png$ | \
grep -v ^LICENSE )
#发布模板(docker )
RELEASE_TEMPLATES = $(shell git ls-files | grep "release/templates")

#镜像名称列表
IMAGES = peer orderer ccenv javaenv buildenv testenv zookeeper kafka couchdb tools
#发布平台列表
RELEASE_PLATFORMS = windows-amd64 darwin-amd64 linux-amd64 linux-ppc64le linux-s390x
#发布包列表
RELEASE_PKGS = configtxgen cryptogen configtxlator peer orderer

pkgmap.cryptogen := $(PKGNAME)/common/tools/cryptogen
pkgmap.configtxgen := $(PKGNAME)/common/configtx/tool/configtxgen
pkgmap.configtxlator := $(PKGNAME)/common/tools/configtxlator
pkgmap.peer := $(PKGNAME)/peer
pkgmap.orderer := $(PKGNAME)/orderer
pkgmap.block-listener := $(PKGNAME)/examples/events/block-listener
pkgmap.cryptogen := $(PKGNAME)/common/tools/cryptogen

#包含docker-env.mk,参看对应的翻译
include docker-env.mk

#阐述DUMMY含义
#
# What is a .dummy file?
# 什么是.dummy file
#
# Make 是基于文件来工作的。它使用文件的存在位和时间戳来决定给定的目标是否需要被重建。
# 而Docker build产生的输出并不能转换为标准的文件(事实上,产生的images是由docker自己在系统中维护的,在工程项目中并不可见),
# 这会对makefile的运行机制造成影响。
# 所以需要在中间做一下适配,来欺骗Makefile,让他们协同工作正常。
# 我们是这么做的:
# my-docker-target/.dummy:
# docker build ...
# touch $@

# Make is designed to work with files. It uses the presence (or lack thereof)
# and timestamps of files when deciding if a given target needs to be rebuilt.
# Docker containers throw a wrench into the works because the output of docker
# builds do not translate into standard files that makefile rules can evaluate.
# Therefore, we have to fake it. We do this by constructioning our rules such
# as
# my-docker-target/.dummy:
# docker build ...
# touch $@
#
# 如果docker-build成功了,则touch命令会创建/更新.dummy文件。如果失败了,则touch命令就
# 不会运行。这说明.dummy文件相对来说和对应的容器是保持对应关系的。
# If the docker-build succeeds, the touch operation creates/updates the .dummy
# file. If it fails, the touch command never runs. This means the .dummy
# file follows relatively 1:1 with the underlying container.
#
# 尽管如此,这个方法并不完美。比如有人用docker-rmi方式删除了容器,make就会被欺骗,以为
# 当前的情况是满足依赖要求的,但实际情况并不满足要求(因为image从外面被删除了)。但。。。
# 原谅我们吧,这是我们能想到的最好的办法了。。。
# This isn't perfect, however. For instance, someone could delete a docker
# container using docker-rmi outside of the build, and make would be fooled
# into thinking the dependency is statisfied when it really isn't. This is
# our closest approximation we can come up with.
#
# 顺带一说,我们把.dummy文件合并了版本号,来区分不同的tags。用来解决FAB-1145问题
# As an aside, also note that we incorporate the version number in the .dummy
# file to differentiate different tags to fix FAB-1145
#

#makefile 依赖
# all 依赖native docker checks,all一下,检查,生成docker,生成本地
all: native docker checks

checks: license spelling linter unit-test behave

desk-check: license spelling linter verify behave

#以下定义伪目标
.PHONY: spelling
spelling:
@scripts/check_spelling.sh

.PHONY: license
license:
@scripts/check_license.sh

#构建gotools工具集,并且将工具二进制运行文件拷贝到build/bin当中等待使用
.PHONY: gotools
gotools:
mkdir -p build/bin
cd gotools && $(MAKE) install BINDIR=$(GOPATH)/bin

#清除gotools生成
.PHONY: gotools-clean
gotools-clean:
cd gotools && $(MAKE) clean

# This is a legacy target left to satisfy existing CI scripts
membersrvc-image:
@echo "membersrvc has been removed from this build"

#这里peer,orderer,configtxgen等使用了伪目标,所以不管如何,单独运行这些都会执行构建
.PHONY: peer
peer: build/bin/peer
peer-docker: build/image/peer/$(DUMMY)

.PHONY: orderer
orderer: build/bin/orderer
orderer-docker: build/image/orderer/$(DUMMY)

.PHONY: configtxgen
configtxgen: GO_TAGS+= nopkcs11
configtxgen: GO_LDFLAGS=-X $(pkgmap.$(@F))/metadata.Version=$(PROJECT_VERSION)
configtxgen: build/bin/configtxgen

configtxlator: GO_LDFLAGS=-X $(pkgmap.$(@F))/metadata.Version=$(PROJECT_VERSION)
configtxlator: build/bin/configtxlator

cryptogen: GO_LDFLAGS=-X $(pkgmap.$(@F))/metadata.Version=$(PROJECT_VERSION)
cryptogen: build/bin/cryptogen

tools-docker: build/image/tools/$(DUMMY)

javaenv: build/image/javaenv/$(DUMMY)

buildenv: build/image/buildenv/$(DUMMY)

build/image/testenv/$(DUMMY): build/image/buildenv/$(DUMMY)
testenv: build/image/testenv/$(DUMMY)

couchdb: build/image/couchdb/$(DUMMY)

kafka: build/image/kafka/$(DUMMY)

zookeeper: build/image/zookeeper/$(DUMMY)

#单元测试 进入单元测试目录,运行docker-compose启动容器,执行完毕后退出容器
unit-test: unit-test-clean peer-docker testenv couchdb
cd unit-test && docker-compose up --abort-on-container-exit --force-recreate && docker-compose down

unit-tests: unit-test

#验证,执行方法类似单元测试
verify: unit-test-clean peer-docker testenv couchdb
cd unit-test && JOB_TYPE=VERIFY docker-compose up --abort-on-container-exit --force-recreate && docker-compose down

# Generates a string to the terminal suitable for manual augmentation / re-issue, useful for running tests by hand
test-cmd:
@echo "go test -ldflags \"$(GO_LDFLAGS)\""

#docker依赖文件列表为/build/image/ 里面的image dummy 文件 . .dummy 文件的意思,参见devenv.mk
docker: $(patsubst %,build/image/%/$(DUMMY), $(IMAGES))
#native依赖
native: peer orderer configtxgen cryptogen configtxlator

#行为驱动开发相关
behave-deps: docker peer build/bin/block-listener configtxgen cryptogen
behave: behave-deps
@echo "Running behave tests"
@cd bddtests; behave $(BEHAVE_OPTS)

behave-peer-chaincode: build/bin/peer peer-docker orderer-docker
@cd peer/chaincode && behave

#开启docker容器做代码检查
linter: buildenv
@echo "LINT: Running code checks.."
@$(DRUN) $(DOCKER_NS)/fabric-buildenv:$(DOCKER_TAG) ./scripts/golinter.sh

#链工具相关
%/chaintool: Makefile
@echo "Installing chaintool"
@mkdir -p $(@D)
curl -L $(CHAINTOOL_URL) > $@
chmod +x $@

# We (re)build a package within a docker context but persist the $GOPATH/pkg
# directory so that subsequent builds are faster
# 这里创建docker下面的fabric运行文件 ,比如peer orderer,cryptocfg等
# 创建方式为:
# 1.创建artifact位置文件夹 build/docker/bin
# 2.运行fabric-baseimage容器,挂载src目录用于编译构建,挂载build/bin用于放置结果
# 3. go install 后面的 $(pkgmap.$(@F))是找到project files,然后作为键,提取pkgmap里面的待生成目标,比如peer orderer
# 4. 碰一下目标文件,以示更新
build/docker/bin/%: $(PROJECT_FILES)
$(eval TARGET = ${patsubst build/docker/bin/%,%,${@}})
@echo "Building $@"
@mkdir -p build/docker/bin build/docker/$(TARGET)/pkg
@$(DRUN) \
-v $(abspath build/docker/bin):/opt/gopath/bin \
-v $(abspath build/docker/$(TARGET)/pkg):/opt/gopath/pkg \
$(BASE_DOCKER_NS)/fabric-baseimage:$(BASE_DOCKER_TAG) \
go install -ldflags "$(DOCKER_GO_LDFLAGS)" $(pkgmap.$(@F))
@touch $@

build/bin:
mkdir -p $@

changelog:
./scripts/changelog.sh v$(PREV_VERSION) v$(BASE_VERSION)

build/docker/gotools/bin/protoc-gen-go: build/docker/gotools

#创建docker下的gotools
build/docker/gotools: gotools/Makefile
@mkdir -p $@/bin $@/obj
@$(DRUN) \
-v $(abspath $@):/opt/gotools \
-w /opt/gopath/src/$(PKGNAME)/gotools \
$(BASE_DOCKER_NS)/fabric-baseimage:$(BASE_DOCKER_TAG) \
make install BINDIR=/opt/gotools/bin OBJDIR=/opt/gotools/obj

# Both peer and peer-docker depend on ccenv and javaenv (all docker env images it supports).
# 本地和docker环境peer都需要ccenv和javaenv环境
build/bin/peer: build/image/ccenv/$(DUMMY) build/image/javaenv/$(DUMMY)
build/image/peer/$(DUMMY): build/image/ccenv/$(DUMMY) build/image/javaenv/$(DUMMY)

#创建本地的运行文件,创建方式参看docker的方式
build/bin/%: $(PROJECT_FILES)
@mkdir -p $(@D)
@echo "$@"
$(CGO_FLAGS) GOBIN=$(abspath $(@D)) go install -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))
@echo "Binary available as $@"
@touch $@

# payload definitions'
# 每个镜像里面需要配置的payload
# 比如peer镜像需要peer二进制运行文件,需要sampleconfig,全部放到对应的payload下面
build/image/ccenv/payload: build/docker/gotools/bin/protoc-gen-go \
build/bin/chaintool \
build/goshim.tar.bz2
build/image/javaenv/payload: build/javashim.tar.bz2 \
build/protos.tar.bz2 \
settings.gradle
build/image/peer/payload: build/docker/bin/peer \
build/sampleconfig.tar.bz2
build/image/orderer/payload: build/docker/bin/orderer \
build/sampleconfig.tar.bz2
build/image/buildenv/payload: build/gotools.tar.bz2 \
build/docker/gotools/bin/protoc-gen-go
build/image/testenv/payload: build/docker/bin/orderer \
build/docker/bin/peer \
build/sampleconfig.tar.bz2 \
images/testenv/install-softhsm2.sh
build/image/zookeeper/payload: images/zookeeper/docker-entrypoint.sh
build/image/kafka/payload: images/kafka/docker-entrypoint.sh \
images/kafka/kafka-run-class.sh
build/image/couchdb/payload: images/couchdb/docker-entrypoint.sh \
images/couchdb/local.ini \
images/couchdb/vm.args
build/image/tools/payload: build/docker/bin/cryptogen \
build/docker/bin/configtxgen \
build/docker/bin/peer \
build/sampleconfig.tar.bz2

#实际拷贝的动作
build/image/%/payload:
mkdir -p $@
cp $^ $@

.PRECIOUS: build/image/%/Dockerfile

#根据Dockerfile.in这个临时文件,再加上本makefile定义的变量值对其中的内容进行替换
#,生成最后实际的Dockerfile,结合上面生成的payload,做最后的docker镜像生成
build/image/%/Dockerfile: images/%/Dockerfile.in
@cat $< \
| sed -e 's/_BASE_NS_/$(BASE_DOCKER_NS)/g' \
| sed -e 's/_NS_/$(DOCKER_NS)/g' \
| sed -e 's/_BASE_TAG_/$(BASE_DOCKER_TAG)/g' \
| sed -e 's/_TAG_/$(DOCKER_TAG)/g' \
> $@
@echo LABEL $(BASE_DOCKER_LABEL).version=$(PROJECT_VERSION) \\>>$@
@echo " " $(BASE_DOCKER_LABEL).base.version=$(BASEIMAGE_RELEASE)>>$@

#根据Makefile ,对应的payload和Dockerfile,开始生成镜像,并且打tag
build/image/%/$(DUMMY): Makefile build/image/%/payload build/image/%/Dockerfile
$(eval TARGET = ${patsubst build/image/%/$(DUMMY),%,${@}})
@echo "Building docker $(TARGET)-image"
$(DBUILD) -t $(DOCKER_NS)/fabric-$(TARGET) $(@D)
docker tag $(DOCKER_NS)/fabric-$(TARGET) $(DOCKER_NS)/fabric-$(TARGET):$(DOCKER_TAG)
@touch $@

#对gotools打包
build/gotools.tar.bz2: build/docker/gotools
(cd $</bin && tar -jc *) > $@

#goshim打包
build/goshim.tar.bz2: $(GOSHIM_DEPS)
@echo "Creating $@"
@tar -jhc -C $(GOPATH)/src $(patsubst $(GOPATH)/src/%,%,$(GOSHIM_DEPS)) > $@

#对sampleconfig打包
build/sampleconfig.tar.bz2: $(shell find sampleconfig -type f)
(cd sampleconfig && tar -jc *) > $@


build/javashim.tar.bz2: $(JAVASHIM_DEPS)
build/protos.tar.bz2: $(PROTOS)

build/%.tar.bz2:
@echo "Creating $@"
@tar -jc $^ > $@

# builds release packages for the host platform
#对当前主机平台构建发布包
release: $(patsubst %,release/%, $(MARCH))

# builds release packages for all target platforms
#对所有主机平台构建发布包
release-all: $(patsubst %,release/%, $(RELEASE_PLATFORMS))

release/%: GO_LDFLAGS=-X $(pkgmap.$(@F))/metadata.Version=$(PROJECT_VERSION)

release/windows-amd64: GOOS=windows
release/windows-amd64: GO_TAGS+= nopkcs11
release/windows-amd64: $(patsubst %,release/windows-amd64/bin/%, $(RELEASE_PKGS)) release/windows-amd64/install

release/darwin-amd64: GOOS=darwin
release/darwin-amd64: GO_TAGS+= nopkcs11
release/darwin-amd64: $(patsubst %,release/darwin-amd64/bin/%, $(RELEASE_PKGS)) release/darwin-amd64/install

release/linux-amd64: GOOS=linux
release/linux-amd64: GO_TAGS+= nopkcs11
release/linux-amd64: $(patsubst %,release/linux-amd64/bin/%, $(RELEASE_PKGS)) release/linux-amd64/install

release/%-amd64: DOCKER_ARCH=x86_64
release/%-amd64: GOARCH=amd64
release/linux-%: GOOS=linux

release/linux-ppc64le: GOARCH=ppc64le
release/linux-ppc64le: DOCKER_ARCH=ppc64le
release/linux-ppc64le: GO_TAGS+= nopkcs11
release/linux-ppc64le: $(patsubst %,release/linux-ppc64le/bin/%, $(RELEASE_PKGS)) release/linux-ppc64le/install

release/linux-s390x: GOARCH=s390x
release/linux-s390x: DOCKER_ARCH=s390x
release/linux-s390x: GO_TAGS+= nopkcs11
release/linux-s390x: $(patsubst %,release/linux-s390x/bin/%, $(RELEASE_PKGS)) release/linux-s390x/install

release/%/bin/configtxlator: $(PROJECT_FILES)
@echo "Building $@ for $(GOOS)-$(GOARCH)"
mkdir -p $(@D)
$(CGO_FLAGS) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(abspath $@) -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))

release/%/bin/configtxgen: $(PROJECT_FILES)
@echo "Building $@ for $(GOOS)-$(GOARCH)"
mkdir -p $(@D)
$(CGO_FLAGS) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(abspath $@) -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))

release/%/bin/cryptogen: $(PROJECT_FILES)
@echo "Building $@ for $(GOOS)-$(GOARCH)"
mkdir -p $(@D)
$(CGO_FLAGS) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(abspath $@) -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))

release/%/bin/orderer: $(PROJECT_FILES)
@echo "Building $@ for $(GOOS)-$(GOARCH)"
mkdir -p $(@D)
$(CGO_FLAGS) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(abspath $@) -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))

release/%/bin/peer: GO_LDFLAGS = $(patsubst %,-X $(PKGNAME)/common/metadata.%,$(METADATA_VAR))

release/%/bin/peer: $(PROJECT_FILES)
@echo "Building $@ for $(GOOS)-$(GOARCH)"
mkdir -p $(@D)
$(CGO_FLAGS) GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(abspath $@) -tags "$(GO_TAGS)" -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))

#生成get-docker-images.sh脚本
release/%/install: $(PROJECT_FILES)
mkdir -p $(@D)/bin
@cat $(@D)/../templates/get-docker-images.in \
| sed -e 's/_NS_/$(DOCKER_NS)/g' \
| sed -e 's/_ARCH_/$(DOCKER_ARCH)/g' \
| sed -e 's/_VERSION_/$(PROJECT_VERSION)/g' \
| sed -e 's/_BASE_DOCKER_TAG_/$(BASE_DOCKER_TAG)/g' \
> $(@D)/bin/get-docker-images.sh
@chmod +x $(@D)/bin/get-docker-images.sh
@cat $(@D)/../templates/get-byfn.in \
| sed -e 's/_VERSION_/$(PROJECT_VERSION)/g' \
> $(@D)/bin/get-byfn.sh
@chmod +x $(@D)/bin/get-byfn.sh

.PHONY: dist
dist: dist-clean release
cd release/$(MARCH) && tar -czvf hyperledger-fabric-$(MARCH).$(PROJECT_VERSION).tar.gz *

dist-all: dist-clean release-all $(patsubst %,dist/%, $(RELEASE_PLATFORMS))

dist/windows-amd64:
cd release/windows-amd64 && tar -czvf hyperledger-fabric-windows-amd64.$(PROJECT_VERSION).tar.gz *

dist/darwin-amd64:
cd release/darwin-amd64 && tar -czvf hyperledger-fabric-darwin-amd64.$(PROJECT_VERSION).tar.gz *

dist/linux-amd64:
cd release/linux-amd64 && tar -czvf hyperledger-fabric-linux-amd64.$(PROJECT_VERSION).tar.gz *

dist/linux-ppc64le:
cd release/linux-ppc64le && tar -czvf hyperledger-fabric-linux-ppc64le.$(PROJECT_VERSION).tar.gz *

dist/linux-s390x:
cd release/linux-s390x && tar -czvf hyperledger-fabric-linux-s390x.$(PROJECT_VERSION).tar.gz *

.PHONY: protos
protos: buildenv
@$(DRUN) $(DOCKER_NS)/fabric-buildenv:$(DOCKER_TAG) ./scripts/compile_protos.sh

%-docker-clean:
$(eval TARGET = ${patsubst %-docker-clean,%,${@}})
-docker images -q $(DOCKER_NS)/fabric-$(TARGET) | xargs -I '{}' docker rmi -f '{}'
-@rm -rf build/image/$(TARGET) ||:

docker-clean: $(patsubst %,%-docker-clean, $(IMAGES))

.PHONY: clean
clean: docker-clean unit-test-clean release-clean
-@rm -rf build ||:

.PHONY: clean-all
clean-all: clean gotools-clean dist-clean release-clean unit-test-clean
-@rm -rf /var/hyperledger/* ||:

.PHONY: dist-clean
dist-clean:
-@rm -rf release/windows-amd64/hyperledger-fabric-windows-amd64.$(PROJECT_VERSION).tar.gz ||:
-@rm -rf release/darwin-amd64/hyperledger-fabric-darwin-amd64.$(PROJECT_VERSION).tar.gz ||:
-@rm -rf release/linux-amd64/hyperledger-fabric-linux-amd64.$(PROJECT_VERSION).tar.gz ||:
-@rm -rf release/linux-ppc64le/hyperledger-fabric-linux-ppc64le.$(PROJECT_VERSION).tar.gz ||:
-@rm -rf release/linux-s390x/hyperledger-fabric-linux-s390x.$(PROJECT_VERSION).tar.gz ||:

%-release-clean:
$(eval TARGET = ${patsubst %-release-clean,%,${@}})
-@rm -rf release/$(TARGET)

release-clean: $(patsubst %,%-release-clean, $(RELEASE_PLATFORMS))

.PHONY: unit-test-clean
unit-test-clean:
cd unit-test && docker-compose down
  • 发表于 2017-07-20 09:39
  • 阅读 ( 6655 )
  • 分类:hyperledger

你可能感兴趣的文章

相关问题

5 条评论

请先 登录 后评论
不写代码的码农
刘地军

区块链平台研究

3 篇文章

作家榜 »

  1. 社区运营-小以 548 文章
  2. 社区运营-小链 244 文章
  3. 于中阳Mercina-zy 79 文章
  4. 涂晶 75 文章
  5. 李晓琼 44 文章
  6. 兄弟连区块链培训 42 文章
  7. 吴寿鹤 36 文章
  8. John-smith 25 文章