1#!/do/not/make 2#^^^ help emacs select edit mode 3# 4# Intended to include'd by ./GNUmakefile. 5# 6# 'make dist' rules for creating a distribution archive of the WASM/JS 7# pieces, noting that we only build a dist of the built files, not the 8# numerous pieces required to build them. 9####################################################################### 10MAKEFILE.dist := $(lastword $(MAKEFILE_LIST)) 11 12 13######################################################################## 14# Chicken/egg situation: we need $(version-info) to get the version 15# info for the archive name, but that binary may not yet be built, so 16# we have to use a temporary name for the archive. 17dist-name = sqlite-wasm-TEMP 18dist-archive = $(dist-name).zip 19 20#ifeq (0,1) 21# $(info WARNING *******************************************************************) 22# $(info ** Be sure to create the desired build configuration before creating the) 23# $(info ** distribution archive. Use one of the following targets to do so:) 24# $(info ** o2: builds with -O2, resulting in the fastest builds) 25# $(info ** oz: builds with -Oz, resulting in the smallest builds) 26# $(info /WARNING *******************************************************************) 27#endif 28 29demo-123.html := $(dir.wasm)/demo-123.html 30demo-123-worker.html := $(dir.wasm)/demo-123-worker.html 31demo-123.js := $(dir.wasm)/demo-123.js 32demo-files := $(demo-123.js) $(demo-123.html) $(demo-123-worker.html) 33README-dist := $(dir.wasm)/README-dist.txt 34$(dist-archive): $(sqlite3.wasm) $(sqlite3.js) $(sqlite3-wasmfs.wasm) $(sqlite3-wasmfs.js) 35#$(dist-archive): $(sqlite3.h) $(sqlite3.c) $(sqlite3-wasm.c) 36$(dist-archive): $(MAKEFILE.dist) $(version-info) $(demo-files) $(README-dist) 37$(dist-archive): oz 38 rm -fr $(dist-name) 39 mkdir -p $(dist-name)/main $(dist-name)/wasmfs 40 cp -p $(README-dist) $(dist-name)/README.txt 41 cp -p $(sqlite3.wasm) $(sqlite3.js) $(dist-name)/main 42 cp -p $(demo-files) $(dist-name)/main 43 cp -p $(sqlite3-wasmfs.wasm) $(sqlite3-wasmfs.js) $(dist-name)/wasmfs 44 for i in $(demo-123.js) $(demo-123.html); do \ 45 sed -e 's/\bsqlite3\.js\b/sqlite3-wasmfs.js/' $$i \ 46 > $(dist-name)/wasmfs/$${i##*/} || exit; \ 47 done 48 vnum=$$($(version-info) --version-number); \ 49 vdir=sqlite-wasm-$$vnum; \ 50 arc=$$vdir.zip; \ 51 rm -f $$arc; \ 52 mv $(dist-name) $$vdir; \ 53 zip -qr $$arc $$vdir; \ 54 rm -fr $$vdir; \ 55 ls -la $$arc; \ 56 unzip -l $$arc 57 58#$(shell $(version-info) --version-number) 59dist: $(dist-archive) 60clean-dist: 61 rm -f $(dist-archive) 62clean: clean-dist 63