blob: 37b594f35200c1b3448962f7590a7cce48bfec6d [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
11
swissChiliab615d82024-03-08 17:15:13 -050012units.wasm: units.c
swissChili729acd52024-03-05 11:52:45 -050013 emcc -o units.lib.js *.c $(CFLAGS) --preload-file definitions.units --preload-file elements.units --preload-file currency.units --preload-file cpi.units
14
swissChiliab615d82024-03-08 17:15:13 -050015units-host: units.c
swissChili729acd52024-03-05 11:52:45 -050016 gcc *.c -o units-host -g
17
swissChiliab615d82024-03-08 17:15:13 -050018%.o: %.c
19 gcc -c $^ -Os -o $@
20
21bundle.js: frontend.js units.wasm
22 yarn esbuild frontend.js $(ESFLAGS) --outfile=bundle.js
23
24bundle-webview-js.h: bundle-webview.js
25 xxd -i $^ > $@
26
swissChili16de3222024-03-08 17:55:11 -050027bundle-webview.js: webview-frontend.js frontend-impl.js styles.css
28 cp styles.css styles.css.txt
swissChiliab615d82024-03-08 17:15:13 -050029 yarn esbuild webview-frontend.js $(ESFLAGS) --outfile=bundle-webview.js
30
31watch:
32 yarn esbuild frontend.js $(ESFLAGS) --watch --outfile=bundle.js
33
swissChili16de3222024-03-08 17:55:11 -050034.PHONY: watch webview-frontend