-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
51 lines (45 loc) · 1.33 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
# Enable optimisations by default
EMPYOPT?=1
COPT=$$([ $(EMPYOPT) = 1 ] && echo -Oz || echo "-O0 -g")
EMDEBUG=\
-O0\
-g3\
--js-opts 0\
--llvm-opts 0\
--llvm-lto 0\
-s ASSERTIONS=2\
EMOPT=\
-O3\
-g0\
--js-opts 1\
--llvm-opts 3\
--llvm-lto 3\
-s ASSERTIONS=0\
#--closure 0
EMFLAGS=\
--pre-js js/preJs.js --post-js js/postJs.js\
--memory-init-file 0\
-s INCLUDE_FULL_LIBRARY=0\
-s EMULATE_FUNCTION_POINTER_CASTS=1\
$$([ $(EMPYOPT) = 1 ] && echo $(EMOPT) || echo $(EMDEBUG))
EMEXPORTS=\
-s EXPORTED_FUNCTIONS="['_Py_Initialize', '_PyRun_SimpleString']" -s "EXTRA_EXPORTED_RUNTIME_METHODS=['cwrap']"
empython.js: python/libpython3.5.a
./mapfiles.py python/Lib datafilezip > js/postJs.js
cat js/postJs.js.in >> js/postJs.js
emcc $(EMFLAGS) $(EMEXPORTS) -o $@ $< python/Modules/zlib/libz.a
CONFFLAGS=OPT="$(COPT)" --without-threads --without-pymalloc --disable-shared --disable-ipv6
prep:
./configure
make python
cp python ../python.native
make clean
git clean -f -x -d
em:
cd Modules/zlib && emconfigure ./configure --static && emmake make libz.a
(export BASECFLAGS=-m32 LDFLAGS=-m32 && emconfigure ./configure $(CONFFLAGS))
git apply ../hacks.patch
emmake make || true # errors on running python
mv python python.bc # only useful if replacing the emscripten test .bc file
cp ../python.native python && chmod +x python
emmake make