blob: af47130783eaa57d6ff6036a0f7ee82617ee931d [file] [log] [blame]
swissChili729acd52024-03-05 11:52:45 -05001CFLAGS = -Os -DSUPPORT_UTF8 -sASYNCIFY -sEXPORTED_RUNTIME_METHODS=ccall,cwrap,stringToNewUTF8 \
2 -sEXPORTED_FUNCTIONS=_test_int,_do_a_conversion -sMODULARIZE -s 'EXPORT_NAME="createMyModule"' \
swissChiliab615d82024-03-08 17:15:13 -05003 --no-entry
swissChili729acd52024-03-05 11:52:45 -05004
swissChiliab615d82024-03-08 17:15:13 -05005ESFLAGS = --bundle --minify --loader:.js=jsx
6
7WEBCFLAGS = -Os -framework WebKit -std=c++11
8
swissChili16de3222024-03-08 17:55:11 -05009webview-frontend: webview-frontend.cpp units.o getopt.o getopt1.o parse.tab.o strfunc.o | bundle-webview-js.h
swissChiliab615d82024-03-08 17:15:13 -050010 g++ $^ -o webview-frontend $(WEBCFLAGS) -I json/include
swissChili4f0a0a82024-03-08 18:58:38 -050011 strip $@
swissChiliab615d82024-03-08 17:15:13 -050012
swissChiliab615d82024-03-08 17:15:13 -050013units.wasm: units.c
swissChili729acd52024-03-05 11:52:45 -050014 emcc -o units.lib.js *.c $(CFLAGS) --preload-file definitions.units --preload-file elements.units --preload-file currency.units --preload-file cpi.units
15
swissChiliab615d82024-03-08 17:15:13 -050016units-host: units.c
swissChili729acd52024-03-05 11:52:45 -050017 gcc *.c -o units-host -g
18
swissChiliab615d82024-03-08 17:15:13 -050019%.o: %.c
20 gcc -c $^ -Os -o $@
21
22bundle.js: frontend.js units.wasm
23 yarn esbuild frontend.js $(ESFLAGS) --outfile=bundle.js
24
25bundle-webview-js.h: bundle-webview.js
26 xxd -i $^ > $@
27
swissChili16de3222024-03-08 17:55:11 -050028bundle-webview.js: webview-frontend.js frontend-impl.js styles.css
swissChili4f0a0a82024-03-08 18:58:38 -050029 yarn esbuild styles.css --outfile=styles.css.txt --minify
swissChiliab615d82024-03-08 17:15:13 -050030 yarn esbuild webview-frontend.js $(ESFLAGS) --outfile=bundle-webview.js
31
swissChili4f0a0a82024-03-08 18:58:38 -050032watch: units.wasm
swissChiliab615d82024-03-08 17:15:13 -050033 yarn esbuild frontend.js $(ESFLAGS) --watch --outfile=bundle.js
34
swissChili16de3222024-03-08 17:55:11 -050035.PHONY: watch webview-frontend