2021-07-06 11:28:39 +00:00
|
|
|
export PYVERSION ?= 3.9.5
|
2021-06-20 02:37:52 +00:00
|
|
|
export PYODIDE_EMSCRIPTEN_VERSION ?= 2.0.16
|
2021-03-10 08:13:53 +00:00
|
|
|
export PYODIDE_BINARYEN_VERSION ?= version_100
|
2019-01-10 12:40:01 +00:00
|
|
|
|
2021-01-03 11:25:14 +00:00
|
|
|
# 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
|
2018-05-16 17:06:44 +00:00
|
|
|
|
2021-03-26 14:37:59 +00:00
|
|
|
export TOOLSDIR=$(PYODIDE_ROOT)/tools
|
2021-07-06 11:28:39 +00:00
|
|
|
|
|
|
|
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)
|
2018-06-20 18:54:47 +00:00
|
|
|
export TARGETPYTHONROOT=$(PYODIDE_ROOT)/cpython/installs/python-$(PYVERSION)
|
2021-07-06 11:28:39 +00:00
|
|
|
export PYTHONINCLUDE=$(PYODIDE_ROOT)/cpython/installs/python-$(PYVERSION)/include/python$(PYMAJOR).$(PYMINOR)
|
2018-05-16 17:06:44 +00:00
|
|
|
|
2020-12-18 12:23:45 +00:00
|
|
|
# Use env variable if defined, otherwise fallback to './'
|
|
|
|
export PYODIDE_BASE_URL?=./
|
2021-01-01 07:48:28 +00:00
|
|
|
|
|
|
|
# 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
|
2018-12-25 09:44:09 +00:00
|
|
|
export PYODIDE_PACKAGE_ABI=1
|
2021-02-09 04:28:37 +00:00
|
|
|
export EM_COMPILER_WRAPPER=ccache
|
2021-03-26 14:37:59 +00:00
|
|
|
|
|
|
|
export OPTFLAGS=-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 \
|
2021-06-26 08:34:31 +00:00
|
|
|
-L $(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/ \
|
2021-03-26 14:37:59 +00:00
|
|
|
$(EXTRA_LDFLAGS)
|
|
|
|
|
|
|
|
export CXXFLAGS_BASE=
|
|
|
|
|
|
|
|
export SIDE_MODULE_LDFLAGS= $(LDFLAGS_BASE) -s SIDE_MODULE=1
|
|
|
|
export MAIN_MODULE_LDFLAGS= $(LDFLAGS_BASE) -s MAIN_MODULE=1 \
|
|
|
|
-s EXPORTED_FUNCTIONS='["___cxa_guard_acquire", "__ZNSt3__28ios_base4initEPv", "_main"]' \
|
2021-07-06 11:28:39 +00:00
|
|
|
-lpython$(PYMAJOR).$(PYMINOR) \
|
2021-06-26 08:34:31 +00:00
|
|
|
-lffi \
|
|
|
|
-lsqlite3 \
|
|
|
|
-lbz2 \
|
|
|
|
-lstdc++ \
|
2021-03-26 14:37:59 +00:00
|
|
|
-s TOTAL_MEMORY=20971520 \
|
|
|
|
-s ALLOW_MEMORY_GROWTH=1 \
|
|
|
|
--use-preload-plugins \
|
|
|
|
-s USE_FREETYPE=1 \
|
|
|
|
-s USE_LIBPNG=1 \
|
|
|
|
--memory-init-file 0 \
|
|
|
|
|
|
|
|
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 \
|
2021-06-19 22:49:25 +00:00
|
|
|
-I$(PYTHONINCLUDE)
|
2021-03-26 14:37:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
.output_vars:
|
|
|
|
set
|