mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1620133 - Allow generated file rules to run in parallel in a given directory. r=firefox-build-system-reviewers,rstewart
Bug 1645986 solved the problem for most generated files by moving their rules to the top-level, but we're going to add rules that will end up in subdirectories, so we have to solve the same problem again, in the subdirectories. Differential Revision: https://phabricator.services.mozilla.com/D88389
This commit is contained in:
parent
9b123f057e
commit
a34742d98f
@ -11,6 +11,8 @@
|
|||||||
# of the generic macros.
|
# of the generic macros.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
varize = $(subst -,_,$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))))
|
||||||
|
|
||||||
# Define an include-at-most-once flag
|
# Define an include-at-most-once flag
|
||||||
ifdef INCLUDED_CONFIG_MK
|
ifdef INCLUDED_CONFIG_MK
|
||||||
$(error Do not include config.mk twice!)
|
$(error Do not include config.mk twice!)
|
||||||
@ -39,6 +41,10 @@ ifndef EXTERNALLY_MANAGED_MAKE_FILE
|
|||||||
ifndef STANDALONE_MAKEFILE
|
ifndef STANDALONE_MAKEFILE
|
||||||
GLOBAL_DEPS += backend.mk
|
GLOBAL_DEPS += backend.mk
|
||||||
include backend.mk
|
include backend.mk
|
||||||
|
|
||||||
|
# Add e.g. `export:: $(EXPORT_TARGETS)` rules. The *_TARGETS variables are defined
|
||||||
|
# in backend.mk.
|
||||||
|
$(foreach tier,$(RUNNABLE_TIERS),$(eval $(tier):: $($(call varize,$(tier))_TARGETS)))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -211,8 +211,6 @@ ifndef DEVELOPER_OPTIONS
|
|||||||
$(TARGET_RECIPES) $(HOST_RECIPES): RUSTFLAGS += -C codegen-units=1
|
$(TARGET_RECIPES) $(HOST_RECIPES): RUSTFLAGS += -C codegen-units=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cargo_env = $(subst -,_,$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))))
|
|
||||||
|
|
||||||
# We use the + prefix to pass down the jobserver fds to cargo, but we
|
# We use the + prefix to pass down the jobserver fds to cargo, but we
|
||||||
# don't use the prefix when make -n is used, so that cargo doesn't run
|
# don't use the prefix when make -n is used, so that cargo doesn't run
|
||||||
# in that case)
|
# in that case)
|
||||||
@ -235,8 +233,8 @@ define CARGO_CHECK
|
|||||||
$(call RUN_CARGO,check)
|
$(call RUN_CARGO,check)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
cargo_host_linker_env_var := CARGO_TARGET_$(call cargo_env,$(RUST_HOST_TARGET))_LINKER
|
cargo_host_linker_env_var := CARGO_TARGET_$(call varize,$(RUST_HOST_TARGET))_LINKER
|
||||||
cargo_linker_env_var := CARGO_TARGET_$(call cargo_env,$(RUST_TARGET))_LINKER
|
cargo_linker_env_var := CARGO_TARGET_$(call varize,$(RUST_TARGET))_LINKER
|
||||||
|
|
||||||
# Cargo needs the same linker flags as the C/C++ compiler,
|
# Cargo needs the same linker flags as the C/C++ compiler,
|
||||||
# but not the final libraries. Filter those out because they
|
# but not the final libraries. Filter those out because they
|
||||||
|
@ -80,9 +80,15 @@ class MakeBackend(CommonBackend):
|
|||||||
if tier and not needs_AB_rCD:
|
if tier and not needs_AB_rCD:
|
||||||
# Android localized resources have special Makefile
|
# Android localized resources have special Makefile
|
||||||
# handling.
|
# handling.
|
||||||
double_colon_tiers = ('export', 'pre-compile', 'libs', 'misc')
|
|
||||||
ret.append('%s%s %s' % (
|
# Double-colon tiers via a variable that the backend adds as a dependency
|
||||||
tier, '::' if tier in double_colon_tiers else ':', stub_file))
|
# later. See https://bugzilla.mozilla.org/show_bug.cgi?id=1645986#c0 as
|
||||||
|
# to why.
|
||||||
|
if tier in ('export', 'pre-compile', 'libs', 'misc'):
|
||||||
|
dep = '%s_TARGETS' % tier.replace('-', '_').upper()
|
||||||
|
ret.append('%s += %s' % (dep, stub_file))
|
||||||
|
else:
|
||||||
|
ret.append('%s: %s' % (tier, stub_file))
|
||||||
for output in outputs:
|
for output in outputs:
|
||||||
ret.append('%s: %s ;' % (output, stub_file))
|
ret.append('%s: %s ;' % (output, stub_file))
|
||||||
ret.append('GARBAGE += %s' % output)
|
ret.append('GARBAGE += %s' % output)
|
||||||
|
@ -402,7 +402,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'include $(topsrcdir)/config/AB_rCD.mk',
|
'include $(topsrcdir)/config/AB_rCD.mk',
|
||||||
'pre-compile:: $(MDDEPDIR)/bar.c.stub',
|
'PRE_COMPILE_TARGETS += $(MDDEPDIR)/bar.c.stub',
|
||||||
'bar.c: $(MDDEPDIR)/bar.c.stub ;',
|
'bar.c: $(MDDEPDIR)/bar.c.stub ;',
|
||||||
'GARBAGE += bar.c',
|
'GARBAGE += bar.c',
|
||||||
'GARBAGE += $(MDDEPDIR)/bar.c.stub',
|
'GARBAGE += $(MDDEPDIR)/bar.c.stub',
|
||||||
@ -412,7 +412,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
'$(call py_action,file_generate,%s/generate-bar.py baz bar.c $(MDDEPDIR)/bar.c.pp $(MDDEPDIR)/bar.c.stub)' % env.topsrcdir, # noqa
|
'$(call py_action,file_generate,%s/generate-bar.py baz bar.c $(MDDEPDIR)/bar.c.pp $(MDDEPDIR)/bar.c.stub)' % env.topsrcdir, # noqa
|
||||||
'@$(TOUCH) $@',
|
'@$(TOUCH) $@',
|
||||||
'',
|
'',
|
||||||
'export:: $(MDDEPDIR)/foo.h.stub',
|
'EXPORT_TARGETS += $(MDDEPDIR)/foo.h.stub',
|
||||||
'foo.h: $(MDDEPDIR)/foo.h.stub ;',
|
'foo.h: $(MDDEPDIR)/foo.h.stub ;',
|
||||||
'GARBAGE += foo.h',
|
'GARBAGE += foo.h',
|
||||||
'GARBAGE += $(MDDEPDIR)/foo.h.stub',
|
'GARBAGE += $(MDDEPDIR)/foo.h.stub',
|
||||||
@ -436,7 +436,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'include $(topsrcdir)/config/AB_rCD.mk',
|
'include $(topsrcdir)/config/AB_rCD.mk',
|
||||||
'pre-compile:: $(MDDEPDIR)/bar.c.stub',
|
'PRE_COMPILE_TARGETS += $(MDDEPDIR)/bar.c.stub',
|
||||||
'bar.c: $(MDDEPDIR)/bar.c.stub ;',
|
'bar.c: $(MDDEPDIR)/bar.c.stub ;',
|
||||||
'GARBAGE += bar.c',
|
'GARBAGE += bar.c',
|
||||||
'GARBAGE += $(MDDEPDIR)/bar.c.stub',
|
'GARBAGE += $(MDDEPDIR)/bar.c.stub',
|
||||||
@ -446,7 +446,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
'$(call py_action,file_generate,%s/generate-bar.py baz bar.c $(MDDEPDIR)/bar.c.pp $(MDDEPDIR)/bar.c.stub)' % env.topsrcdir, # noqa
|
'$(call py_action,file_generate,%s/generate-bar.py baz bar.c $(MDDEPDIR)/bar.c.pp $(MDDEPDIR)/bar.c.stub)' % env.topsrcdir, # noqa
|
||||||
'@$(TOUCH) $@',
|
'@$(TOUCH) $@',
|
||||||
'',
|
'',
|
||||||
'pre-compile:: $(MDDEPDIR)/foo.c.stub',
|
'PRE_COMPILE_TARGETS += $(MDDEPDIR)/foo.c.stub',
|
||||||
'foo.c: $(MDDEPDIR)/foo.c.stub ;',
|
'foo.c: $(MDDEPDIR)/foo.c.stub ;',
|
||||||
'GARBAGE += foo.c',
|
'GARBAGE += foo.c',
|
||||||
'GARBAGE += $(MDDEPDIR)/foo.c.stub',
|
'GARBAGE += $(MDDEPDIR)/foo.c.stub',
|
||||||
@ -470,7 +470,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'include $(topsrcdir)/config/AB_rCD.mk',
|
'include $(topsrcdir)/config/AB_rCD.mk',
|
||||||
'misc:: $(MDDEPDIR)/foo.xyz.stub',
|
'MISC_TARGETS += $(MDDEPDIR)/foo.xyz.stub',
|
||||||
'foo.xyz: $(MDDEPDIR)/foo.xyz.stub ;',
|
'foo.xyz: $(MDDEPDIR)/foo.xyz.stub ;',
|
||||||
'GARBAGE += foo.xyz',
|
'GARBAGE += foo.xyz',
|
||||||
'GARBAGE += $(MDDEPDIR)/foo.xyz.stub',
|
'GARBAGE += $(MDDEPDIR)/foo.xyz.stub',
|
||||||
@ -498,7 +498,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'include $(topsrcdir)/config/AB_rCD.mk',
|
'include $(topsrcdir)/config/AB_rCD.mk',
|
||||||
'misc:: $(MDDEPDIR)/foo.xyz.stub',
|
'MISC_TARGETS += $(MDDEPDIR)/foo.xyz.stub',
|
||||||
'foo.xyz: $(MDDEPDIR)/foo.xyz.stub ;',
|
'foo.xyz: $(MDDEPDIR)/foo.xyz.stub ;',
|
||||||
'GARBAGE += foo.xyz',
|
'GARBAGE += foo.xyz',
|
||||||
'GARBAGE += $(MDDEPDIR)/foo.xyz.stub',
|
'GARBAGE += $(MDDEPDIR)/foo.xyz.stub',
|
||||||
@ -508,7 +508,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
'$(call py_action,file_generate,--locale=$(AB_CD) %s/generate-foo.py main foo.xyz $(MDDEPDIR)/foo.xyz.pp $(MDDEPDIR)/foo.xyz.stub $(call MERGE_FILE,localized-input) $(srcdir)/non-localized-input)' % env.topsrcdir, # noqa
|
'$(call py_action,file_generate,--locale=$(AB_CD) %s/generate-foo.py main foo.xyz $(MDDEPDIR)/foo.xyz.pp $(MDDEPDIR)/foo.xyz.stub $(call MERGE_FILE,localized-input) $(srcdir)/non-localized-input)' % env.topsrcdir, # noqa
|
||||||
'@$(TOUCH) $@',
|
'@$(TOUCH) $@',
|
||||||
'',
|
'',
|
||||||
'misc:: $(MDDEPDIR)/abc.xyz.stub',
|
'MISC_TARGETS += $(MDDEPDIR)/abc.xyz.stub',
|
||||||
'abc.xyz: $(MDDEPDIR)/abc.xyz.stub ;',
|
'abc.xyz: $(MDDEPDIR)/abc.xyz.stub ;',
|
||||||
'GARBAGE += abc.xyz',
|
'GARBAGE += abc.xyz',
|
||||||
'GARBAGE += $(MDDEPDIR)/abc.xyz.stub',
|
'GARBAGE += $(MDDEPDIR)/abc.xyz.stub',
|
||||||
@ -533,7 +533,7 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||||||
|
|
||||||
expected = [
|
expected = [
|
||||||
'include $(topsrcdir)/config/AB_rCD.mk',
|
'include $(topsrcdir)/config/AB_rCD.mk',
|
||||||
'misc:: $(MDDEPDIR)/foo$(AB_CD).xyz.stub',
|
'MISC_TARGETS += $(MDDEPDIR)/foo$(AB_CD).xyz.stub',
|
||||||
'foo$(AB_CD).xyz: $(MDDEPDIR)/foo$(AB_CD).xyz.stub ;',
|
'foo$(AB_CD).xyz: $(MDDEPDIR)/foo$(AB_CD).xyz.stub ;',
|
||||||
'GARBAGE += foo$(AB_CD).xyz',
|
'GARBAGE += foo$(AB_CD).xyz',
|
||||||
'GARBAGE += $(MDDEPDIR)/foo$(AB_CD).xyz.stub',
|
'GARBAGE += $(MDDEPDIR)/foo$(AB_CD).xyz.stub',
|
||||||
|
Loading…
Reference in New Issue
Block a user