Skip to content

Commit b7da692

Browse files
committed
Fix WebAssembly build requiring DTB dependencies
The emscripten build for SYSTEM mode embeds build/minimal.dtb via --embed-file, but after commit c6638da which fixed DTB compilation to be conditional, the DTB was not being built for emscripten builds. Add $(BUILD_DTB) and $(BUILD_DTB2C) to deps_emcc when ENABLE_SYSTEM=1 AND ENABLE_ELF_LOADER=0 AND CC_IS_EMCC=1 to ensure the DTB is built before emscripten attempts to embed it. The triple-nested condition is necessary because: - DTB compilation requires CFLAGS_dt macros (MEM_START, INITRD_START, etc.) - These macros are only defined when SYSTEM=1 AND ELF_LOADER=0 - Emscripten SYSTEM builds use the default ELF_LOADER=0 - CC_IS_EMCC guard prevents DTB from being built during `make distclean ENABLE_SYSTEM=1` when CC is not emcc (e.g., macOS workflow running distclean between builds) Fixes emscripten build errors: error: build/minimal.dtb@/minimal.dtb does not exist Error: <stdin>:12.31-32 syntax error (undefined macros) Fixes macOS workflow regression where `make distclean ENABLE_SYSTEM=1` incorrectly triggered DTB compilation when CC was not emcc.
1 parent c6638da commit b7da692

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mk/wasm.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ $(OUT)/elf_list.js: artifact tools/gen-elf-list-js.py
6565
# used to download all dependencies of elf executable and bundle into single wasm
6666
deps_emcc += artifact $(OUT)/elf_list.js $(DOOM_DATA) $(QUAKE_DATA) $(TIMIDITY_DATA)
6767

68+
# For SYSTEM mode, emscripten needs the DTB file to embed
69+
# DTB is only built when SYSTEM=1 and ELF_LOADER=0
70+
# Only add when actually using emcc, not when cleaning
71+
ifeq ("$(CC_IS_EMCC)", "1")
72+
ifeq ($(call has, SYSTEM), 1)
73+
ifeq ($(call has, ELF_LOADER), 0)
74+
deps_emcc += $(BUILD_DTB) $(BUILD_DTB2C)
75+
endif
76+
endif
77+
endif
78+
6879
# check browser version if supports TCO
6980
CHROME_MAJOR :=
7081
CHROME_MAJOR_VERSION_CHECK_CMD :=

0 commit comments

Comments
 (0)