blob: 7fcb8d4e291c90e9117bf7a0be7ee24e89bc0574 [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
9webview-frontend: webview-frontend.cpp units.o getopt.o getopt1.o parse.tab.o strfunc.o
10 g++ $^ -o webview-frontend $(WEBCFLAGS) -I json/include
11
12webview-frontend.cpp: bundle-webview-js.h
13
14units.wasm: units.c
swissChili729acd52024-03-05 11:52:45 -050015 emcc -o units.lib.js *.c $(CFLAGS) --preload-file definitions.units --preload-file elements.units --preload-file currency.units --preload-file cpi.units
16
swissChiliab615d82024-03-08 17:15:13 -050017units-host: units.c
swissChili729acd52024-03-05 11:52:45 -050018 gcc *.c -o units-host -g
19
swissChiliab615d82024-03-08 17:15:13 -050020%.o: %.c
21 gcc -c $^ -Os -o $@
22
23bundle.js: frontend.js units.wasm
24 yarn esbuild frontend.js $(ESFLAGS) --outfile=bundle.js
25
26bundle-webview-js.h: bundle-webview.js
27 xxd -i $^ > $@
28
29bundle-webview.js: webview-frontend.js frontend-impl.js
30 yarn esbuild webview-frontend.js $(ESFLAGS) --outfile=bundle-webview.js
31
32watch:
33 yarn esbuild frontend.js $(ESFLAGS) --watch --outfile=bundle.js
34
35.PHONY: watch