Skip to content

Commit a66221e

Browse files
committed
[BUILD] Simplify go install
We currently define a near-duplicate directive for compiling the block-listener, when the only special case is really the pkg path. Therefore, lets simply define a bin-to-pkg map and condense the rules for simpliciy. Change-Id: Ie395bc5de25788f58d183a230fc2d59ec1a147b1 Signed-off-by: Greg Haskins <[email protected]>
1 parent 943391b commit a66221e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Makefile

+6-8
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
6565
PROJECT_FILES = $(shell git ls-files)
6666
IMAGES = src ccenv peer javaenv orderer
6767

68+
pkgmap.peer := $(PKGNAME)/peer
69+
pkgmap.orderer := $(PKGNAME)/orderer
70+
pkgmap.block-listener := $(PKGNAME)/examples/events/block-listener
6871

6972
all: peer orderer checks
7073

@@ -144,7 +147,8 @@ build/docker/bin/%: build/image/src/.dummy $(PROJECT_FILES)
144147
--user=$(UID) \
145148
-v $(abspath build/docker/bin):/opt/gopath/bin \
146149
-v $(abspath build/docker/pkg):/opt/gopath/pkg \
147-
hyperledger/fabric-src:$(DOCKER_TAG) go install -ldflags "$(GO_LDFLAGS)" $(PKGNAME)/$(TARGET)
150+
hyperledger/fabric-src:$(DOCKER_TAG) \
151+
go install -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))
148152
@touch $@
149153

150154
build/bin:
@@ -154,16 +158,10 @@ build/bin:
154158
build/bin/peer: build/image/ccenv/.dummy build/image/javaenv/.dummy
155159
build/image/peer/.dummy: build/image/ccenv/.dummy build/image/javaenv/.dummy
156160

157-
build/bin/block-listener:
158-
@mkdir -p $(@D)
159-
$(CGO_FLAGS) GOBIN=$(abspath $(@D)) go install $(PKGNAME)/examples/events/block-listener
160-
@echo "Binary available as $@"
161-
@touch $@
162-
163161
build/bin/%: $(PROJECT_FILES)
164162
@mkdir -p $(@D)
165163
@echo "$@"
166-
$(CGO_FLAGS) GOBIN=$(abspath $(@D)) go install -ldflags "$(GO_LDFLAGS)" $(PKGNAME)/$(@F)
164+
$(CGO_FLAGS) GOBIN=$(abspath $(@D)) go install -ldflags "$(GO_LDFLAGS)" $(pkgmap.$(@F))
167165
@echo "Binary available as $@"
168166
@touch $@
169167

0 commit comments

Comments
 (0)