diff --git a/Makefile b/Makefile index c75337a62..fce9cd974 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,11 @@ dist/pyodide.asm.js: \ [ -d dist ] || mkdir dist $(CXX) -o dist/pyodide.asm.js $(filter %.o,$^) \ $(MAIN_MODULE_LDFLAGS) + + if [[ -n $${PYODIDE_SOURCEMAP+x} ]] || [[ -n $${PYODIDE_SYMBOLS+x} ]]; then \ + cd dist && npx prettier -w pyodide.asm.js ; \ + fi + # Strip out C++ symbols which all start __Z. # There are 4821 of these and they have VERY VERY long names. # To show some stats on the symbols you can use the following: diff --git a/Makefile.envs b/Makefile.envs index 49e91dbb3..cbfaf12a8 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -55,12 +55,21 @@ export DBG_LDFLAGS_SOURCEMAPDEBUG=-gseparate-dwarf export DBGFLAGS=$(DBGFLAGS_NODEBUG) -# Include debug symbols but no source maps (most useful) -#export DBGFLAGS=$(DBGFLAGS_WASMDEBUG) +ifdef PYODIDE_SOURCEMAP + # Debug with source maps (less useful than WASMDEBUG but easier if it helps) + export DBGFLAGS=$(DBGFLAGS_SOURCEMAPDEBUG) + export DBG_LDFLAGS=$(DBG_LDFLAGS_SOURCEMAPDEBUG) +else + ifdef PYODIDE_SYMBOLS + # Include debug symbols but no source maps (most useful) + export DBGFLAGS=$(DBGFLAGS_WASMDEBUG) + endif +endif + +ifdef PYODIDE_ASSERTIONS + EXTRA_CFLAGS+=" -DDEBUG_F" +endif -# Debug with source maps (less useful than WASMDEBUG but easier if it helps) -#export DBGFLAGS=$(DBGFLAGS_SOURCEMAPDEBUG) -#export DBG_LDFLAGS=$(DBG_LDFLAGS_SOURCEMAPDEBUG) export OPTFLAGS=-O2 export CFLAGS_BASE=\