Skip to content

Commit 142d9de

Browse files
Chris Brodylovasoa
Chris Brody
authored andcommitted
some build updates & fixes (#318)
* remove trailing tab from Makefile * remove trailing spaces from Makefile * use npx to run local coffeescript in Makefile * split up & sort CFLAGS in Makefile
1 parent daf7a9f commit 142d9de

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

Makefile

+19-12
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ SQLITE_AMALGAMATION = sqlite-amalgamation-3300100
1010
SQLITE_AMALGAMATION_ZIP_URL = https://www.sqlite.org/2019/sqlite-amalgamation-3300100.zip
1111
SQLITE_AMALGAMATION_ZIP_SHA1 = ff9b4e140fe0764bc7bc802facf5ac164443f517
1212

13-
# Note that extension-functions.c hasn't been updated since 2010-02-06, so likely doesn't need to be updated
13+
# Note that extension-functions.c hasn't been updated since 2010-02-06, so likely doesn't need to be updated
1414
EXTENSION_FUNCTIONS = extension-functions.c
1515
EXTENSION_FUNCTIONS_URL = https://www.sqlite.org/contrib/download/extension-functions.c?get=25
1616
EXTENSION_FUNCTIONS_SHA1 = c68fa706d6d9ff98608044c00212473f9c14892f
1717

1818
EMCC=emcc
1919

20-
CFLAGS=-O2 -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DISABLE_LFS -DLONGDOUBLE_TYPE=double -DSQLITE_THREADSAFE=0 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
20+
CFLAGS = \
21+
-O2 \
22+
-DLONGDOUBLE_TYPE=double \
23+
-DSQLITE_OMIT_LOAD_EXTENSION \
24+
-DSQLITE_DISABLE_LFS \
25+
-DSQLITE_ENABLE_FTS3 \
26+
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
27+
-DSQLITE_THREADSAFE=0
2128

2229
# When compiling to WASM, enabling memory-growth is not expected to make much of an impact, so we enable it for all builds
2330
# Since tihs is a library and not a standalone executable, we don't want to catch unhandled Node process exceptions
@@ -32,7 +39,7 @@ EMFLAGS = \
3239

3340
EMFLAGS_WASM = \
3441
-s WASM=1 \
35-
-s ALLOW_MEMORY_GROWTH=1
42+
-s ALLOW_MEMORY_GROWTH=1
3643

3744
EMFLAGS_OPTIMIZED= \
3845
-s INLINING_LIMIT=50 \
@@ -67,19 +74,19 @@ dist/sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js src/
6774
.PHONY: optimized
6875
optimized: dist/sql-asm.js dist/sql-wasm.js dist/sql-asm-memory-growth.js
6976

70-
dist/sql-asm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js src/exported_functions.json src/exported_runtime_methods.json
77+
dist/sql-asm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js src/exported_functions.json src/exported_runtime_methods.json
7178
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) -s WASM=0 $(BITCODE_FILES) --pre-js out/api.js -o $@
7279
mv $@ out/tmp-raw.js
7380
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
7481
rm out/tmp-raw.js
7582

76-
dist/sql-wasm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js src/exported_functions.json src/exported_runtime_methods.json
83+
dist/sql-wasm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js src/exported_functions.json src/exported_runtime_methods.json
7784
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) $(EMFLAGS_WASM) $(BITCODE_FILES) --pre-js out/api.js -o $@
7885
mv $@ out/tmp-raw.js
7986
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
8087
rm out/tmp-raw.js
8188

82-
dist/sql-asm-memory-growth.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js src/exported_functions.json src/exported_runtime_methods.json
89+
dist/sql-asm-memory-growth.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.js src/exported_functions.json src/exported_runtime_methods.json
8390
$(EMCC) $(EMFLAGS) $(EMFLAGS_OPTIMIZED) -s WASM=0 -s ALLOW_MEMORY_GROWTH=1 $(BITCODE_FILES) --pre-js out/api.js -o $@
8491
mv $@ out/tmp-raw.js
8592
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
@@ -91,7 +98,7 @@ dist/sql-asm-memory-growth.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) out/api.
9198
worker: dist/worker.sql-asm.js dist/worker.sql-asm-debug.js dist/worker.sql-wasm.js dist/worker.sql-wasm-debug.js
9299

93100
out/worker.js: src/worker.coffee
94-
cat $^ | coffee --bare --compile --stdio > $@
101+
cat $^ | npx coffee --bare --compile --stdio > $@
95102

96103
dist/worker.sql-asm.js: dist/sql-asm.js out/worker.js
97104
cat $^ > $@
@@ -125,7 +132,7 @@ dist/worker.sql-wasm-debug.js: dist/sql-wasm-debug.js out/worker.js
125132

126133
out/api.js: src/output-pre.js src/api.coffee src/exports.coffee src/api-data.coffee src/output-post.js
127134
mkdir -p out
128-
cat src/api.coffee src/exports.coffee src/api-data.coffee | coffee --bare --compile --stdio > $@
135+
cat src/api.coffee src/exports.coffee src/api-data.coffee | npx coffee --bare --compile --stdio > $@
129136
cat src/output-pre.js $@ src/output-post.js > out/api-wrapped.js
130137
mv out/api-wrapped.js $@
131138

@@ -180,12 +187,12 @@ sqlite-src/$(SQLITE_AMALGAMATION)/$(EXTENSION_FUNCTIONS): cache/$(EXTENSION_FUNC
180187
cp 'cache/$(EXTENSION_FUNCTIONS)' $@
181188

182189

183-
.PHONY: clean
184-
clean:
185-
rm -rf out/* dist/*
190+
.PHONY: clean
191+
clean:
192+
rm -rf out/* dist/*
186193

187194
.PHONY: clean-all
188-
clean-all:
195+
clean-all:
189196
rm -f out/* dist/* cache/*
190197
rm -rf sqlite-src/
191198

0 commit comments

Comments
 (0)