Bug 921307 - Aggregate dependencies in subdirectories that are still recursed with pseudo derecurse. r=gps

This commit is contained in:
Mike Hommey 2013-10-03 05:51:19 +09:00
parent c19339bb76
commit 44fe8c20f5
7 changed files with 88 additions and 54 deletions

View File

@ -243,10 +243,5 @@ ifdef MOZ_PSEUDO_DERECURSE
js/xpconnect/src/export: dom/bindings/export
accessible/src/xpcom/export: xpcom/xpidl/export
js/src/export: mfbt/export
# Temporary interdependencies for binaries, until bug 921307 is fixed.
# Avoid traversal of those directories when creating the aggregate dependency file
ifneq (binaries-deps,$(MAKECMDGOALS))
toolkit/library/binaries: js/src/binaries media/webrtc/trunk/binaries media/webrtc/signaling/binaries media/webrtc/trunk/testing/binaries media/webrtc/signalingtest/binaries media/mtransport/third_party/nrappkit/binaries media/mtransport/third_party/nICEr/binaries
endif
endif
endif

View File

@ -104,29 +104,16 @@ endif # !NO_DIST_INSTALL
ifdef MOZ_PSEUDO_DERECURSE
BINARIES_INSTALL_TARGETS := $(foreach category,$(INSTALL_TARGETS),$(if $(filter binaries,$($(category)_TARGET)),$(category)))
ifneq (,$(strip $(BINARIES_INSTALL_TARGETS)))
# Fill a dependency file with all the binaries installed somewhere in $(DIST)
# and with dependencies on the relevant backend files.
BINARIES_PP := $(MDDEPDIR)/binaries.pp
$(BINARIES_PP): Makefile backend.mk $(call mkdir_deps,$(MDDEPDIR))
$(BINARIES_PP): Makefile $(if $(EXTERNALLY_MANAGED_MAKE_FILE),,backend.mk) $(call mkdir_deps,$(MDDEPDIR))
@echo "$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
$(foreach file,$($(category)_FILES) $($(category)_EXECUTABLES),\
$($(category)_DEST)/$(notdir $(file)): $(file)%\
)\
))" | tr % '\n' > $@
endif
binaries libs:: $(TARGETS) $(BINARIES_PP)
# Aggregate all dependency files relevant to a binaries build. If there is nothing
# done in the current directory, just create an empty stamp.
# Externally managed make files (gyp managed) and root make files (js/src/Makefile)
# need to be recursed to do their duty, and creating a stamp would prevent that.
# In the future, we'll aggregate those.
ifneq (.,$(DEPTH))
ifndef EXTERNALLY_MANAGED_MAKE_FILE
@$(if $^,$(call py_action,link_deps,-o binaries --group-all --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) $(BINARIES_PP) $(wildcard $(addsuffix .pp,$(addprefix $(MDDEPDIR)/,$(notdir $(sort $(filter-out $(BINARIES_PP),$^) $(OBJ_TARGETS))))))),$(TOUCH) binaries)
endif
endif
))binaries: Makefile $(if $(EXTERNALLY_MANAGED_MAKE_FILE),,backend.mk)" | tr % '\n' > $@
else
binaries::

View File

@ -92,7 +92,7 @@ GARBAGE_DIRS += subtiers
# current tier.
# root.mk defines subtier_of_* variables, that map a normalized subdir path to
# a subtier name (e.g. subtier_of_memory_jemalloc = base)
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER): $(if $(WANT_STAMPS),%/Makefile %/backend.mk)
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
ifdef BUG_915535_FIXED
$(call BUILDSTATUS,TIERDIR_START $(CURRENT_TIER) $(subtier_of_$(subst /,_,$*)) $*)
endif
@ -127,7 +127,7 @@ recurse_$(CURRENT_TIER):
# Creating binaries-deps.mk directly would make us build it twice: once when beginning
# the build because of the include, and once at the end because of the stamps.
binaries-deps: $(wildcard $(addsuffix /binaries,$(CURRENT_DIRS)))
binaries-deps: $(addsuffix /binaries,$(CURRENT_DIRS))
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ",$(addsuffix ",$^)))
@$(TOUCH) $@
@ -193,3 +193,27 @@ endif # ifdef TIERS
endif # ifeq ($(EXTERNALLY_MANAGED_MAKE_FILE)_$(NO_RECURSE_MAKELEVEL),_$(MAKELEVEL))
endif # ifeq (1_.,$(MOZ_PSEUDO_DERECURSE)_$(DEPTH))
ifdef MOZ_PSEUDO_DERECURSE
ifdef EXTERNALLY_MANAGED_MAKE_FILE
# gyp-managed directories
recurse_targets := $(addsuffix /binaries,$(DIRS) $(PARALLEL_DIRS))
else
ifeq (.,$(DEPTH))
# top-level directories
recurse_targets := $(addsuffix /binaries,$(binaries_dirs))
ifdef recurse_targets
# only js/src has binaries_dirs, and we want to adjust paths for it.
want_abspaths = 1
endif
endif
endif
binaries libs:: $(TARGETS) $(BINARIES_PP)
# Aggregate all dependency files relevant to a binaries build except in
# the mozilla top-level directory.
ifneq (_.,$(recurse_targets)_$(DEPTH))
@$(if $(or $(recurse_targets),$^),$(call py_action,link_deps,-o binaries --group-all $(if $(want_abspaths),--abspaths )--topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) $(BINARIES_PP) $(wildcard $(addsuffix .pp,$(addprefix $(MDDEPDIR)/,$(notdir $(sort $(filter-out $(BINARIES_PP),$^) $(OBJ_TARGETS)))))) $(recurse_targets)))
endif
endif # ifdef MOZ_PSEUDO_DERECURSE

