@ -55,6 +55,7 @@ clean:
build/llvm.BUILT :
mkdir -p build/llvm
cd build/llvm && cmake -G Ninja \
-DCMAKE_MODULE_PATH= $( ROOT_DIR) /cmake \
-DCMAKE_BUILD_TYPE= MinSizeRel \
-DCMAKE_INSTALL_PREFIX= $( PREFIX) \
-DLLVM_TARGETS_TO_BUILD= WebAssembly \
@ -92,9 +93,14 @@ build/wasi-libc.BUILT: build/llvm.BUILT
touch build/wasi-libc.BUILT
build/compiler-rt.BUILT : build /llvm .BUILT
# Create an empty library so that cmake's configure checks which
# run the compiler to see if it produces working binaries succeed.
mkdir -p $( PREFIX) /lib/clang/$( CLANG_VERSION) /lib/wasi
$( AR) cr $( PREFIX) /lib/clang/$( CLANG_VERSION) /lib/wasi/libclang_rt.builtins-wasm32.a
# Do the build, and install it.
mkdir -p build/compiler-rt
cd build/compiler-rt && cmake -G Ninja \
-DCMAKE_MODULE_PATH= $( ROOT_DIR) /cmake \
-DCMAKE_BUILD_TYPE= RelWithDebInfo \
-DCMAKE_TOOLCHAIN_FILE= $( ROOT_DIR) /wasi-sdk.cmake \
-DCOMPILER_RT_BAREMETAL_BUILD= On \
@ -117,6 +123,7 @@ build/compiler-rt.BUILT: build/llvm.BUILT
# Flags for libcxx.
LIBCXX_CMAKE_FLAGS = \
-DCMAKE_MODULE_PATH= $( ROOT_DIR) /cmake \
-DCMAKE_TOOLCHAIN_FILE= $( ROOT_DIR) /wasi-sdk.cmake \
-DCMAKE_STAGING_PREFIX= $( PREFIX) /share/wasi-sysroot \
-DLLVM_CONFIG_PATH= $( ROOT_DIR) /build/llvm/bin/llvm-config \
@ -138,9 +145,12 @@ LIBCXX_CMAKE_FLAGS = \
-DWASI_SDK_PREFIX= $( BUILD_PREFIX) \
--debug-trycompile
#-DCMAKE_STAGING_PREFIX=
build/libcxx.BUILT : build /llvm .BUILT build /compiler -rt .BUILT build /wasi -libc .BUILT
# Create an empty library so that cmake's configure checks which
# run the compiler to see if it produces working binaries succeed.
mkdir -p $( PREFIX) /lib/clang/$( CLANG_VERSION) /lib/wasi
$( AR) cr $( PREFIX) /share/wasi-sysroot/lib/wasm32-wasi/libc++.a
$( AR) cr $( PREFIX) /share/wasi-sysroot/lib/wasm32-wasi/libc++abi.a
# Do the build.
mkdir -p build/libcxx
cd build/libcxx && cmake -G Ninja $( LIBCXX_CMAKE_FLAGS) \
@ -155,6 +165,7 @@ build/libcxx.BUILT: build/llvm.BUILT build/compiler-rt.BUILT build/wasi-libc.BUI
# Flags for libcxxabi.
LIBCXXABI_CMAKE_FLAGS = \
-DCMAKE_MODULE_PATH= $( ROOT_DIR) /cmake \
-DCMAKE_VERBOSE_MAKEFILE:BOOL= ON \
-DCMAKE_CXX_COMPILER_WORKS= ON \
-DCMAKE_C_COMPILER_WORKS= ON \
@ -180,6 +191,10 @@ LIBCXXABI_CMAKE_FLAGS = \
--debug-trycompile
build/libcxxabi.BUILT : build /libcxx .BUILT build /llvm .BUILT
# Create an empty library so that cmake's configure checks which
# run the compiler to see if it produces working binaries succeed.
mkdir -p $( PREFIX) /lib/clang/$( CLANG_VERSION) /lib/wasi
$( AR) cr $( PREFIX) /share/wasi-sysroot/lib/wasm32-wasi/libc++.a
# Do the build.
mkdir -p build/libcxxabi
cd build/libcxxabi && cmake -G Ninja $( LIBCXXABI_CMAKE_FLAGS) \