-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
147 lines (105 loc) · 2.93 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#
# == Paths & Directories ==
#
ROOT_DIR := $(shell pwd)
NODE_DIR := $(ROOT_DIR)/node_modules
VENV_DIR := .virtualenv
#
# == Configuration ==
#
TESTRPC_PORT ?= 8545
DAPP_PORT ?= 8435
#
# == Commands ==
#
MKDIR := mkdir -p
LN := ln
FIND := find
NPM := npm
NODE := node
TRUFFLE := $(NODE_DIR)/truffle/build/cli.bundled.js
TESTRPC := $(NODE_DIR)/ethereumjs-testrpc/build/cli.node.js
BROWSERIFY := $(NODE_DIR)/browserify/bin/cmd.js
SERVE := $(NODE_DIR)/serve/bin/serve.js
PIP := $(VENV_DIR)/bin/pip
MYTH := $(VENV_DIR)/bin/myth
SOLIUM := $(NODE_DIR)/solium/bin/solium.js
PYTHON3 := $(shell command -v python3 2> /dev/null)
#
# == DAPP ==
#
FONTS := $(NODE_DIR)/font-awesome/fonts/*
CSS := $(NODE_DIR)/bootstrap/dist/css/bootstrap.min.css $(NODE_DIR)/tether/dist/css/tether.min.css $(NODE_DIR)/font-awesome/css/font-awesome.min.css $(NODE_DIR)/highlightjs/styles/default.css
CSS += dapp/css/cards.css
JS := $(NODE_DIR)/jquery/dist/jquery.js $(NODE_DIR)/bootstrap/dist/js/bootstrap.js $(NODE_DIR)/tether/dist/js/tether.js $(NODE_DIR)/highlightjs/highlight.pack.js
JS += dapp/js/requires.js dapp/js/utils.js dapp/js/connection.js dapp/js/bip32.js dapp/js/create.js dapp/js/spend.js
JS_BROWSERIFY := -r web3 -r bignumber.js -r highlightjs-solidity -r sha.js -r @ledgerhq/hw-app-eth -r @ledgerhq/hw-transport-u2f
#
# == Top-Level Targets ==
#
default: contract dapp
dependencies: js-dependencies-prod
dependencies-all: js-dependencies-all python-dependencies
contract: build/contracts/MultiSig2of3.json
dapp: images fonts css js html
clean:
rm -rf public/*
rm -rf tmp/*
purge: clean
rm -rf $(NODE_DIR)
testrpc:
$(TESTRPC) --port $(TESTRPC_PORT)
server:
cd public && $(SERVE) -T -p $(DAPP_PORT)
freeze:
$(NPM) shrinkwrap
$(PIP) freeze > requirements.frozen.txt
#
# == Contract ==
#
build/contracts/MultiSig2of3.json: contracts/MultiSig2of3.sol
$(TRUFFLE) compile
#
# == DAPP ==
#
images:
mkdir -p public/images
cp -R dapp/images/* public/images
fonts:
mkdir -p public/fonts
cp $(FONTS) public/fonts
css:
mkdir -p public/css
cat $(CSS) > public/css/dapp.css
js: tmp/MultiSig2of3.js tmp/bundle.js $(JS)
mkdir -p public/js
cat tmp/MultiSig2of3.js tmp/bundle.js $(JS) > public/js/dapp.js
tmp/MultiSig2of3.js: build/contracts/MultiSig2of3.json
printf "var MultiSig2of3Compiled = " > tmp/MultiSig2of3.js
cat build/contracts/MultiSig2of3.json >> tmp/MultiSig2of3.js
echo "" >> tmp/MultiSig2of3.js
tmp/bundle.js:
$(BROWSERIFY) $(JS_BROWSERIFY) > tmp/bundle.js
html:
$(NODE) scripts/build.js
#
# == Dependencies ==
#
js-dependencies-all:
npm install
js-dependencies-prod:
npm install --only=production
$(VENV_DIR):
$(PYTHON3) -m venv $(VENV_DIR)
python-dependencies: $(VENV_DIR)
$(PIP) install -r requirements.frozen.txt
#
# == Testing ==
#
test:
./scripts/test
myth:
$(MYTH) -g tmp/myth.json -t -x contracts/MultiSig2of3.sol
solium:
$(SOLIUM) -d contracts/
.PHONY: test compile