View File

@ -4,8 +4,12 @@ sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
ifneq (,$(filter /%,$(TOP_DIST)))
DIST = $(TOP_DIST)
else
ifeq (.,$(DEPTH))
DIST = $(TOP_DIST)
else
DIST = $(DEPTH)/$(TOP_DIST)
endif
endif
# We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't
# manually use it before config.mk inclusion

View File

@ -104,29 +104,16 @@ endif # !NO_DIST_INSTALL
ifdef MOZ_PSEUDO_DERECURSE
BINARIES_INSTALL_TARGETS := $(foreach category,$(INSTALL_TARGETS),$(if $(filter binaries,$($(category)_TARGET)),$(category)))
ifneq (,$(strip $(BINARIES_INSTALL_TARGETS)))
# Fill a dependency file with all the binaries installed somewhere in $(DIST)
# and with dependencies on the relevant backend files.
BINARIES_PP := $(MDDEPDIR)/binaries.pp
$(BINARIES_PP): Makefile backend.mk $(call mkdir_deps,$(MDDEPDIR))
$(BINARIES_PP): Makefile $(if $(EXTERNALLY_MANAGED_MAKE_FILE),,backend.mk) $(call mkdir_deps,$(MDDEPDIR))
@echo "$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
$(foreach file,$($(category)_FILES) $($(category)_EXECUTABLES),\
$($(category)_DEST)/$(notdir $(file)): $(file)%\
)\
))" | tr % '\n' > $@
endif
binaries libs:: $(TARGETS) $(BINARIES_PP)
# Aggregate all dependency files relevant to a binaries build. If there is nothing
# done in the current directory, just create an empty stamp.
# Externally managed make files (gyp managed) and root make files (js/src/Makefile)
# need to be recursed to do their duty, and creating a stamp would prevent that.
# In the future, we'll aggregate those.
ifneq (.,$(DEPTH))
ifndef EXTERNALLY_MANAGED_MAKE_FILE
@$(if $^,$(call py_action,link_deps,-o binaries --group-all --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) $(BINARIES_PP) $(wildcard $(addsuffix .pp,$(addprefix $(MDDEPDIR)/,$(notdir $(sort $(filter-out $(BINARIES_PP),$^) $(OBJ_TARGETS))))))),$(TOUCH) binaries)
endif
endif
))binaries: Makefile $(if $(EXTERNALLY_MANAGED_MAKE_FILE),,backend.mk)" | tr % '\n' > $@
else
binaries::

View File

