Bug 462451: Don't be confused by .deps dirs in the source tree. r=bsmedberg

$(MDDEPDIR) needs to be created in the build tree, but if make rules
list $(MDDEPDIR) as a dependency, then the VPATH search will tend to
find dependency directories in source trees if the source tree has
been configured in the past.  So use $(CURDIR)/$(MDDEPDIR) instead.

Some directory Makefiles have been adding $(MDDEPDIR) to MAKE_DIRS and
GARBAGE_DIRS explicitly, since they're not setting any of the
variables that would cause config/rules.mk to create $(MDDEPDIR)
automatically.  Those makefiles would have to use the $(CURDIR) trick
to defeat the VPATH search, too.  Instead, have rules.mk check an
additional variable NEED_MDDEPDIRS, and let the makefiles set that;
this keeps the magic in one place.
This commit is contained in:
Jim Blandy 2008-11-10 12:55:46 -08:00
Родитель 5f4fb19f45
Коммит 5f8373a321
4 изменённых файлов: 26 добавлений и 11 удалений

Просмотреть файл

@ -62,8 +62,8 @@ TARGETS = $(HOST_PROGRAM) $(PLSRCS:.pl=) $(SIMPLE_PROGRAMS)
ifndef CROSS_COMPILE
ifdef USE_ELF_DYNSTR_GC
TARGETS += elf-dynstr-gc
MAKE_DIRS += $(MDDEPDIR)
GARBAGE_DIRS += $(MDDEPDIR)
# Compiling the above will create dependency files.
NEED_MDDEPDIR = 1
endif
endif

Просмотреть файл

@ -396,8 +396,10 @@ HOST_PROGOBJS = $(HOST_OBJS)
endif
# MAKE_DIRS: List of directories to build while looping over directories.
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
MAKE_DIRS += $(MDDEPDIR)
# A Makefile that needs $(MDDEPDIR) created but doesn't set any of these
# variables we know to check can just set NEED_MDDEPDIR explicitly.
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
GARBAGE_DIRS += $(MDDEPDIR)
endif
@ -2041,7 +2043,13 @@ endif # COMPILER_DEPEND
# builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
# processes could simultaneously try to create the same directory.
#
$(MDDEPDIR):
# We use $(CURDIR) in the rule's target to ensure that we don't find
# a dependency directory in the source tree via VPATH (perhaps from
# a previous build in the source tree) and thus neglect to create a
# dependency directory in the object directory, where we really need
# it.
$(CURDIR)/$(MDDEPDIR):
@if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))

Просмотреть файл

@ -396,8 +396,10 @@ HOST_PROGOBJS = $(HOST_OBJS)
endif
# MAKE_DIRS: List of directories to build while looping over directories.
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS))
MAKE_DIRS += $(MDDEPDIR)
# A Makefile that needs $(MDDEPDIR) created but doesn't set any of these
# variables we know to check can just set NEED_MDDEPDIR explicitly.
ifneq (,$(OBJS)$(XPIDLSRCS)$(SDK_XPIDLSRCS)$(SIMPLE_PROGRAMS)$(NEED_MDDEPDIR))
MAKE_DIRS += $(CURDIR)/$(MDDEPDIR)
GARBAGE_DIRS += $(MDDEPDIR)
endif
@ -2041,7 +2043,13 @@ endif # COMPILER_DEPEND
# builds (-jN). If this were done in the LOOP_OVER_DIRS macro, two
# processes could simultaneously try to create the same directory.
#
$(MDDEPDIR):
# We use $(CURDIR) in the rule's target to ensure that we don't find
# a dependency directory in the source tree via VPATH (perhaps from
# a previous build in the source tree) and thus neglect to create a
# dependency directory in the object directory, where we really need
# it.
$(CURDIR)/$(MDDEPDIR):
@if test ! -d $@; then echo Creating $@; rm -rf $@; mkdir $@; else true; fi
ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))

Просмотреть файл

@ -41,9 +41,8 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
# MAKE_DIRS: List of directories to build while looping over directories.
MAKE_DIRS += $(MDDEPDIR)
GARBAGE_DIRS += $(MDDEPDIR)
# We will do compilations that create dependency files.
NEED_MDDEPDIR = 1
include $(DEPTH)/config/autoconf.mk