From c9fa963e71258c5adfb71cf1996cd1bcb33df0bb Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 26 Feb 2023 08:54:17 +0100 Subject: Start with copy of whiteboard --- webassembly/Makefile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webassembly/Makefile (limited to 'webassembly/Makefile') diff --git a/webassembly/Makefile b/webassembly/Makefile new file mode 100644 index 0000000..0487d2a --- /dev/null +++ b/webassembly/Makefile @@ -0,0 +1,32 @@ +TARGET=libwhiteboard.wasm +TARGETJS=$(TARGET:.wasm=.js) + +OBJS=diff.o + +CXX=em++ + +CXXFLAGS=-I./include -O2 -std=c++20 +LDFLAGS=-s WASM=1 -s EXPORTED_FUNCTIONS="['_diff_create', '_diff_apply', '_free']" +# Note: Instead of the above explicit EXPORTED_FUNCTIONS, the following causes ~7x wasm file size: +#-s LINKABLE=1 -s EXPORT_ALL=1 + +default: $(TARGET) + +$(OBJS): include + +include: + mkdir include + cp -r /usr/include/boost include/boost + +$(TARGET): $(OBJS) + $(CXX) $(LDFLAGS) $(OBJS) -o $(TARGETJS) + cp $(TARGETJS) $(TARGET) ../html/ + +diff.o: ../diff.cpp + $(CXX) -c $< $(CXXFLAGS) -o $@ + # run again in case em++ just asked to re-run (on pbuilder/buildd) + test -e $@ || $(CXX) -c $< $(CXXFLAGS) -o $@ + +clean: + -rm -f *.o *.js *.wasm *.html + -rm -rf include -- cgit v1.2.3