Bug 1099430, mozilla-central parts: Eliminate the duplication of the build system in comm-central, r=glandium.
authorJoshua Cranmer <Pidgeot18@gmail.com>
Sat, 29 Nov 2014 19:45:31 -0600
changeset 243949 e0c5ab3acc4e9e9652c0ce8ee56aeadd48e0346b
parent 243948 86a74bc04076f44e7e2bbea08197efd40eb9dd77
child 243950 727de0929cca98367a737ca70a13a100fbd11206
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1099430
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1099430, mozilla-central parts: Eliminate the duplication of the build system in comm-central, r=glandium. See the revisions a few steps prior for more fine-grained information. This just needs to be relanded because our automation doesn't like non-ASCII commit messages.
config/baseconfig.mk
config/config.mk
config/makefiles/makeutils.mk
config/rules.mk
config/tests/makefiles/autodeps/testor.tmpl
config/version.mk
toolkit/mozapps/installer/package-name.mk
--- a/config/baseconfig.mk
+++ b/config/baseconfig.mk
@@ -126,8 +126,15 @@ else
   $(NULL)
 
 # Freeze the values specified by moz.build to catch them if they fail.
 
 $(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES) $(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
 
 TIERS := export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools
 endif
+
+# These defines are used to support the twin-topsrcdir model for comm-central.
+ifdef MOZILLA_SRCDIR
+  MOZILLA_DIR = $(MOZILLA_SRCDIR)
+else
+  MOZILLA_DIR = $(topsrcdir)
+endif
--- a/config/config.mk
+++ b/config/config.mk
@@ -89,17 +89,17 @@ CHECK_VARS := \
 
 # checks for internal spaces or trailing spaces in the variable
 # named by $x
 check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
 
 $(foreach x,$(CHECK_VARS),$(check-variable))
 
 ifndef INCLUDED_FUNCTIONS_MK
-include $(topsrcdir)/config/makefiles/functions.mk
+include $(MOZILLA_DIR)/config/makefiles/functions.mk
 endif
 
 RM = rm -f
 
 # LIBXUL_DIST is not defined under js/src, thus we make it mean DIST there.
 LIBXUL_DIST ?= $(DIST)
 
 # FINAL_TARGET specifies the location into which we copy end-user-shipped
@@ -117,25 +117,33 @@ FINAL_TARGET_FROZEN := '$(FINAL_TARGET)'
 ifdef XPI_NAME
 DEFINES += -DXPI_NAME=$(XPI_NAME)
 endif
 
 # The VERSION_NUMBER is suffixed onto the end of the DLLs we ship.
 VERSION_NUMBER		= 50
 
 ifeq ($(HOST_OS_ARCH),WINNT)
-win_srcdir	:= $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
-BUILD_TOOLS	= $(WIN_TOP_SRC)/build/unix
+  ifeq ($(MOZILLA_DIR),$(topsrcdir))
+    win_srcdir := $(subst $(topsrcdir),$(WIN_TOP_SRC),$(srcdir))
+  else
+    # This means we're in comm-central's topsrcdir, so we need to adjust
+    # WIN_TOP_SRC (which points to mozilla's topsrcdir) for the substitution
+    # to win_srcdir.
+		cc_WIN_TOP_SRC := $(WIN_TOP_SRC:%/mozilla=%)
+    win_srcdir := $(subst $(topsrcdir),$(cc_WIN_TOP_SRC),$(srcdir))
+  endif
+  BUILD_TOOLS = $(WIN_TOP_SRC)/build/unix
 else
-win_srcdir	:= $(srcdir)
-BUILD_TOOLS	= $(topsrcdir)/build/unix
+  win_srcdir := $(srcdir)
+  BUILD_TOOLS = $(MOZILLA_DIR)/build/unix
 endif
 
 CONFIG_TOOLS	= $(MOZ_BUILD_ROOT)/config
-AUTOCONF_TOOLS	= $(topsrcdir)/build/autoconf
+AUTOCONF_TOOLS	= $(MOZILLA_DIR)/build/autoconf
 
 #
 # Strip off the excessively long version numbers on these platforms,
 # but save the version to allow multiple versions of the same base
 # platform to be built in the same tree.
 #
 ifneq (,$(filter FreeBSD HP-UX Linux NetBSD OpenBSD SunOS,$(OS_ARCH)))
 OS_RELEASE	:= $(basename $(OS_RELEASE))
@@ -324,17 +332,17 @@ OS_INCLUDES := \
   $(NSPR_CFLAGS) $(NSS_CFLAGS) \
   $(MOZ_JPEG_CFLAGS) \
   $(MOZ_PNG_CFLAGS) \
   $(MOZ_ZLIB_CFLAGS) \
   $(MOZ_PIXMAN_CFLAGS) \
   $(NULL)
 endif
 
-include $(topsrcdir)/config/static-checking-config.mk
+include $(MOZILLA_DIR)/config/static-checking-config.mk
 
 CFLAGS		= $(OS_CPPFLAGS) $(OS_CFLAGS)
 CXXFLAGS	= $(OS_CPPFLAGS) $(OS_CXXFLAGS)
 LDFLAGS		= $(OS_LDFLAGS) $(MOZBUILD_LDFLAGS) $(MOZ_FIX_LINK_PATHS)
 
 # Allow each module to override the *default* optimization settings
 # by setting MODULE_OPTIMIZE_FLAGS if the developer has not given
 # arguments to --enable-optimize
@@ -515,17 +523,17 @@ GARBAGE		+= $(DEPENDENCIES) core $(wildc
 
 ifeq ($(OS_ARCH),Darwin)
 ifndef NSDISTMODE
 NSDISTMODE=absolute_symlink
 endif
 PWD := $(CURDIR)
 endif
 
-NSINSTALL_PY := $(PYTHON) $(abspath $(topsrcdir)/config/nsinstall.py)
+NSINSTALL_PY := $(PYTHON) $(abspath $(MOZILLA_DIR)/config/nsinstall.py)
 # For Pymake, wherever we use nsinstall.py we're also going to try to make it
 # a native command where possible. Since native commands can't be used outside
 # of single-line commands, we continue to provide INSTALL for general use.
 # Single-line commands should be switched over to install_cmd.
 NSINSTALL_NATIVECMD := %nsinstall nsinstall
 
 ifdef NSINSTALL_BIN
 NSINSTALL = $(NSINSTALL_BIN)
@@ -616,23 +624,23 @@ endif # ! WINNT
 
 # Make sure any compiled classes work with at least JVM 1.4
 JAVAC_FLAGS += -source 1.4
 
 ifdef MOZ_DEBUG
 JAVAC_FLAGS += -g
 endif
 
-CREATE_PRECOMPLETE_CMD = $(PYTHON) $(abspath $(topsrcdir)/config/createprecomplete.py)
+CREATE_PRECOMPLETE_CMD = $(PYTHON) $(abspath $(MOZILLA_DIR)/config/createprecomplete.py)
 
 # MDDEPDIR is the subdirectory where dependency files are stored
 MDDEPDIR := .deps
 
-EXPAND_LIBS_EXEC = $(PYTHON) $(topsrcdir)/config/expandlibs_exec.py
-EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/expandlibs_gen.py
+EXPAND_LIBS_EXEC = $(PYTHON) $(MOZILLA_DIR)/config/expandlibs_exec.py
+EXPAND_LIBS_GEN = $(PYTHON) $(MOZILLA_DIR)/config/expandlibs_gen.py
 EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
 EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
 EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
 EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
 EXPAND_MKSHLIB_ARGS = --uselist
 ifdef SYMBOL_ORDER
 EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
 endif
@@ -676,17 +684,17 @@ OBJ_SUFFIX := $(_OBJ_SUFFIX)
 ifndef NO_PROFILE_GUIDED_OPTIMIZE
 ifdef MOZ_PROFILE_GENERATE
 ifdef GNU_CC
 OBJ_SUFFIX := i_o
 endif
 endif
 endif
 
-PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
+PLY_INCLUDE = -I$(MOZILLA_DIR)/other-licenses/ply
 
 export CL_INCLUDES_PREFIX
 # Make sure that the build system can handle non-ASCII characters
 # in environment variables to prevent it from breking silently on
 # non-English systems.
 export NONASCII
 
 DEFINES += -DNO_NSPR_10_SUPPORT
--- a/config/makefiles/makeutils.mk
+++ b/config/makefiles/makeutils.mk
@@ -102,17 +102,21 @@ checkIfEmpty =$(foreach var,$(wordlist 2
 errorIfEmpty =$(call checkIfEmpty,error $(argv))
 warnIfEmpty  =$(call checkIfEmpty,warning $(argv))
 
 endif #}
 
 ###########################################################################
 ## Common makefile library loader
 ###########################################################################
-topORerr =$(if $(topsrcdir),$(topsrcdir),$(error topsrcdir is not defined))
+ifdef MOZILLA_DIR
+topORerr = $(MOZILLA_DIR)
+else
+topORerr = $(if $(topsrcdir),$(topsrcdir),$(error topsrcdir is not defined))
+endif
 
 ifdef USE_AUTOTARGETS_MK # mkdir_deps
   include $(topORerr)/config/makefiles/autotargets.mk
 endif
 
 ifdef USE_RCS_MK
   include $(topORerr)/config/makefiles/rcs.mk
 endif
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -15,30 +15,26 @@ ifdef INCLUDED_RULES_MK
 $(error Do not include rules.mk twice!)
 endif
 INCLUDED_RULES_MK = 1
 
 # Make sure that anything that needs to be defined in moz.build wasn't
 # overwritten after including config.mk.
 _eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
 
-ifndef MOZILLA_DIR
-MOZILLA_DIR = $(topsrcdir)
-endif
-
 ifndef INCLUDED_CONFIG_MK
 include $(topsrcdir)/config/config.mk
 endif
 
 ifndef INCLUDED_VERSION_MK
-include $(topsrcdir)/config/version.mk
+include $(MOZILLA_DIR)/config/version.mk
 endif
 
 USE_AUTOTARGETS_MK = 1
-include $(topsrcdir)/config/makefiles/makeutils.mk
+include $(MOZILLA_DIR)/config/makefiles/makeutils.mk
 
 ifdef REBUILD_CHECK
 REPORT_BUILD = $(info $(shell $(PYTHON) $(MOZILLA_DIR)/config/rebuild_check.py $@ $^))
 else
 REPORT_BUILD = $(info $(notdir $@))
 endif
 
 EXEC			= exec
@@ -86,22 +82,22 @@ INCLUDES += -I$(DIST)/include/testing
 ifndef MOZ_PROFILE_GENERATE
 CPP_UNIT_TESTS_FILES = $(CPP_UNIT_TESTS)
 CPP_UNIT_TESTS_DEST = $(DIST)/cppunittests
 CPP_UNIT_TESTS_TARGET = target
 INSTALL_TARGETS += CPP_UNIT_TESTS
 endif
 
 run-cppunittests::
-	@$(PYTHON) $(topsrcdir)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(CPP_UNIT_TESTS)
+	@$(PYTHON) $(MOZILLA_DIR)/testing/runcppunittests.py --xre-path=$(DIST)/bin --symbols-path=$(DIST)/crashreporter-symbols $(CPP_UNIT_TESTS)
 
 cppunittests-remote: DM_TRANS?=adb
 cppunittests-remote:
 	@if [ '${TEST_DEVICE}' != '' -o '$(DM_TRANS)' = 'adb' ]; then \
-		$(PYTHON) -u $(topsrcdir)/testing/remotecppunittests.py \
+		$(PYTHON) -u $(MOZILLA_DIR)/testing/remotecppunittests.py \
 			--xre-path=$(DEPTH)/dist/bin \
 			--localLib=$(DEPTH)/dist/$(MOZ_APP_NAME) \
 			--dm_trans=$(DM_TRANS) \
 			--deviceIP=${TEST_DEVICE} \
 			$(CPP_UNIT_TESTS) $(EXTRA_TEST_ARGS); \
 	else \
 		echo 'please prepare your host with environment variables for TEST_DEVICE'; \
 	fi
@@ -219,17 +215,17 @@ EXTRA_DEPS += $(DEFFILE)
 endif
 
 endif # !GNU_CC
 
 endif # WINNT
 
 ifeq ($(SOLARIS_SUNPRO_CXX),1)
 ifeq (86,$(findstring 86,$(OS_TEST)))
-OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
+OS_LDFLAGS += -M $(MOZILLA_DIR)/config/solaris_ia32.map
 endif # x86
 endif # Solaris Sun Studio C++
 
 ifeq ($(HOST_OS_ARCH),WINNT)
 HOST_PDBFILE=$(basename $(@F)).pdb
 HOST_PDB_FLAG ?= -Fd$(HOST_PDBFILE)
 HOST_CFLAGS += $(HOST_PDB_FLAG)
 HOST_CXXFLAGS += $(HOST_PDB_FLAG)
@@ -556,29 +552,29 @@ endif
 everything::
 	$(MAKE) clean
 	$(MAKE) all
 
 STATIC_LIB_DEP = $(if $(wildcard $(1).$(LIBS_DESC_SUFFIX)),$(1).$(LIBS_DESC_SUFFIX),$(1))
 STATIC_LIBS_DEPS := $(foreach l,$(STATIC_LIBS),$(call STATIC_LIB_DEP,$(l)))
 
 # Dependencies which, if modified, should cause everything to rebuild
-GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(topsrcdir)/config/config.mk
+GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(MOZILLA_DIR)/config/config.mk
 
 ##############################################
 ifdef COMPILE_ENVIRONMENT
 OBJ_TARGETS = $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS)
 
 compile:: host target
 
 host:: $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS)
 
 target:: $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS)
 
-include $(topsrcdir)/config/makefiles/target_binaries.mk
+include $(MOZILLA_DIR)/config/makefiles/target_binaries.mk
 endif
 
 ##############################################
 ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE))
 ifdef MOZ_PROFILE_USE
 ifeq ($(OS_ARCH)_$(GNU_CC), WINNT_)
 # When building with PGO, we have to make sure to re-link
 # in the MOZ_PROFILE_USE phase if we linked in the
