-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
36 lines (26 loc) · 1.02 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ----------------------------------------------------------------------
# Compile dependencies and our bridge C code to WebAssembly,
# using emscripten.
# ----------------------------------------------------------------------
EMSCRIPTEN_DOCKER_RUN=docker run --rm -v $(CURDIR)/deps/build:/src -v $(CURDIR)/src/lib:/src/lib -u emscripten trzeci/emscripten:sdk-tag-1.38.8-64bit
CC=$(EMSCRIPTEN_DOCKER_RUN) emcc
export
# ----------------------------------------------------------------------
.PHONY: all deps
all: dist/libpcre2.js
dist:
mkdir -p dist
deps:
$(MAKE) -C deps
# ----------------------------------------------------------------------
dist/libpcre2.js: src/lib/libpcre2.c src/lib/config.js | deps dist
$(CC) /src/lib/libpcre2.c \
-s WASM=1 \
--pre-js /src/lib/config.js \
-s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap", "ccall"]' \
-I/src/local/include \
-L/src/local/lib \
-lpcre2-16 \
-o libpcre2.js
cp deps/build/libpcre2.{wasm,js} dist/
# ----------------------------------------------------------------------