Bug 1831334 - Make sure every rust dependency has a default implicit rule r=glandium

When rustc generates its dependency file, it takes into account current
version of the codebase. If an update of the code then happens, with,
say an ipdl file being removed, the corresponding .h is no longer
generated and make rightfully complains about missing dependency.

Allow this kind of transition by providing a dummy rule for each
dependency generated by rustc.

Differential Revision: https://phabricator.services.mozilla.com/D178617
This commit is contained in:
serge-sans-paille 2023-05-29 11:00:35 +00:00
parent b5f289fcfd
commit 9ea38abea5

View File

@ -461,6 +461,13 @@ endif
endif
endif
define make_default_rule
$(1):
endef
$(foreach dep, $(filter %.h,$(RUST_LIBRARY_DEPS)),$(eval $(call make_default_rule,$(dep))))
SUGGEST_INSTALL_ON_FAILURE = (ret=$$?; if [ $$ret = 101 ]; then echo If $1 is not installed, install it using: cargo install $1; fi; exit $$ret)
ifndef CARGO_NO_AUTO_ARG
@ -542,6 +549,7 @@ define RUST_PROGRAM_DEPENDENCIES
$(1)_deps := $(wordlist 2, 10000000, $(if $(wildcard $(1).d),$(shell cat $(1).d)))
$(1): $(CARGO_FILE) $(call resfile,module) $(if $$($(1)_deps),$$($(1)_deps),force-cargo-program-build)
$(if $$($(1)_deps),+$(MAKE) force-cargo-program-build,:)
$(foreach dep,$(filter %.h,$$($(1)_deps)),$(eval $(call make_default_rule,$(dep))))
endef
$(foreach RUST_PROGRAM,$(RUST_PROGRAMS), $(eval $(call RUST_PROGRAM_DEPENDENCIES,$(RUST_PROGRAM))))