@@ -224,6 +224,33 @@ ifeq ($(SHLIB_EXPORTS),)
224224 override CXXFLAGS += $(CXXFLAGS_SL_MODULE)
225225endif
226226
227+ ifeq ($(PORTNAME), emscripten)
228+ LINK.shared = emsdk-shared
229+ ifdef soname
230+ # emscripten uses unversioned shared libraries
231+ shlib = $(shlib_bare)
232+ soname = $(shlib_bare)
233+ endif
234+ BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
235+ exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
236+ # ifneq (,$(exports_file))
237+ # LINK.shared += -Wl,--version-script=$(exports_file)
238+ # endif
239+ endif
240+
241+ ifeq ($(PORTNAME), wasi)
242+ LINK.shared = wasi-shared
243+ ifdef soname
244+ # emscripten uses unversioned shared libraries
245+ shlib = $(shlib_bare)
246+ soname = $(shlib_bare)
247+ endif
248+ BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
249+ exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
250+ # ifneq (,$(exports_file))
251+ # LINK.shared += -Wl,--version-script=$(exports_file)
252+ # endif
253+ endif
227254
228255##
229256## BUILD
@@ -239,8 +266,11 @@ all-lib: lib$(NAME).pc
239266endif
240267
241268all-static-lib: $(stlib)
242-
269+ ifdef wasi
270+ all-shared-lib: all-static-lib
271+ else
243272all-shared-lib: $(shlib)
273+ endif
244274
245275# In this rule, "touch $@" works around a problem on some platforms wherein
246276# ar updates the library file's mod time with a value calculated to
0 commit comments