Skip to content

Commit 7e7c7bb

Browse files
committed
[BUILD] Delineate between native and docker builds
We make the notion of building "native" vs "docker" outputs a first class notion by adding targets for those names. For example: "make docker" will now generate all docker images and "make native" will generate all native binaries. Change-Id: Ifd67b3936ef3242c832b9c468c846f5d27b32c63 Signed-off-by: Greg Haskins <[email protected]>
1 parent ac987db commit 7e7c7bb

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

Makefile

+19-17
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,17 @@
2020
#
2121
# - all (default) - builds all targets and runs all tests/checks
2222
# - checks - runs all tests/checks
23-
# - peer - builds the fabric peer binary
24-
# - orderer - builds the fabric orderer binary
23+
# - peer - builds a native fabric peer binary
24+
# - orderer - builds a native fabric orderer binary
2525
# - unit-test - runs the go-test based unit tests
2626
# - behave - runs the behave test
2727
# - behave-deps - ensures pre-requisites are availble for running behave manually
2828
# - gotools - installs go tools like golint
2929
# - linter - runs all code checks
30-
# - images[-clean] - ensures all docker images are available[/cleaned]
31-
# - peer-image[-clean] - ensures the peer-image is available[/cleaned] (for behave, etc)
32-
# - orderer-image[-clean] - ensures the orderer-image is available[/cleaned] (for behave, etc)
30+
# - native - ensures all native binaries are available
31+
# - docker[-clean] - ensures all docker images are available[/cleaned]
32+
# - peer-docker[-clean] - ensures the peer container is available[/cleaned]
33+
# - orderer-docker[-clean] - ensures the orderer container is available[/cleaned]
3334
# - protos - generate all protobuf artifacts based on .proto files
3435
# - clean - cleans the build area
3536
# - dist-clean - superset of 'clean' that also removes persistent state
@@ -78,7 +79,7 @@ pkgmap.peer := $(PKGNAME)/peer
7879
pkgmap.orderer := $(PKGNAME)/orderer
7980
pkgmap.block-listener := $(PKGNAME)/examples/events/block-listener
8081

81-
all: peer orderer checks
82+
all: native docker checks
8283

8384
checks: linter unit-test behave
8485

@@ -90,26 +91,27 @@ gotools:
9091
gotools-clean:
9192
cd gotools && $(MAKE) clean
9293

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

9698
.PHONY: peer
9799
peer: build/bin/peer
98-
peer-image: build/image/peer/.dummy
100+
peer-docker: build/image/peer/.dummy
99101

100102
.PHONY: orderer
101103
orderer: build/bin/orderer
102-
orderer-image: build/image/orderer/.dummy
104+
orderer-docker: build/image/orderer/.dummy
103105

104-
unit-test: peer-image gotools
106+
unit-test: peer-docker gotools
105107
@./scripts/goUnitTests.sh $(DOCKER_TAG) "$(GO_LDFLAGS)"
106108

107109
unit-tests: unit-test
108110

109-
.PHONY: images
110-
images: $(patsubst %,build/image/%/.dummy, $(IMAGES))
111+
docker: $(patsubst %,build/image/%/.dummy, $(IMAGES))
112+
native: peer orderer
111113

112-
behave-deps: images peer build/bin/block-listener
114+
behave-deps: docker peer build/bin/block-listener
113115
behave: behave-deps
114116
@echo "Running behave tests"
115117
@cd bddtests; behave $(BEHAVE_OPTS)
@@ -157,7 +159,7 @@ build/docker/bin/%: $(PROJECT_FILES)
157159
build/bin:
158160
mkdir -p $@
159161

160-
# Both peer and peer-image depend on ccenv-image and javaenv-image (all docker env images it supports)
162+
# Both peer and peer-docker depend on ccenv and javaenv (all docker env images it supports)
161163
build/bin/peer: build/image/ccenv/.dummy build/image/javaenv/.dummy
162164
build/image/peer/.dummy: build/image/ccenv/.dummy build/image/javaenv/.dummy
163165

@@ -211,15 +213,15 @@ build/%.tar.bz2:
211213
protos: gotools
212214
./scripts/compile_protos.sh
213215

214-
%-image-clean:
215-
$(eval TARGET = ${patsubst %-image-clean,%,${@}})
216+
%-docker-clean:
217+
$(eval TARGET = ${patsubst %-docker-clean,%,${@}})
216218
-docker images -q $(PROJECT_NAME)-$(TARGET) | xargs docker rmi -f
217219
-@rm -rf build/image/$(TARGET) ||:
218220

219-
images-clean: $(patsubst %,%-image-clean, $(IMAGES))
221+
docker-clean: $(patsubst %,%-docker-clean, $(IMAGES))
220222

221223
.PHONY: clean
222-
clean: images-clean
224+
clean: docker-clean
223225
-@rm -rf build ||:
224226

225227
.PHONY: dist-clean

0 commit comments

Comments
 (0)