Skip to content

Commit

Permalink
Add a separate install target for threaded libc (WebAssembly#331)
Browse files Browse the repository at this point in the history
Produce a different sysroot directory for threaded target. Restructure
`expected` directory to correspond to the target.
  • Loading branch information
penzn authored Dec 14, 2022
1 parent f687048 commit fb9c922
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ BULK_MEMORY_THRESHOLD ?= 32
# Variables from this point on are not meant to be overridable via the
# make command-line.

# Set the target variables. Multiarch triples notably omit the vendor field,
# which happens to be what we do for the main target triple too.
# Set the default WASI target triple.
TARGET_TRIPLE = wasm32-wasi
MULTIARCH_TRIPLE = wasm32-wasi

# Threaded version necessitates a different traget, as objects from different
# targets can't be mixed together while linking.
ifeq ($(THREAD_MODEL), posix)
TARGET_TRIPLE = wasm32-wasi-pthread
endif

# These variables describe the locations of various files and directories in
# the source tree.
Expand Down Expand Up @@ -365,9 +369,9 @@ LIBWASI_EMULATED_SIGNAL_MUSL_OBJS = $(call objs,$(LIBWASI_EMULATED_SIGNAL_MUSL_S

# These variables describe the locations of various files and
# directories in the generated sysroot tree.
SYSROOT_LIB := $(SYSROOT)/lib/$(MULTIARCH_TRIPLE)
SYSROOT_LIB := $(SYSROOT)/lib/$(TARGET_TRIPLE)
SYSROOT_INC = $(SYSROOT)/include
SYSROOT_SHARE = $(SYSROOT)/share/$(MULTIARCH_TRIPLE)
SYSROOT_SHARE = $(SYSROOT)/share/$(TARGET_TRIPLE)

# Files from musl's include directory that we don't want to install in the
# sysroot's include directory.
Expand Down Expand Up @@ -692,7 +696,7 @@ check-symbols: startup_files libc

# Check that the computed metadata matches the expected metadata.
# This ignores whitespace because on Windows the output has CRLF line endings.
diff -wur "$(CURDIR)/expected/$(MULTIARCH_TRIPLE)/$(THREAD_MODEL)" "$(SYSROOT_SHARE)"
diff -wur "$(CURDIR)/expected/$(TARGET_TRIPLE)" "$(SYSROOT_SHARE)"

install: finish
mkdir -p "$(INSTALL_DIR)"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit fb9c922

Please sign in to comment.