-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (35 loc) · 1.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
# Need $(EMSCRIPTEN), for example run with emmake make
EMSCRIPTEN?=/usr/bin
EMCC=$(EMSCRIPTEN)/emcc
CFLAGS=-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DISABLE_LFS -DLONGDOUBLE_TYPE=double -DSQLITE_INT64_TYPE="long long int" -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
all: js/sql.js debug js/worker.sql.js memory-growth
# RESERVED_FUNCTION_POINTERS setting is used for registering custom functions
debug: EMFLAGS= -O1 -g -s INLINING_LIMIT=10 -s RESERVED_FUNCTION_POINTERS=64
debug: js/sql-debug.js
optimized: EMFLAGS= --memory-init-file 0 --closure 1 -O3 -s INLINING_LIMIT=50 -s RESERVED_FUNCTION_POINTERS=64
optimized: js/sql-optimized.js
memory-growth: EMFLAGS= --memory-init-file 0 --closure 1 -O3 -s INLINING_LIMIT=50 -s RESERVED_FUNCTION_POINTERS=64 -s ALLOW_MEMORY_GROWTH=1
memory-growth: js/sql-memory-growth.js
js/sql.js: optimized
cp js/sql-optimized.js js/sql.js
js/sql%.js: js/shell-pre.js js/sql%-raw.js js/shell-post.js
cat $^ > $@
js/sql%-raw.js: c/sqlite3.bc c/extension-functions.bc js/api.js exported_functions
$(EMCC) $(EMFLAGS) -s EXPORTED_FUNCTIONS=@exported_functions c/extension-functions.bc c/sqlite3.bc --post-js js/api.js -o $@ ;\
js/api.js: coffee/api.coffee coffee/exports.coffee coffee/api-data.coffee
cat $^ | coffee --bare --compile --stdio > $@
# Web worker API
worker: js/worker.sql.js
js/worker.js: coffee/worker.coffee
cat $^ | coffee --bare --compile --stdio > $@
js/worker.sql.js: js/sql.js js/worker.js
cat $^ > $@
c/sqlite3.bc: c/sqlite3.c
# Generate llvm bitcode
$(EMCC) $(CFLAGS) c/sqlite3.c -o c/sqlite3.bc
c/extension-functions.bc: c/extension-functions.c
$(EMCC) $(CFLAGS) -s LINKABLE=1 c/extension-functions.c -o c/extension-functions.bc
module.tar.gz: test package.json AUTHORS README.md js/sql.js
tar --create --gzip $^ > $@
clean:
rm -rf js/sql.js js/api.js js/sql*-raw.js js/worker.sql.js js/worker.js js/sql-memory-growth.js c/sqlite3.bc c/extension-functions.bc