Skip to content

Commit 1f709a8

Browse files
committed
Rename most folders for clarity
The old folder naming scheme was by language type (c, coffee, js, etc). This led to some confusion for those working on the project, since output files were not readily distinguishable from src/input files. The new folders are as follows: dist/* : Compiled assets used by end users (currently checked into git) out/* : Intermediate compiled assets generated while creating files in dist/* - Not checked into git src/* : Source files (coffee, js, etc) sqlite/* : Source files for sqlite.
1 parent 36f23f7 commit 1f709a8

21 files changed

+2122
-1976
lines changed

Diff for: .gitignore

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
node_modules/
22
*~
33

4-
# LLVM bitcode
5-
c/sqlite3.bc
6-
c/extension-functions.bc
7-
# Intermediary js files
8-
js/api.js
9-
js/sql-noopt-raw.js.map
10-
js/sql-optimized.js
11-
js/worker.js
12-
js/sql-raw.js.map
4+
# Intermediary files:
5+
out/

Diff for: Makefile

+48-64
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Note: Last tested with version 1.38.15 of Emscripten
22

3+
# TODO: Emit a file showing which version of emcc and SQLite was used to compile the emitted output.
4+
# TODO: Make it easier to use a newer version of Sqlite.
5+
# TODO: Create a release on Github with these compiled assets rather than checking them in
6+
# TODO: Consider creating different files based on browser vs module usage: https://github.com/vuejs/vue/tree/dev/dist
7+
38
EMCC=emcc
49

510
CFLAGS=-O2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DISABLE_LFS -DLONGDOUBLE_TYPE=double -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
@@ -25,106 +30,85 @@ EMFLAGS_DEBUG = \
2530
-s INLINING_LIMIT=10 \
2631
-O1
2732

28-
BITCODE_FILES = c/sqlite3.bc c/extension-functions.bc
33+
BITCODE_FILES = out/sqlite3.bc out/extension-functions.bc
2934
OUTPUT_WRAPPER_FILES = src/shell-pre.js src/shell-post.js
3035

3136
all: optimized debug worker
3237

33-
# TODO: Emit a file showing which version of emcc and SQLite was used to compile the emitted output.
34-
# TODO: Make it easier to use a newer version of Sqlite.
35-
3638
.PHONY: debug
37-
debug: js/sql-asm-debug.js js/sql-wasm-debug.js
38-
39-
js/sql-asm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) js/api.js exported_functions exported_runtime_methods
40-
$(EMCC) $(EMFLAGS) $(EMFLAGS_DEBUG) -s WASM=0 $(BITCODE_FILES) --pre-js js/api.js -o $@
41-
mv $@ js/tmp-raw.js
42-
cat src/shell-pre.js js/tmp-raw.js src/shell-post.js > $@
43-
rm js/tmp-raw.js
39+
debug: dist/sql-asm-debug.js dist/sql-wasm-debug.js
4440

45-
js/sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) js/api.js exported_functions exported_runtime_methods
46-
$(EMCC) $(EMFLAGS) $(EMFLAGS_DEBUG) $(EMFLAGS_WASM) $(BITCODE_FILES) --pre-js js/api.js -o $@
47-
mv $@ js/tmp-raw.js
48-
cat src/shell-pre.js js/tmp-raw.js src/shell-post.js > $@
49-
rm js/tmp-raw.js
41+
dist/sql-asm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js exported_functions exported_runtime_methods
42+
$(EMCC) $(EMFLAGS) $(EMFLAGS_DEBUG) -s WASM=0 $(BITCODE_FILES) --pre-js out/api.js -o $@
43+
mv $@ out/tmp-raw.js
44+
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
45+
rm out/tmp-raw.js
5046

47+
dist/sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js exported_functions exported_runtime_methods
48+
$(EMCC) $(EMFLAGS) $(EMFLAGS_DEBUG) $(EMFLAGS_WASM) $(BITCODE_FILES) --pre-js out/api.js -o $@
49+
mv $@ out/tmp-raw.js
50+
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
51+
rm out/tmp-raw.js
5152

5253
.PHONY: optimized
53-
optimized: js/sql-asm.js js/sql-wasm.js js/sql-asm-memory-growth.js
54+
optimized: dist/sql-asm.js dist/sql-wasm.js dist/sql-asm-memory-growth.js
5455

55-
js/sql-asm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) js/api.js exported_functions exported_runtime_methods
56-
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) -s WASM=0 $(BITCODE_FILES) --pre-js js/api.js -o $@
57-
mv $@ js/tmp-raw.js
58-
cat src/shell-pre.js js/tmp-raw.js src/shell-post.js > $@
59-
rm js/tmp-raw.js
56+
dist/sql-asm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js exported_functions exported_runtime_methods
57+
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) -s WASM=0 $(BITCODE_FILES) --pre-js out/api.js -o $@
58+
mv $@ out/tmp-raw.js
59+
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
60+
rm out/tmp-raw.js
6061

61-
js/sql-wasm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) js/api.js exported_functions exported_runtime_methods
62-
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) $(EMFLAGS_WASM) $(BITCODE_FILES) --pre-js js/api.js -o $@
63-
mv $@ js/tmp-raw.js
64-
cat src/shell-pre.js js/tmp-raw.js src/shell-post.js > $@
65-
rm js/tmp-raw.js
62+
dist/sql-wasm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js exported_functions exported_runtime_methods
63+
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) $(EMFLAGS_WASM) $(BITCODE_FILES) --pre-js out/api.js -o $@
64+
mv $@ out/tmp-raw.js
65+
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
66+
rm out/tmp-raw.js
6667

67-
js/sql-asm-memory-growth.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) js/api.js exported_functions exported_runtime_methods
68-
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 $(BITCODE_FILES) --pre-js js/api.js -o $@
69-
mv $@ js/tmp-raw.js
70-
cat src/shell-pre.js js/tmp-raw.js src/shell-post.js > $@
71-
rm js/tmp-raw.js
68+
dist/sql-asm-memory-growth.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js exported_functions exported_runtime_methods
69+
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 $(BITCODE_FILES) --pre-js out/api.js -o $@
70+
mv $@ out/tmp-raw.js
71+
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
72+
rm out/tmp-raw.js
7273

7374

7475
# Web worker API
7576
.PHONY: worker
76-
worker: js/worker.sql-asm.js js/worker.sql-asm-debug.js js/worker.sql-wasm.js js/worker.sql-wasm-debug.js
77+
worker: dist/worker.sql-asm.js dist/worker.sql-asm-debug.js dist/worker.sql-wasm.js dist/worker.sql-wasm-debug.js
7778

78-
js/worker.js: src/worker.coffee
79+
out/worker.js: src/worker.coffee
7980
cat $^ | coffee --bare --compile --stdio > $@
8081

81-
js/worker.sql-asm.js: js/sql-asm.js js/worker.js
82+
dist/worker.sql-asm.js: dist/sql-asm.js out/worker.js
8283
cat $^ > $@
8384

84-
js/worker.sql-asm-debug.js: js/sql-asm-debug.js js/worker.js
85+
dist/worker.sql-asm-debug.js: dist/sql-asm-debug.js out/worker.js
8586
cat $^ > $@
8687

87-
js/worker.sql-wasm.js: js/sql-wasm.js js/worker.js
88+
dist/worker.sql-wasm.js: dist/sql-wasm.js out/worker.js
8889
cat $^ > $@
8990

90-
js/worker.sql-wasm-debug.js: js/sql-wasm-debug.js js/worker.js
91+
dist/worker.sql-wasm-debug.js: dist/sql-wasm-debug.js out/worker.js
9192
cat $^ > $@
9293

93-
# TODO: Replace Coffeescript with Typescript or raw JS
94-
js/api.js: src/output-pre.js src/api.coffee src/exports.coffee src/api-data.coffee src/output-post.js
94+
out/api.js: src/output-pre.js src/api.coffee src/exports.coffee src/api-data.coffee src/output-post.js
9595
cat src/api.coffee src/exports.coffee src/api-data.coffee | coffee --bare --compile --stdio > $@
96-
cat src/output-pre.js $@ src/output-post.js > js/api-wrapped.js
97-
mv js/api-wrapped.js $@
96+
cat src/output-pre.js $@ src/output-post.js > out/api-wrapped.js
97+
mv out/api-wrapped.js $@
9898

99-
c/sqlite3.bc: c/sqlite3.c
99+
out/sqlite3.bc: sqlite/sqlite3.c
100100
# Generate llvm bitcode
101-
$(EMCC) $(CFLAGS) c/sqlite3.c -o c/sqlite3.bc
101+
$(EMCC) $(CFLAGS) sqlite/sqlite3.c -o out/sqlite3.bc
102102

103-
c/extension-functions.bc: c/extension-functions.c
104-
$(EMCC) $(CFLAGS) -s LINKABLE=1 c/extension-functions.c -o c/extension-functions.bc
103+
out/extension-functions.bc: sqlite/extension-functions.c
104+
$(EMCC) $(CFLAGS) -s LINKABLE=1 sqlite/extension-functions.c -o out/extension-functions.bc
105105

106106
# TODO: This target appears to be unused. If we re-instatate it, we'll need to add more files inside of the JS folder
107-
# module.tar.gz: test package.json AUTHORS README.md js/sql-asm.js
107+
# module.tar.gz: test package.json AUTHORS README.md dist/sql-asm.js
108108
# tar --create --gzip $^ > $@
109109

110110
.PHONY: clean
111111
clean:
112-
rm -f c/sqlite3.bc \
113-
c/extension-functions.bc \
114-
js/sql-asm.js \
115-
js/sql-asm-memory-growth.js \
116-
js/sql.wasm \
117-
js/sql-asm-debug.js \
118-
js/sql-debug.wasm \
119-
js/sql-wasm.js \
120-
js/sql-wasm.wasm \
121-
js/sql-wasm-debug.js \
122-
js/sql-wasm-debug.wasm \
123-
js/api.js \
124-
js/worker.js \
125-
js/worker.sql-asm.js \
126-
js/worker.sql-asm-debug.js \
127-
js/worker.sql-wasm.js \
128-
js/worker.sql-wasm-debug.js
112+
rm -f out/* dist/*
129113

130114

Diff for: js/sql-debug.js renamed to dist/sql-asm-debug.js

+312-297
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)