Bug 1445398 - Do not re-generate buildid.h for every Tup build.
MozReview-Commit-ID: ErkTDOU8lYH
--- a/Makefile.in
+++ b/Makefile.in
@@ -146,25 +146,22 @@ ifneq (,$(filter FasterMake+RecursiveMak
install-manifests: faster
.PHONY: faster
faster: install-dist/idl
$(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
endif
.PHONY: tup
tup:
- $(call BUILDSTATUS,TIERS $(if $(MOZ_ARTIFACT_BUILDS),artifact )make tup)
+ $(call BUILDSTATUS,TIERS $(if $(MOZ_ARTIFACT_BUILDS),artifact )tup)
ifdef MOZ_ARTIFACT_BUILDS
$(call BUILDSTATUS,TIER_START artifact)
$(MAKE) recurse_artifact
$(call BUILDSTATUS,TIER_FINISH artifact)
endif
- $(call BUILDSTATUS,TIER_START make)
- $(MAKE) buildid.h source-repo.h
- $(call BUILDSTATUS,TIER_FINISH make)
$(call BUILDSTATUS,TIER_START tup)
@$(TUP) $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),,--verbose)
$(call BUILDSTATUS,TIER_FINISH tup)
.PHONY: $(addprefix install-,$(install_manifests))
$(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
@# If we're using the hybrid FasterMake/RecursiveMake backend, we want
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -183,16 +183,20 @@ class TupOnly(CommonBackend, PartialBack
'*.py',
'*.rs',
)
# These are 'group' dependencies - All rules that list these as an output
# will be built before any rules that list this as an input.
self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
+ # The preprocessor including source-repo.h and buildid.h creates
+ # dependencies that aren't specified by moz.build and cause errors
+ # in Tup. Express these as a group dependency.
+ self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
def _get_backend_file(self, relobjdir):
objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
if objdir not in self._backend_files:
self._backend_files[objdir] = \
BackendTupfile(objdir, self.environment,
self.environment.topsrcdir, self.environment.topobjdir)
return self._backend_files[objdir]
@@ -216,24 +220,20 @@ class TupOnly(CommonBackend, PartialBack
consumed = CommonBackend.consume_object(self, obj)
if consumed:
return True
backend_file = self._get_backend_file_for(obj)
if isinstance(obj, GeneratedFile):
- # These files are already generated by make before tup runs.
- skip_files = (
- 'buildid.h',
- 'source-repo.h',
- )
+ skip_files = []
if self.environment.is_artifact_build:
- skip_files = skip_files + self._compile_env_gen_files
+ skip_files = self._compile_env_gen_files
for f in obj.outputs:
if any(mozpath.match(f, p) for p in skip_files):
return False
if 'application.ini.h' in obj.outputs:
# application.ini.h is a special case since we need to process
# the FINAL_TARGET_PP_FILES for application.ini before running
@@ -266,16 +266,22 @@ class TupOnly(CommonBackend, PartialBack
self._process_computed_flags(obj, backend_file)
elif isinstance(obj, (Sources, GeneratedSources)):
backend_file.sources[obj.canonical_suffix].extend(obj.files)
elif isinstance(obj, HostSources):
backend_file.host_sources[obj.canonical_suffix].extend(obj.files)
elif isinstance(obj, VariablePassthru):
backend_file.variables = obj.variables
+ # The top-level Makefile.in still contains our driver target and some
+ # things related to artifact builds, so as a special case ensure the
+ # make backend generates a Makefile there.
+ if obj.objdir == self.environment.topobjdir:
+ return False
+
return True
def consume_finished(self):
CommonBackend.consume_finished(self)
# The approach here is similar to fastermake.py, but we
# simply write out the resulting files here.
for target, entries in self._manifest_entries.iteritems():
@@ -342,17 +348,21 @@ class TupOnly(CommonBackend, PartialBack
full_inputs = [f.full_path for f in obj.inputs]
cmd.extend(full_inputs)
cmd.extend(shell_quote(f) for f in obj.flags)
outputs = []
outputs.extend(obj.outputs)
outputs.append('%s.pp' % obj.outputs[0])
- extra_outputs = [self._installed_files] if obj.required_for_compile else None
+ if any(f in obj.outputs for f in ('source-repo.h', 'buildid.h')):
+ extra_outputs = [self._early_generated_files]
+ else:
+ extra_outputs = [self._installed_files] if obj.required_for_compile else []
+ full_inputs += [self._early_generated_files]
backend_file.rule(
display='python {script}:{method} -> [%o]'.format(script=obj.script, method=obj.method),
cmd=cmd,
inputs=full_inputs,
outputs=outputs,
extra_outputs=extra_outputs,
)
@@ -509,16 +519,17 @@ class TupOnly(CommonBackend, PartialBack
base_input = mozpath.basename(target)
if base_input.endswith('.in'):
base_input = mozpath.splitext(base_input)[0]
output = mozpath.join(destdir, base_input) if destdir else base_input
backend_file.rule(
inputs=[input_file],
+ extra_inputs=[self._early_generated_files],
display='Preprocess %o',
cmd=cmd,
outputs=[output],
)
def _handle_ipdl_sources(self, ipdl_dir, sorted_ipdl_sources, sorted_nonstatic_ipdl_sources,
sorted_static_ipdl_sources, unified_ipdl_cppsrcs_mapping):
# Preferably we wouldn't have to import ipdl, but we need to parse the