@@ -593,21 +589,21 @@ ifdef PROGRAM
 endif
 
 # In the second pass, we need to merge the pgc files into the pgd file.
 # The compiler would do this for us automatically if they were in the right
 # place, but they're in dist/bin.
 ifneq (,$(SHARED_LIBRARY)$(PROGRAM))
 export::
 ifdef PROGRAM
-	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
+	$(PYTHON) $(MOZILLA_DIR)/build/win32/pgomerge.py \
 	  $(PROGRAM:$(BIN_SUFFIX)=) $(DIST)/bin
 endif
 ifdef SHARED_LIBRARY
-	$(PYTHON) $(topsrcdir)/build/win32/pgomerge.py \
+	$(PYTHON) $(MOZILLA_DIR)/build/win32/pgomerge.py \
 	  $(patsubst $(DLL_PREFIX)%$(DLL_SUFFIX),%,$(SHARED_LIBRARY)) $(DIST)/bin
 endif
 endif # SHARED_LIBRARY || PROGRAM
 endif # WINNT_
 endif # MOZ_PROFILE_USE
 ifdef MOZ_PROFILE_GENERATE
 # Clean up profiling data during PROFILE_GENERATE phase
 export::
@@ -851,24 +847,24 @@ endif
 
 ifeq ($(SOLARIS_SUNPRO_CC),1)
 _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
 
 define MAKE_DEPS_AUTO_CC
 if test -d $(@D); then \
 	echo 'Building deps for $< using Sun Studio cc'; \
 	$(CC) $(COMPILE_CFLAGS) -xM  $< >$(_MDDEPFILE) ; \