@ -92,7 +92,7 @@ GARBAGE_DIRS += subtiers
# current tier.
# root.mk defines subtier_of_* variables, that map a normalized subdir path to
# a subtier name (e.g. subtier_of_memory_jemalloc = base)
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER): $(if $(WANT_STAMPS),%/Makefile %/backend.mk)
$(addsuffix /$(CURRENT_TIER),$(CURRENT_DIRS)): %/$(CURRENT_TIER):
ifdef BUG_915535_FIXED
$(call BUILDSTATUS,TIERDIR_START $(CURRENT_TIER) $(subtier_of_$(subst /,_,$*)) $*)
endif
@ -127,7 +127,7 @@ recurse_$(CURRENT_TIER):
# Creating binaries-deps.mk directly would make us build it twice: once when beginning
# the build because of the include, and once at the end because of the stamps.
binaries-deps: $(wildcard $(addsuffix /binaries,$(CURRENT_DIRS)))
binaries-deps: $(addsuffix /binaries,$(CURRENT_DIRS))
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ",$(addsuffix ",$^)))
@$(TOUCH) $@
@ -193,3 +193,27 @@ endif # ifdef TIERS
endif # ifeq ($(EXTERNALLY_MANAGED_MAKE_FILE)_$(NO_RECURSE_MAKELEVEL),_$(MAKELEVEL))
endif # ifeq (1_.,$(MOZ_PSEUDO_DERECURSE)_$(DEPTH))
ifdef MOZ_PSEUDO_DERECURSE
ifdef EXTERNALLY_MANAGED_MAKE_FILE
# gyp-managed directories
recurse_targets := $(addsuffix /binaries,$(DIRS) $(PARALLEL_DIRS))
else
ifeq (.,$(DEPTH))
# top-level directories
recurse_targets := $(addsuffix /binaries,$(binaries_dirs))
ifdef recurse_targets
# only js/src has binaries_dirs, and we want to adjust paths for it.
want_abspaths = 1
endif
endif
endif
binaries libs:: $(TARGETS) $(BINARIES_PP)
# Aggregate all dependency files relevant to a binaries build except in
# the mozilla top-level directory.
ifneq (_.,$(recurse_targets)_$(DEPTH))
@$(if $(or $(recurse_targets),$^),$(call py_action,link_deps,-o binaries --group-all $(if $(want_abspaths),--abspaths )--topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) $(BINARIES_PP) $(wildcard $(addsuffix .pp,$(addprefix $(MDDEPDIR)/,$(notdir $(sort $(filter-out $(BINARIES_PP),$^) $(OBJ_TARGETS)))))) $(recurse_targets)))
endif
endif # ifdef MOZ_PSEUDO_DERECURSE

View File

@ -84,22 +84,32 @@ Grouping = enum(NO=0, BY_DEPFILE=1, ALL_TARGETS=2)
class DependencyLinker(Makefile):
def __init__(self, topsrcdir, topobjdir, dist, group=Grouping.NO):
def __init__(self, topsrcdir, topobjdir, dist, group=Grouping.NO,
abspaths=False):
topsrcdir = mozpath.normsep(os.path.normcase(os.path.abspath(topsrcdir)))
topobjdir = mozpath.normsep(os.path.normcase(os.path.abspath(topobjdir)))
dist = mozpath.normsep(os.path.normcase(os.path.abspath(dist)))
if abspaths:
topsrcdir_value = topsrcdir
topobjdir_value = topobjdir
dist_value = dist
else:
topsrcdir_value = '$(topsrcdir)'
topobjdir_value = '$(DEPTH)'
dist_value = '$(DIST)'
self._normpaths = {
topsrcdir: '$(topsrcdir)',
topobjdir: '$(DEPTH)',
dist: '$(DIST)',
'$(topsrcdir)': '$(topsrcdir)',
'$(DEPTH)': '$(DEPTH)',
'$(DIST)': '$(DIST)',
'$(depth)': '$(DEPTH)', # normcase may lowercase variable refs when
'$(dist)': '$(DIST)', # they are in the original dependency file
mozpath.relpath(topsrcdir, os.curdir): '$(topsrcdir)',
mozpath.relpath(topobjdir, os.curdir): '$(DEPTH)',
mozpath.relpath(dist, os.curdir): '$(DIST)',
topsrcdir: topsrcdir_value,
topobjdir: topobjdir_value,
dist: dist_value,
'$(topsrcdir)': topsrcdir_value,
'$(DEPTH)': topobjdir_value,
'$(DIST)': dist_value,
'$(depth)': topobjdir_value, # normcase may lowercase variable refs when
'$(dist)': dist_value, # they are in the original dependency file
mozpath.relpath(topsrcdir, os.curdir): topsrcdir_value,
mozpath.relpath(topobjdir, os.curdir): topobjdir_value,
mozpath.relpath(dist, os.curdir): dist_value,
}
Makefile.__init__(self)
@ -184,6 +194,8 @@ def main(args):
help='Group dependencies by depfile.')
group.add_argument('--group-all', action='store_true',
help='Group all dependencies under one target.')
parser.add_argument('--abspaths', action='store_true',
help='Use absolute paths instead of using make variable references.')
opts = parser.parse_args(args)
if opts.group_by_depfile:
@ -195,7 +207,8 @@ def main(args):
linker = DependencyLinker(topsrcdir=opts.topsrcdir,
topobjdir=opts.topobjdir,
dist=opts.dist,
group=group)
group=group,
abspaths=opts.abspaths)
for f in opts.dependency_files:
linker.add_dependencies(open(f))