-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
56 lines (48 loc) · 1.21 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
CODEC_URL := https://github.com/mchehab/zbar/archive/master.tar.gz
CODEC_DIR := node_modules/zbar
CODEC_OUT_RELATIVE := zbar/.libs/libzbar.a
CODEC_OUT := $(addprefix $(CODEC_DIR)/, $(CODEC_OUT_RELATIVE))
OUT_JS := zbar.wasm
OUT_WASM := $(OUT_JS:.js=.wasm)
all: $(OUT_JS)
zbar.wasm: zbar.c $(CODEC_OUT)
clang \
-v \
-I $(CODEC_DIR)/include \
${CXXFLAGS} \
-nostartfiles \
${LDFLAGS} \
-Wl,--no-entry \
-o $@ \
$+
$(CODEC_DIR)/zbar/.libs/libzbar.a: $(CODEC_DIR)/Makefile
$(MAKE) -C $(CODEC_DIR)
$(CODEC_DIR)/Makefile: $(CODEC_DIR)/configure
cd $(CODEC_DIR) && ./configure \
--without-java \
--enable-video=no \
--with-python=no \
--with-gir=no \
--with-gtk=no \
--with-dbus=no \
--enable-doc=no \
--with-x=no \
--with-qt=no \
--with-xshm=no \
--without-imagemagick \
--without-npapi \
--disable-assert \
--without-xv \
--without-jpeg \
--host=wasm32 \
--disable-pthread
$(CODEC_DIR)/configure: $(CODEC_DIR)/configure.ac
cd $(CODEC_DIR) && autoreconf -vfi
$(CODEC_DIR)/configure.ac: $(CODEC_DIR)
$(CODEC_DIR):
mkdir -p $@ && \
curl -sL $(CODEC_URL) | tar xz --strip 1 -C $@;
clean:
$(RM) $(OUT_JS) $(OUT_WASM)
$(RM) $(CODEC_DIR)/Makefile
$(MAKE) -C $(CODEC_DIR) clean