-	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
+	$(PYTHON) $(MOZILLA_DIR)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
 fi
 endef
 define MAKE_DEPS_AUTO_CXX
 if test -d $(@D); then \
 	echo 'Building deps for $< using Sun Studio CC'; \
 	$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
-	$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
+	$(PYTHON) $(MOZILLA_DIR)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
 fi
 endef
 endif # Sun Studio on Solaris
 
 # The object file is in the current directory, and the source file can be any
 # relative path. This macro adds the dependency obj: src for each source file.
 # This dependency must be first for the $< flag to work correctly, and the
 # rules that have commands for these targets must not list any other
@@ -1096,17 +1092,17 @@ normalizepath = $(foreach p,$(1),$(if $(
 else
 normalizepath = $(1)
 endif
 
 ###############################################################################
 # Java rules
 ###############################################################################
 ifneq (,$(JAVAFILES)$(ANDROID_RESFILES)$(ANDROID_APKNAME)$(JAVA_JAR_TARGETS))
-  include $(topsrcdir)/config/makefiles/java-build.mk
+  include $(MOZILLA_DIR)/config/makefiles/java-build.mk
 endif
 
 ###############################################################################
 # Bunch of things that extend the 'export' rule (in order):
 ###############################################################################
 
 ifneq ($(XPI_NAME),)
 $(FINAL_TARGET):
@@ -1542,17 +1538,17 @@ MDDEPEND_FILES := $(strip $(wildcard $(a
 ifneq (,$(MDDEPEND_FILES))
 $(call include_deps,$(MDDEPEND_FILES))
 endif
 
 endif
 
 # Pull in non-recursive targets if this is a partial tree build.
 ifndef TOPLEVEL_BUILD
-include $(topsrcdir)/config/makefiles/nonrecursive.mk
+include $(MOZILLA_DIR)/config/makefiles/nonrecursive.mk
 endif
 
 ################################################################################
 # Special gmake rules.
 ################################################################################
 
 
 #
@@ -1577,17 +1573,17 @@ tags: TAGS
 
 TAGS: $(CSRCS) $(CPPSRCS) $(wildcard *.h)
 	-etags $(CSRCS) $(CPPSRCS) $(wildcard *.h)
 	$(LOOP_OVER_DIRS)
 
 ifndef INCLUDED_DEBUGMAKE_MK #{
   ## Only parse when an echo* or show* target is requested
   ifneq (,$(call isTargetStem,echo,show))
-    include $(topsrcdir)/config/makefiles/debugmake.mk
+    include $(MOZILLA_DIR)/config/makefiles/debugmake.mk
   endif #}
 endif #}
 
 documentation:
 	@cd $(DEPTH)
 	$(DOXYGEN) $(DEPTH)/config/doxygen.cfg
 
 ifdef ENABLE_TESTS
@@ -1627,17 +1623,17 @@ default all:: $(PURGECACHES_FILES)
 $(PURGECACHES_FILES):
 	if test -d $(@D) ; then touch $@ ; fi
 
 .DEFAULT_GOAL := $(or $(OVERRIDE_DEFAULT_GOAL),default)
 
 #############################################################################
 # Derived targets and dependencies
 
-include $(topsrcdir)/config/makefiles/autotargets.mk
+include $(MOZILLA_DIR)/config/makefiles/autotargets.mk
 ifneq ($(NULL),$(AUTO_DEPS))
   default all libs tools export:: $(AUTO_DEPS)
 endif
 
 export:: $(GENERATED_FILES)
 
 GARBAGE += $(GENERATED_FILES)
 
--- a/config/tests/makefiles/autodeps/testor.tmpl
+++ b/config/tests/makefiles/autodeps/testor.tmpl
@@ -38,16 +38,17 @@ endif
 
 ###########################
 ## Minimal environment load
 ###########################
 MKDIR ?= mkdir -p
 TOUCH ?= touch
 
 INCLUDED_CONFIG_MK = 1
+MOZILLA_DIR := $(topsrcdir)
 include $(topsrcdir)/config/rules.mk
 
 ##-------------------##
 ##---]  TARGETS  [---##
 ##-------------------##
 all::
 
 # Quarks:
--- a/config/version.mk
+++ b/config/version.mk
@@ -10,17 +10,17 @@ INCLUDED_VERSION_MK=1
 # TODO:
 # PBI      : Private build info.  Not used currently.
 #            Guessing the best way would be to set an env var.
 # BINARY   : Binary name.  Not used currently.
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
 ifndef RESFILE
 RCFILE=./module.rc
 RESFILE=./module.res
-_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(topsrcdir) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) -APPVERSION $(MOZ_APP_VERSION)
+_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(MOZILLA_DIR) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) -APPVERSION $(MOZ_APP_VERSION)
 ifdef MOZILLA_OFFICIAL
 _RC_STRING += -OFFICIAL 1
 endif
 ifdef MOZ_DEBUG
 _RC_STRING += -DEBUG 1
 endif
 ifdef PROGRAM
 _RC_STRING += -BINARY $(PROGRAM)
@@ -37,15 +37,15 @@ ifdef RCINCLUDE
 _RC_STRING += -RCINCLUDE $(srcdir)/$(RCINCLUDE)
 endif
 
 GARBAGE += $(RESFILE) $(RCFILE)
 
 #dummy target so $(RCFILE) doesn't become the default =P
 all::
 
-$(RCFILE): $(RCINCLUDE) $(topsrcdir)/config/version_win.pl
-	$(PERL) $(topsrcdir)/config/version_win.pl $(_RC_STRING)
+$(RCFILE): $(RCINCLUDE) $(MOZILLA_DIR)/config/version_win.pl
+	$(PERL) $(MOZILLA_DIR)/config/version_win.pl $(_RC_STRING)
 
 endif  # RESFILE
 endif  # Windows
 
 endif
--- a/toolkit/mozapps/installer/package-name.mk
+++ b/toolkit/mozapps/installer/package-name.mk
@@ -134,17 +134,17 @@ TEST_PACKAGE = $(PKG_BASENAME).tests.zip
 ifneq (,$(wildcard $(DIST)/bin/application.ini))
 BUILDID = $(shell $(PYTHON) $(MOZILLA_DIR)/config/printconfigsetting.py $(DIST)/bin/application.ini App BuildID)
 else
 BUILDID = $(shell $(PYTHON) $(MOZILLA_DIR)/config/printconfigsetting.py $(DIST)/bin/platform.ini Build BuildID)
 endif
 
 ifndef INCLUDED_RCS_MK
   USE_RCS_MK := 1
-  include $(topsrcdir)/config/makefiles/makeutils.mk
+  include $(MOZILLA_DIR)/config/makefiles/makeutils.mk
 endif
 
 MOZ_SOURCE_STAMP = $(firstword $(shell hg -R $(MOZILLA_DIR) parent --template="{node|short}\n" 2>/dev/null))
 
 ###########################################################################
 # bug: 746277 - preserve existing functionality.
 # MOZILLA_DIR="": cd $(SPACE); hg # succeeds if ~/.hg exists
 ###########################################################################