diff --git a/b2g/app/Makefile.in b/b2g/app/Makefile.in
index 0f232ef9eef0..75f47480c8d0 100644
--- a/b2g/app/Makefile.in
+++ b/b2g/app/Makefile.in
@@ -8,8 +8,6 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
-USE_RCS_MK=1
-include $(topsrcdir)/config/makefiles/makeutils.mk
PREF_JS_EXPORTS = $(srcdir)/b2g.js
@@ -57,9 +55,15 @@ DEFINES += \
-DMOZ_UPDATER=$(MOZ_UPDATER) \
$(NULL)
-source_repo := $(call getSourceRepo,$(srcdir)/..)
-ifneq (,$(filter http%,$(source_repo)))
- DEFINES += -DMOZ_SOURCE_REPO="$(source_repo)"
+# strip a trailing slash from the repo URL because it's not always present,
+# and we want to construct a working URL in buildconfig.html
+# make+shell+sed = awful
+_dollar=$$
+SOURCE_REPO := $(shell cd $(srcdir)/.. && hg showconfig paths.default 2>/dev/null | head -n1 | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
+# extra sanity check for old versions of hg
+# that don't support showconfig
+ifeq (http,$(patsubst http%,http,$(SOURCE_REPO)))
+DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
endif
ifeq ($(OS_ARCH),WINNT)
diff --git a/build/Makefile.in b/build/Makefile.in
index c522ef0b43e4..8ad0466c7f36 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -9,8 +9,6 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
-USE_RCS_MK=1
-include $(topsrcdir)/config/makefiles/makeutils.mk
MODULE = build
@@ -68,9 +66,10 @@ ifdef MOZ_SOURCE_STAMP
DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
endif
-source_repo := $(call getSourceRepo,$(topsrcdir)/$(MOZ_BUILD_APP)/..)
-ifneq (,$(source_repo))
- DEFINES += -DMOZ_SOURCE_REPO="$(source_repo)"
+_dollar=$$
+SOURCE_REPO := $(shell cd $(topsrcdir)/$(MOZ_BUILD_APP)/.. && hg showconfig paths.default 2>/dev/null | head -n1 | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
+ifdef SOURCE_REPO
+DEFINES += -DMOZ_SOURCE_REPO="$(SOURCE_REPO)"
endif
DEFINES += \
diff --git a/config/makefiles/makeutils.mk b/config/makefiles/makeutils.mk
index f63d7764806a..71ebe281c855 100644
--- a/config/makefiles/makeutils.mk
+++ b/config/makefiles/makeutils.mk
@@ -106,15 +106,9 @@ endif #}
###########################################################################
## Common makefile library loader
-## USE_AUTOTARGETS_MK - mkdir_deps directory creation
-## USE_RCS_MK - revision control functions
###########################################################################
topORerr =$(if $(topsrcdir),$(topsrcdir),$(error topsrcdir is not defined))
ifdef USE_AUTOTARGETS_MK # mkdir_deps
include $(topORerr)/config/makefiles/autotargets.mk
endif
-
-ifdef USE_RCS_MK
- include $(topORerr)/config/makefiles/rcs.mk
-endif
diff --git a/config/makefiles/rcs.mk b/config/makefiles/rcs.mk
deleted file mode 100644
index 4e2030da3056..000000000000
--- a/config/makefiles/rcs.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- makefile -*-
-# vim:set ts=8 sw=8 sts=8 noet:
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-###########################################################################
-## Accessor functions:
-## $(call getRcsType): .git, .hg
-## $(call getSourceRepo) == http://hg.mozilla.org/mozilla-central
-###########################################################################
-
-ifdef USE_RCS_MK #{
-ifndef INCLUDED_RCS_MK #{
-
-# Determine revision control system in use: .hg, .git, etc
-# Call getRcsType() at least once, $(RCS_TYPE) will be defined
-#
-define FUNC_rcstype =
- MOZ_RCS_TYPE := $(notdir $(firstword \
- $(wildcard \
- $(or $(1),$(topsrcdir))/.hg\
- $(or $(1),$(topsrcdir))/.git\
- ))
- )
-endef
-getRcsType = $(or $(MOZ_RCS_TYPE),$(eval $(call FUNC_rcstype))$(MOZ_RCS_TYPE))
-MOZ_RCS_TYPE := $(call getRcsType)
-
-###########################################################################
-# HAVE_MERCURIAL_RCS (todo: include rcs.$(MOZ_RCS_TYPE).mk git, hg)
-###########################################################################
-ifneq (,$(findstring .hg,$(MOZ_RCS_TYPE)))
-
-# Intent: Retrieve the http:// repository path for a directory.
-# Usage: $(call getSourceRepo[,repo_dir|args])
-# Args:
-# path (optional): repository to query. Defaults to $(topsrcdir)
-getSourceRepo =$(call FUNC_getSourceRepo,$(if $(1),cd $(1) && hg,hg --repository $(topsrcdir)))
-
-# http://hg.mozilla.org/mozilla-central
-FUNC_getSourceRepo=\
- $(patsubst %/,%,\
- $(patsubst ssh://%,http://%,\
- $(strip \
- $(firstword $(shell $(getargv) showconfig paths.default))\
- )))
-
-endif #} HAVE_MERCURIAL_RCS
-
-###########################################################################
-# HAVE_GIT_RCS
-###########################################################################
-ifneq (,$(findstring .git,$(MOZ_RCS_TYPE)))
- # git://github.com/mozilla/...
- getSourceRepo = $(firstword $(shell $(getargv) git config --get remote.origin.url))
-endif #} HAVE_GIT_RCS
-
-INCLUDED_RCS_MK=1
-endif #}
-
-endif #}
diff --git a/config/makefiles/test/Makefile.in b/config/makefiles/test/Makefile.in
index 742e791b24ba..697df3205e95 100644
--- a/config/makefiles/test/Makefile.in
+++ b/config/makefiles/test/Makefile.in
@@ -19,14 +19,12 @@ dir-ts = .deps/test
check-arglist = $(dir-ts)/arglist.ts
check-autotargets = $(dir-ts)/autotargets_mk.ts
check-export-targets = $(dir-ts)/export-targets-mk.ts
-check-rcs-mk = $(dir-ts)/rcs-mk.ts
check-XinY = $(dir-ts)/check_XinY_mk.ts
check-xpidl = $(dir-ts)/xpidl-mk.ts
check-tests =\
$(check-arglist) \
$(check-autotargets) \
$(check-export-targets) \
- $(check-rcs-mk) \
$(check-XinY) \
$(check-xpidl) \
$(NULL)
@@ -126,21 +124,6 @@ $(check-export-targets): $(check-export-targets-preqs)
@$(TOUCH) $@
#
-
-###########################################################################
-#
-check-rcs-preqs=\
- $(call mkdir_deps,$(dir-ts)) \
- $(topsrcdir)/config/makefiles/rcs.mk \
- $(srcdir)/check-rcs.mk \
- $(NULL)
-
-$(check-rcs-mk): $(check-rcs-preqs)
- $(MAKE) --no-print-directory -f $(srcdir)/check-rcs.mk topsrcdir=$(topsrcdir)
- $(TOUCH) $@
-#
-
-
###########################################################################
##{
check-xpidl-preqs=\
diff --git a/config/makefiles/test/check-rcs.mk b/config/makefiles/test/check-rcs.mk
deleted file mode 100644
index 85f6b2601095..000000000000
--- a/config/makefiles/test/check-rcs.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- makefile -*-
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-
-ifdef VERBOSE
- $(warning loading test)
-endif
-
-include $(topsrcdir)/config/makefiles/makeutils.mk
-
-USE_RCS_MK = 1
-include $(topsrcdir)/config/makefiles/rcs.mk
-
-$(call requiredfunction,getargv)
-$(call requiredfunction,getRcsType)
-$(call errorIfEmpty,INCLUDED_RCS_MK)
-
-saved := $(MOZ_RCS_TYPE)
-undefine MOZ_RCS_TYPE # Clear to force value gathering
-type = $(call getRcsType)
-ifneq ($(type),$(saved))
- $(error getRcsType[$(type)] != MOZ_RCS_TYPE[$(saved)])
-endif
-
-# Limit testing to systems getSourceRepo() has been written for
-ifneq (,$(MOZ_RCS_TYPE))
- $(call requiredfunction,getSourceRepo)
-
- repo := $(call getSourceRepo)
- $(if $(eq $(repo),$(NULL)),$(error getSourceRepo() failed))
-
- repo := $(call getSourceRepo,../..)
- $(if $(eq $(repo),$(NULL)),$(error getSourceRepo(../..) failed))
-endif
-
-
-compile-time-tests:
- @true
diff --git a/config/rules.mk b/config/rules.mk
index b21bb179cafe..c9e8099cbdc4 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1764,6 +1764,7 @@ default all::
#############################################################################
# Derived targets and dependencies
+include $(topsrcdir)/config/makefiles/autotargets.mk
ifneq ($(NULL),$(AUTO_DEPS))
default all libs tools export:: $(AUTO_DEPS)
endif
diff --git a/js/src/config/makefiles/makeutils.mk b/js/src/config/makefiles/makeutils.mk
index f63d7764806a..71ebe281c855 100644
--- a/js/src/config/makefiles/makeutils.mk
+++ b/js/src/config/makefiles/makeutils.mk
@@ -106,15 +106,9 @@ endif #}
###########################################################################
## Common makefile library loader
-## USE_AUTOTARGETS_MK - mkdir_deps directory creation
-## USE_RCS_MK - revision control functions
###########################################################################
topORerr =$(if $(topsrcdir),$(topsrcdir),$(error topsrcdir is not defined))
ifdef USE_AUTOTARGETS_MK # mkdir_deps
include $(topORerr)/config/makefiles/autotargets.mk
endif
-
-ifdef USE_RCS_MK
- include $(topORerr)/config/makefiles/rcs.mk
-endif
diff --git a/js/src/config/makefiles/rcs.mk b/js/src/config/makefiles/rcs.mk
deleted file mode 100644
index 4e2030da3056..000000000000
--- a/js/src/config/makefiles/rcs.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- makefile -*-
-# vim:set ts=8 sw=8 sts=8 noet:
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this file,
-# You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-###########################################################################
-## Accessor functions:
-## $(call getRcsType): .git, .hg
-## $(call getSourceRepo) == http://hg.mozilla.org/mozilla-central
-###########################################################################
-
-ifdef USE_RCS_MK #{
-ifndef INCLUDED_RCS_MK #{
-
-# Determine revision control system in use: .hg, .git, etc
-# Call getRcsType() at least once, $(RCS_TYPE) will be defined
-#
-define FUNC_rcstype =
- MOZ_RCS_TYPE := $(notdir $(firstword \
- $(wildcard \
- $(or $(1),$(topsrcdir))/.hg\
- $(or $(1),$(topsrcdir))/.git\
- ))
- )
-endef
-getRcsType = $(or $(MOZ_RCS_TYPE),$(eval $(call FUNC_rcstype))$(MOZ_RCS_TYPE))
-MOZ_RCS_TYPE := $(call getRcsType)
-
-###########################################################################
-# HAVE_MERCURIAL_RCS (todo: include rcs.$(MOZ_RCS_TYPE).mk git, hg)
-###########################################################################
-ifneq (,$(findstring .hg,$(MOZ_RCS_TYPE)))
-
-# Intent: Retrieve the http:// repository path for a directory.
-# Usage: $(call getSourceRepo[,repo_dir|args])
-# Args:
-# path (optional): repository to query. Defaults to $(topsrcdir)
-getSourceRepo =$(call FUNC_getSourceRepo,$(if $(1),cd $(1) && hg,hg --repository $(topsrcdir)))
-
-# http://hg.mozilla.org/mozilla-central
-FUNC_getSourceRepo=\
- $(patsubst %/,%,\
- $(patsubst ssh://%,http://%,\
- $(strip \
- $(firstword $(shell $(getargv) showconfig paths.default))\
- )))
-
-endif #} HAVE_MERCURIAL_RCS
-
-###########################################################################
-# HAVE_GIT_RCS
-###########################################################################
-ifneq (,$(findstring .git,$(MOZ_RCS_TYPE)))
- # git://github.com/mozilla/...
- getSourceRepo = $(firstword $(shell $(getargv) git config --get remote.origin.url))
-endif #} HAVE_GIT_RCS
-
-INCLUDED_RCS_MK=1
-endif #}
-
-endif #}
diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk
index b21bb179cafe..c9e8099cbdc4 100644
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -1764,6 +1764,7 @@ default all::
#############################################################################
# Derived targets and dependencies
+include $(topsrcdir)/config/makefiles/autotargets.mk
ifneq ($(NULL),$(AUTO_DEPS))
default all libs tools export:: $(AUTO_DEPS)
endif
diff --git a/toolkit/content/Makefile.in b/toolkit/content/Makefile.in
index 3539896f01c0..40086389855b 100644
--- a/toolkit/content/Makefile.in
+++ b/toolkit/content/Makefile.in
@@ -9,9 +9,6 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
-USE_RCS_MK=1
-include $(topsrcdir)/config/makefiles/makeutils.mk
-
CHROME_DEPS = buildconfig.html
include $(DEPTH)/config/autoconf.mk
@@ -39,9 +36,15 @@ ifeq (Android,$(OS_TARGET))
DEFINES += -DANDROID_PACKAGE_NAME=$(ANDROID_PACKAGE_NAME)
endif
-source_repo := $(call getSourceRepo)
-ifneq (,$(filter http%,$(source_repo)))
- DEFINES += -DSOURCE_REPO="$(source_repo)"
+# strip a trailing slash from the repo URL because it's not always present,
+# and we want to construct a working URL in buildconfig.html
+# make+shell+sed = awful
+_dollar=$$
+SOURCE_REPO := $(shell cd $(topsrcdir) && hg showconfig paths.default 2>/dev/null | head -n1 | sed -e "s/^ssh:/http:/" -e "s/\/$(_dollar)//" )
+# extra sanity check for old versions of hg
+# that don't support showconfig
+ifeq (http,$(patsubst http%,http,$(SOURCE_REPO)))
+DEFINES += -DSOURCE_REPO="$(SOURCE_REPO)"
endif
BUILD_HOSTNAME = $(shell hostname -s || hostname)
diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in
index 91b222d4b37b..da950662b75b 100644
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -11,8 +11,6 @@ srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
-USE_RCS_MK=1
-include $(topsrcdir)/config/makefiles/makeutils.mk
milestone_txt = $(topsrcdir)/config/milestone.txt
@@ -224,13 +222,20 @@ ifdef MOZ_SOURCE_STAMP
INIARGS = --sourcestamp=$(MOZ_SOURCE_STAMP)
+ # strip a trailing slash from the repo URL because it's not always present,
+ # and we want to construct a working URL in buildconfig.html
+ SOURCE_REPO := $(firstword $(shell hg --repository $(topsrcdir) showconfig paths.default 2>/dev/null))
+ SOURCE_REPO := $(strip $(SOURCE_REPO))
+ SOURCE_REPO := $(patsubst ssh://%,http://%,$(SOURCE_REPO))
+ SOURCE_REPO := $(patsubst %/,%,$(SOURCE_REPO))
+
# command set should change based on revision control use.
# warn for now in case (git, bzr, ...) is in use.
- source_repo := $(call getSourceRepo)
+ $(call warnIfEmpty,SOURCE_REPO)
# extra sanity check for old versions of hg, no showconfig support
- ifneq (,$(filter http%,$(source_repo)))
- INIARGS += --sourcerepo=$(source_repo)
+ ifeq (http,$(patsubst http%,http,$(SOURCE_REPO)))
+ INIARGS += --sourcerepo=$(SOURCE_REPO)
endif
endif # MOZ_SOURCE_STAMP