1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 include $(GBUILDDIR
)/platform
/unxgcc.mk
12 gb_RUN_CONFIGURE
:= $(SRCDIR
)/solenv
/bin
/run-configure
13 # avoid -s SAFE_HEAP=1 - c.f. gh#8584 this breaks source maps
14 gb_EMSCRIPTEN_CPPFLAGS
:= -pthread
-s USE_PTHREADS
=1 -D_LARGEFILE64_SOURCE
-D_LARGEFILE_SOURCE
-s SUPPORT_LONGJMP
=wasm
15 gb_EMSCRIPTEN_LDFLAGS
:= $(gb_EMSCRIPTEN_CPPFLAGS
)
18 gb_EMSCRIPTEN_LDFLAGS
+= -s TOTAL_MEMORY
=1GB
20 ifeq ($(ENABLE_EMSCRIPTEN_PROXY_TO_PTHREAD
),)
21 gb_EMSCRIPTEN_LDFLAGS
+= -sPTHREAD_POOL_SIZE
=6
24 # Double the main thread stack size, but keep the default value for other threads:
25 gb_EMSCRIPTEN_LDFLAGS
+= -sSTACK_SIZE
=131072 -sDEFAULT_PTHREAD_STACK_SIZE
=65536
27 # To keep the link time (and memory) down, prevent all rewriting options from wasm-emscripten-finalize
28 # See emscripten.py, finalize_wasm, modify_wasm = True
29 # So we need WASM_BIGINT=1 and ASSERTIONS=1 (2 implies STACK_OVERFLOW_CHECK)
30 gb_EMSCRIPTEN_LDFLAGS
+= --bind
-s FORCE_FILESYSTEM
=1 -s WASM_BIGINT
=1 -s ERROR_ON_UNDEFINED_SYMBOLS
=1 -s FETCH
=1 -s ASSERTIONS
=1 -s EXIT_RUNTIME
=0 -s EXPORTED_RUNTIME_METHODS
=["UTF16ToString","stringToUTF16","UTF8ToString","ccall","cwrap","addOnPreMain","addOnPostRun","registerType","throwBindingError"$(if
$(ENABLE_QT6
),$(COMMA
)"FS"$(COMMA
)"callMain"$(COMMA
)"specialHTMLTargets")]
31 gb_EMSCRIPTEN_QTDEFS
:= -DQT_NO_LINKED_LIST
-DQT_NO_JAVA_STYLE_ITERATORS
-DQT_NO_EXCEPTIONS
-DQT_NO_DEBUG
-DQT_WIDGETS_LIB
-DQT_GUI_LIB
-DQT_CORE_LIB
33 ifeq ($(ENABLE_EMSCRIPTEN_JSPI
),TRUE
)
34 gb_EMSCRIPTEN_LDFLAGS
+= -sJSPI
37 ifeq ($(ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS
),TRUE
)
38 gb_EMSCRIPTEN_LDFLAGS
+= -sPROXY_POSIX_SOCKETS
-lwebsocket.js
41 gb_Executable_EXT
:= .js
42 gb_EMSCRIPTEN_EXCEPT
= -fwasm-exceptions
-s SUPPORT_LONGJMP
=wasm
44 gb_CXXFLAGS
+= $(gb_EMSCRIPTEN_CPPFLAGS
)
46 # Here we don't use += because gb_LinkTarget_EXCEPTIONFLAGS from com_GCC_defs.mk contains -fexceptions and
47 # gb_EMSCRIPTEN_EXCEPT already has -fwasm-exceptions
48 gb_LinkTarget_EXCEPTIONFLAGS
= $(gb_EMSCRIPTEN_EXCEPT
)
50 gb_LinkTarget_CFLAGS
+= $(gb_EMSCRIPTEN_CPPFLAGS
)
51 gb_LinkTarget_CXXFLAGS
+= $(gb_EMSCRIPTEN_CPPFLAGS
) $(gb_EMSCRIPTEN_EXCEPT
)
52 ifeq ($(ENABLE_QT5
),TRUE
)
53 gb_LinkTarget_CFLAGS
+= $(gb_EMSCRIPTEN_QTDEFS
)
54 gb_LinkTarget_CXXFLAGS
+= $(gb_EMSCRIPTEN_QTDEFS
)
56 gb_LinkTarget_LDFLAGS
+= $(gb_EMSCRIPTEN_LDFLAGS
) $(gb_EMSCRIPTEN_CPPFLAGS
) \
57 $(gb_EMSCRIPTEN_EXCEPT
) -sEXPORT_EXCEPTION_HANDLING_HELPERS
59 ifeq ($(ENABLE_OPTIMIZED
),TRUE
)
60 ifneq ($(ENABLE_SYMBOLS_FOR
),)
61 gb_LinkTarget__emscripten_warnings_ldflags
:= -Wno-limited-postlink-optimizations
65 # Linker and compiler optimize + debug flags are handled in LinkTarget.mk
67 gb_LINKERSTRIPDEBUGFLAGS
:=
68 # This maps to g3, no source maps, but DWARF with current emscripten!
69 # https://developer.chrome.com/blog/wasm-debugging-2020/
70 gb_DEBUGINFO_FLAGS
= -g
72 ifeq ($(HAVE_EXTERNAL_DWARF
),TRUE
)
73 gb_DEBUGINFO_FLAGS
+= -gsplit-dwarf
-gpubnames
76 gb_COMPILEROPTFLAGS
:= -O3
78 # We need at least code elimination, otherwise linking OOMs even with 64GB.
79 # So we "fake" -Og support to mean -O1 for Emscripten and always enable it for debug in configure.
80 gb_COMPILERDEBUGOPTFLAGS
:= -O1
81 gb_COMPILERNOOPTFLAGS
:= -O1
-fstrict-aliasing
-fstrict-overflow
83 # cleanup addition JS and wasm files for binaries
84 define gb_Executable_Executable_platform
85 $(call gb_LinkTarget_add_auxtargets
,$(2),\
86 $(patsubst %.lib
,%.linkdeps
,$(3)) \
87 $(patsubst %.lib
,%.wasm
,$(3)) \
88 $(if
$(EMSCRIPTEN_WORKERJS
),$(patsubst %.lib
,%.worker.js
,$(3))) \
89 $(patsubst %.lib
,%.wasm.dwp
,$(3)) \
94 define gb_CppunitTest_CppunitTest_platform
95 $(call gb_LinkTarget_add_auxtargets
,$(2),\
96 $(patsubst %.lib
,%.linkdeps
,$(3)) \
97 $(patsubst %.lib
,%.wasm
,$(3)) \
98 $(if
$(EMSCRIPTEN_WORKERJS
),$(patsubst %.lib
,%.worker.js
,$(3))) \
99 $(patsubst %.lib
,%.wasm.dwp
,$(3)) \
104 define gb_Library_get_rpath
107 define gb_Executable_get_rpath
110 # vim: set noet sw=4 ts=4