-
Notifications
You must be signed in to change notification settings - Fork 32
/
Makefile
50 lines (42 loc) · 1.31 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
SCRYPTRAW=scrypt_raw.js
SCRYPTVERSION=1.2.0
SCRYPTUNPACKED=scrypt-$(SCRYPTVERSION)
SCRYPTTARBALL=scrypt-$(SCRYPTVERSION).tgz
EMCONFIGURE=`which emconfigure`
EMCC=`which emcc`
## Builds well with emscripten SDK 1.36.4.
all: browser
$(SCRYPTRAW): $(SCRYPTUNPACKED)/config.h
EMCC_DEBUG=2 $(EMCC) \
-s ASSERTIONS=2 \
-s LINKABLE=1 \
-s EXPORTED_FUNCTIONS="['_crypto_scrypt','_malloc','_free']" \
-O2 --memory-init-file 0 -o $@ \
-DHAVE_CONFIG_H \
-I $(SCRYPTUNPACKED) \
-I $(SCRYPTUNPACKED)/libcperciva/cpusupport \
-I $(SCRYPTUNPACKED)/libcperciva/alg \
-I $(SCRYPTUNPACKED)/libcperciva/util \
$$(find $(SCRYPTUNPACKED)/lib/crypto -name '*.c') \
$(SCRYPTUNPACKED)/libcperciva/util/insecure_memzero.c \
$(SCRYPTUNPACKED)/libcperciva/util/warnp.c \
$(SCRYPTUNPACKED)/libcperciva/alg/sha256.c
$(SCRYPTUNPACKED)/config.h: $(SCRYPTUNPACKED)
(cd $(SCRYPTUNPACKED); $(EMCONFIGURE) ./configure)
touch $@
clean:
rm -f $(SCRYPTRAW)
rm -rf browser
browser: $(SCRYPTRAW) scrypt_browser_prefix.js scrypt_cooked.js scrypt_browser_suffix.js
mkdir -p $@
cat \
scrypt_browser_prefix.js \
$(SCRYPTRAW) \
scrypt_cooked.js \
scrypt_browser_suffix.js \
> $@/scrypt.js
veryclean: clean
rm -rf $(SCRYPTUNPACKED)
$(SCRYPTUNPACKED): $(SCRYPTTARBALL)
tar -zxvf $<
rm -f $(SCRYPTUNPACKED)/lib/crypto/crypto_scrypt-ref.c