Skip to content

Commit 33c2083

Browse files
authored
Move all bindings-related code together (NFC) (#553)
This change is an effort to move all dependencies of the phony `bindings` target into one place, for clarity.
1 parent 777361d commit 33c2083

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

Makefile

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@ ifneq ($(LTO),no)
3535
CLANG_VERSION ?= $(shell ${CC} -dumpversion)
3636
override OBJDIR := $(OBJDIR)/llvm-lto/$(CLANG_VERSION)
3737
endif
38-
# The directory where we store files and tools for generating WASIp2 bindings
39-
BINDING_WORK_DIR ?= build/bindings
40-
# URL from which to retrieve the WIT files used to generate the WASIp2 bindings
41-
WASI_CLI_URL ?= https://github.com/WebAssembly/wasi-cli/archive/refs/tags/v0.2.0.tar.gz
42-
# URL from which to retrieve the `wit-bindgen` command used to generate the
43-
# WASIp2 bindings.
44-
WIT_BINDGEN_URL ?= https://github.com/bytecodealliance/wit-bindgen/releases/download/wit-bindgen-cli-0.17.0/wit-bindgen-v0.17.0-x86_64-linux.tar.gz
4538

4639
# When the length is no larger than this threshold, we consider the
4740
# overhead of bulk memory opcodes to outweigh the performance benefit,
@@ -926,6 +919,10 @@ finish: check-symbols
926919
endif
927920
endif
928921

922+
install: finish
923+
mkdir -p "$(INSTALL_DIR)"
924+
cp -r "$(SYSROOT)/lib" "$(SYSROOT)/share" "$(SYSROOT)/include" "$(INSTALL_DIR)"
925+
929926
DEFINED_SYMBOLS = $(SYSROOT_SHARE)/defined-symbols.txt
930927
UNDEFINED_SYMBOLS = $(SYSROOT_SHARE)/undefined-symbols.txt
931928

@@ -1053,9 +1050,19 @@ check-symbols: $(STARTUP_FILES) libc
10531050
# This ignores whitespace because on Windows the output has CRLF line endings.
10541051
diff -wur "$(EXPECTED_TARGET_DIR)" "$(SYSROOT_SHARE)"
10551052

1056-
install: finish
1057-
mkdir -p "$(INSTALL_DIR)"
1058-
cp -r "$(SYSROOT)/lib" "$(SYSROOT)/share" "$(SYSROOT)/include" "$(INSTALL_DIR)"
1053+
1054+
##### BINDINGS #################################################################
1055+
# The `bindings` target retrieves the necessary WIT files for the wasi-cli world
1056+
# and generates a header file used by the wasip2 target.
1057+
################################################################################
1058+
1059+
# The directory where we store files and tools for generating WASIp2 bindings
1060+
BINDING_WORK_DIR ?= build/bindings
1061+
# URL from which to retrieve the WIT files used to generate the WASIp2 bindings
1062+
WASI_CLI_URL ?= https://github.com/WebAssembly/wasi-cli/archive/refs/tags/v0.2.0.tar.gz
1063+
# URL from which to retrieve the `wit-bindgen` command used to generate the
1064+
# WASIp2 bindings.
1065+
WIT_BINDGEN_URL ?= https://github.com/bytecodealliance/wit-bindgen/releases/download/wit-bindgen-cli-0.17.0/wit-bindgen-v0.17.0-x86_64-linux.tar.gz
10591066

10601067
$(BINDING_WORK_DIR)/wasi-cli:
10611068
mkdir -p "$(BINDING_WORK_DIR)"

0 commit comments

Comments
 (0)