2015-06-16 21:50:43 +00:00
|
|
|
EMFLAGS = \
|
2015-06-18 13:45:25 +00:00
|
|
|
-Os --closure 1 \
|
2015-06-16 21:50:43 +00:00
|
|
|
--memory-init-file 0 \
|
|
|
|
--pre-js pre.js --post-js post.js \
|
2016-05-12 17:29:24 +00:00
|
|
|
-I ../ed25519-donna \
|
|
|
|
-s EXPORTED_FUNCTIONS='["_hdnode_public_ckd_address_optimized", "_ecdsa_read_pubkey"]'
|
2015-06-16 21:50:43 +00:00
|
|
|
|
|
|
|
SRC = ../bignum.c ../ecdsa.c ../secp256k1.c ../hmac.c ../bip32.c \
|
2017-03-30 15:53:09 +00:00
|
|
|
../base58.c ../ripemd160.c ../sha2.c ../rand.c ../address.c
|
|
|
|
|
2017-03-30 23:35:00 +00:00
|
|
|
all: trezor-crypto.js benchmark-browserify.js
|
2015-06-16 21:50:43 +00:00
|
|
|
|
2016-05-12 17:57:22 +00:00
|
|
|
trezor-crypto.js: $(SRC)
|
|
|
|
emcc $(EMFLAGS) -o $@ $^
|
|
|
|
|
2017-03-30 23:35:00 +00:00
|
|
|
benchmark-browserify.js: node_modules trezor-crypto.js benchmark.js
|
|
|
|
$(shell npm bin)/browserify benchmark.js -o $@ --noparse=`pwd`/trezor-crypto.js
|
|
|
|
@echo "open benchmark.html in your favourite browser"
|
2015-06-18 13:45:25 +00:00
|
|
|
|
2017-03-30 23:35:00 +00:00
|
|
|
benchmark-node: node_modules trezor-crypto.js benchmark.js
|
|
|
|
node benchmark.js
|
2017-03-30 15:53:09 +00:00
|
|
|
|
2015-06-16 22:06:53 +00:00
|
|
|
node_modules:
|
|
|
|
npm install
|
2016-05-12 17:57:22 +00:00
|
|
|
npm install browserify
|
2015-06-16 22:06:53 +00:00
|
|
|
|
2015-06-16 21:50:43 +00:00
|
|
|
clean:
|
2017-03-30 23:35:00 +00:00
|
|
|
rm -f trezor-crypto.js benchmark-browserify.js
|
2016-05-12 17:29:24 +00:00
|
|
|
|
|
|
|
docker:
|
|
|
|
docker run --rm -i -v $(shell pwd)/..:/src -t apiaryio/emcc /bin/bash
|
2017-03-30 23:35:00 +00:00
|
|
|
|
|
|
|
docker-build:
|
|
|
|
docker run --rm -v $(shell pwd)/..:/src apiaryio/emcc /bin/bash -c 'cd emscripten && make'
|
|
|
|
|
|
|
|
test-correctness: node_modules
|
|
|
|
node test-correctness.js
|