This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
90 lines (71 loc) · 3.91 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.DEFAULT_GOAL := all
services:
git clone -b stainless_archive https://github.com/c4dt/services.git
services/%: | services
@: nothing
webapp_build_options = --prod
include services/mk/service.mk
.PHONY: $Sexternal-deps
$Sexternal-deps: \
$Dbackend/build/stainless.zip \
$Dbackend/build/cvc4
$Dbackend/build/stainless.zip: | $Dbackend/build
wget \
--quiet \
--output-document $@ \
https://github.com/epfl-lara/smart/releases/download/v0.3.1s/smart-scalac-standalone-0.3.1s-linux.zip
$Dbackend/build/cvc4: | $Dbackend/build
wget \
--quiet \
--output-document $@ \
http://cvc4.cs.stanford.edu/downloads/builds/x86_64-linux-opt/cvc4-1.6-x86_64-linux-opt \
&& chmod +x $@
$Sbackend-docker-build: | $Sexternal-deps
$Dbackend/build/bevmadmin: | $Dbackend/build
cd $Dbackend/cothority/bevm/bevmadmin && GO111MODULE=on go build -o ../../../build/$(@F)
$Dbackend/configs/ident_bevm: $Dbackend/build/bcadmin $Dbackend/configs/conodes.toml $Dbackend/build/bevmadmin $Dbackend/configs/ident
rm -rf $Dbackend/configs/bevm_admin $Dbackend/configs/bevm_user
$(call $Swith-conodes, \
bevm_admin_key=$$( $< --config $Dbackend/configs/bevm_admin key ) ; \
bevm_user_key=$$( $< --config $Dbackend/configs/bevm_user key ) ; \
bevm_user_private_key=$$( $< --config $Dbackend/configs/bevm_user key --print $Dbackend/configs/bevm_user/key-* | grep Private | cut -d \ -f 2 ) ; \
bevm_darc=$$( $< --config $Dbackend/configs darc add --bc $Dbackend/configs/bc-* --unrestricted --identity $$bevm_admin_key --desc "BEvm Darc" | awk -F: '/BaseID:/ {print $$3}' ) ; \
$< --config $Dbackend/configs/bevm_admin link $(word 2,$^) $$( grep ByzCoinID $Dbackend/configs/ident | cut -d \ -f 2 ) --darc $$bevm_darc --identity $$bevm_admin_key ; \
$< --config $Dbackend/configs/bevm_admin darc rule --bc $Dbackend/configs/bevm_admin/bc-* --rule "spawn:bevm" --identity $$bevm_admin_key ; \
$< --config $Dbackend/configs/bevm_admin darc rule --bc $Dbackend/configs/bevm_admin/bc-* --rule "invoke:bevm.credit" --identity $$bevm_user_key ; \
$< --config $Dbackend/configs/bevm_admin darc rule --bc $Dbackend/configs/bevm_admin/bc-* --rule "invoke:bevm.transaction" --identity $$bevm_user_key ; \
bevm_instance_id=$$($(word 3,$^) --config $Dbackend/configs/bevm_admin spawn --bc $Dbackend/configs/bevm_admin/bc-* | awk '{print $$NF}' ) ; \
( echo "bevm_admin_key: $${bevm_admin_key#ed25519:}" ; \
echo "bevm_user_private_key: $$bevm_user_private_key" ; \
echo "bevm_darc: $$bevm_darc" ; \
echo "bevm_instance_id: $$bevm_instance_id" ) > $@)
$Dbackend/configs/config_bevm.toml: $Dbackend/configs/ident_bevm
awk ' \
/^bevm_user_private_key:/ {printf("bevmUserID = \"%s\"\n", $$2)} \
/^bevm_instance_id:/ {printf("bevmInstanceID = \"%s\"\n", $$2)} \
' $^ > $@
$Swebapp-build $Swebapp-test $Swebapp-serve: $Dwebapp/src/assets/configs/bevm.toml $Dwebapp/src/assets/configs/stainless.toml
$Dwebapp/src/assets/configs/bevm.toml: $Dbackend/configs/config_bevm.toml | $Dwebapp/src/assets/configs/
cp $^ $@
$Dwebapp/src/assets/configs/stainless.toml: $Dwebapp/src/assets/configs/$(toml_filename) | $Dwebapp/src/assets/configs/
cp $^ $@
$Dsrc/Implementation/%_pb2.py: $Dprotobuf/%.proto
cd $Dprotobuf && protoc --python_out=../$(@D) $(^F)
.PHONY: src-proto
src-proto: $(foreach p,$($SPROTOS),$Dsrc/Implementation/$p_pb2.py)
seq-diagram.png: seq-diagram.txt
plantuml $^
ifneq ($S,)
all: $Sall
endif
persistent: configs webapp-build
docker build -t ghcr.io/c4dt/service-stainless-persistent:latest -f backend/Dockerfile.persistent backend
docker build -t ghcr.io/c4dt/service-stainless-webapp:latest webapp
push:
docker push ghcr.io/c4dt/service-stainless-persistent:latest
docker push ghcr.io/c4dt/service-stainless-webapp:latest
.PHONY: configs
configs: webapp/src/assets/configs/byzcoin.toml
configs: webapp/src/assets/configs/bevm.toml
configs: webapp/src/assets/configs/conodes.toml
configs: webapp/src/assets/configs/stainless.toml