-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (49 loc) · 1.55 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
56
57
58
59
60
61
62
.PHONY: dependencies run service ui network go_dep ng_dep fabric_dep netup netdown run
BIN := $(shell test -f network/bin/cryptogen && echo "exists")
GO := $(shell which go)
NG := $(shell which ng)
NPM := $(shell which npm)
OS := $(shell uname -s)
URL := "http://localhost:8020"
run: dependencies ui
@echo
@echo "Open a browser window to => $(URL)"
@echo
@cd service && go run ./cmd/itracker
dependencies: go_dep ng_dep
go_dep:
ifeq ($(strip $(GO)),)
ifeq ($(strip $(OS)),Darwin)
@brew install go
else
@echo "Go must be installed first. Download the latest release from https://golang.org/doc/install" && exit 1
endif
endif
ng_dep:
ifeq ($(strip $(NG)),)
ifeq ($(strip $(NPM)),)
@npm install -g @angular/cli
else
@echo "Angular CLI must be install first. Download the latest release from https://cli.angular.io/" && exit 1
endif
endif
fabric_dep:
ifeq ($(strip $(BIN)),)
@cd network && curl -sfL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s -- -s -d
@cd network && test -e bin/configtxlator || (echo "failed to download bootstrap.sh" && exit 1)
endif
vendor:
@cd chaincode/itracker && go mod vendor
netup: fabric_dep vendor
@cd network && echo -- -y | xargs ./byfn.sh up -c inventory -s couchdb #-n
netdown: fabric_dep
@cd network && echo -- -y | xargs ./byfn.sh down
lint: dependencies
@cd service && go vet ./...
@cd ui && ng lint
service:
@cd service && go build ./cmd/itracker
ui:
@cd ui && ng build --prod
clean: netdown
@rm -rf network/{bin,config,crypto-config,connection-*} chaincode/itracker/vendor