forked from pyodide/pyodide
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.envs
88 lines (74 loc) · 2.61 KB
/
Makefile.envs
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
export PYVERSION ?= 3.9.5
export PYODIDE_EMSCRIPTEN_VERSION ?= 2.0.16
export PYODIDE_BINARYEN_VERSION ?= version_100
# BASH_ENV tells bash to run pyodide_env.sh on startup, whcih sets various
# environment variables. The next line instructs make to use bash to run each
# command.
export BASH_ENV := $(PYODIDE_ROOT)/pyodide_env.sh
SHELL := /bin/bash
export TOOLSDIR=$(PYODIDE_ROOT)/tools
version_tuple := $(subst ., ,$(PYVERSION:v%=%))
export PYMAJOR=$(word 1,$(version_tuple))
export PYMINOR=$(word 2,$(version_tuple))
export PYMICRO=$(word 3,$(version_tuple))
export HOSTPYTHONROOT=$(shell python${PYMAJOR}.${PYMINOR} -c "import sys; print(sys.prefix)")
export HOSTPYTHON=$(HOSTPYTHONROOT)/bin/python$(PYMAJOR).$(PYMINOR)
export TARGETPYTHONROOT=$(PYODIDE_ROOT)/cpython/installs/python-$(PYVERSION)
export PYTHONINCLUDE=$(PYODIDE_ROOT)/cpython/installs/python-$(PYVERSION)/include/python$(PYMAJOR).$(PYMINOR)
# Use env variable if defined, otherwise fallback to './'
export PYODIDE_BASE_URL?=./
# This environment variable is used for packages to detect if they are built
# for pyodide during build time
export PYODIDE=1
# This is the legacy environment variable used for the aforementioned purpose
export PYODIDE_PACKAGE_ABI=1
export EM_COMPILER_WRAPPER=ccache
export OPTFLAGS=$(if $(PYODIDE_BUILD), "-Os", "-O2")
export CFLAGS_BASE=\
$(OPTFLAGS) \
-g \
-fPIC \
$(EXTRA_CFLAGS)
export LDFLAGS_BASE=\
-s BINARYEN_EXTRA_PASSES="--pass-arg=max-func-params@61" \
$(OPTFLAGS) \
-s MODULARIZE=1 \
-s EMULATE_FUNCTION_POINTER_CASTS=1 \
-s LINKABLE=1 \
-s EXPORT_ALL=1 \
-s WASM=1 \
-std=c++14 \
-s LZ4=1 \
-L $(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/ \
$(EXTRA_LDFLAGS)
export CXXFLAGS_BASE=
export SIDE_MODULE_LDFLAGS= $(LDFLAGS_BASE) -s SIDE_MODULE=1
export MAIN_MODULE_LDFLAGS= \
$(LDFLAGS_BASE) \
$(if $(PYODIDE_BUILD), , "-s MAIN_MODULE=1") \
-s EXPORTED_FUNCTIONS='["___cxa_guard_acquire", "__ZNSt3__28ios_base4initEPv", "_main"]' \
-lpython$(PYMAJOR).$(PYMINOR) \
-lffi \
-lsqlite3 \
-lbz2 \
-lstdc++ \
-s TOTAL_MEMORY=20971520 \
-s ALLOW_MEMORY_GROWTH=1 \
--use-preload-plugins \
-lstdc++ \
--memory-init-file 0 \
$(if $(PYODIDE_BUILD), , "-s USE_FREETYPE=1") \
$(if $(PYODIDE_BUILD), , "-s USE_LIBPNG=1") \
$(if $(PYODIDE_BUILD), , "-s USE_LIBJPEG=1") \
export SIDE_MODULE_CXXFLAGS = $(CXXFLAGS_BASE)
export SIDE_MODULE_CFLAGS= $(CFLAGS_BASE)
export MAIN_MODULE_CFLAGS= $(CFLAGS_BASE) \
-Wall \
-Wno-warn-absolute-paths \
-Werror=unused-variable \
-Werror=sometimes-uninitialized \
-Werror=int-conversion \
-Werror=incompatible-pointer-types \
-I$(PYTHONINCLUDE)
.output_vars:
set