diff --git a/contrib/bootstrap b/contrib/bootstrap
index a9346cd2e6e142d6acc956f6b151b39314eb130b..c51a5fd45fa5b835562b1695d0ef41c5bdee4d03 100755
--- a/contrib/bootstrap
+++ b/contrib/bootstrap
@@ -39,7 +39,7 @@ PKGS_ENABLE=
 PKGS_DISABLE=
 CONF_TARBALLS=
 
-if test ! -f "../../contrib/src/main.mak"
+if test ! -f "../src/main.mak"
 then
 	echo "$0 must be run from a subdirectory"
 	exit 1
@@ -270,7 +270,7 @@ esac
 # Results output
 #
 test -e Makefile && unlink Makefile
-ln -sf ../../contrib/src/main.mak Makefile || exit $?
+ln -sf ../src/main.mak Makefile || exit $?
 cat << EOF
 Bootstrap completed.
 
@@ -289,4 +289,4 @@ Other targets:
  * make package       prepare prebuilt packages
 EOF
 
-mkdir -p ../../contrib/tarballs || exit $?
+mkdir -p ../tarballs || exit $?
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 101a302fc01527724f84908949d33378e84cd7b3..b131b404517e84a970cdf9afe452dd74a1243c2b 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -23,8 +23,10 @@ all: install
 # bootstrap configuration
 include config.mak
 
-TOPSRC ?= $(abspath ../../contrib)
-TOPDST ?= $(abspath ..)
+# The bootstrap script is enforced to run from a child directory of
+# daemon/contrib; TOPSRC corresponds to this contrib/ directory.
+TOPSRC ?= $(abspath $(CURDIR)/..)
+TOPDST ?= $(abspath $(CURDIR)/..)
 SRC := $(TOPSRC)/src
 
 # Resolves TARBALLS using the following precedence rules:
@@ -33,7 +35,7 @@ SRC := $(TOPSRC)/src
 # 3. Default value
 TARBALLS := $(or $(TARBALLS),$(CONF_TARBALLS),$(TOPSRC)/tarballs)
 
-PATH :=$(abspath ../../extras/tools/build/bin):$(PATH)
+PATH :=$(abspath $(TOPSRC)/../extras/tools/build/bin):$(PATH)
 export PATH
 
 PKGS_ALL := $(patsubst $(SRC)/%/rules.mak,%,$(wildcard $(SRC)/*/rules.mak))
@@ -367,7 +369,7 @@ UNPACK = $(RM) -R $@ \
 UNPACK_DIR = $(basename $(basename $(notdir $<)))
 APPLY = (cd $(UNPACK_DIR) && patch -flp1) <
 APPLY_BIN = (cd $(UNPACK_DIR) && patch --binary -flp1) <
-pkg_static = (cd $(UNPACK_DIR) && ../../../contrib/src/pkg-static.sh $(1))
+pkg_static = (cd $(UNPACK_DIR) && $(SRC)/pkg-static.sh $(1))
 MOVE = mv $(UNPACK_DIR) $@ && touch $@
 
 AUTOMAKE_DATA_DIRS=$(foreach n,$(foreach n,$(subst :, ,$(shell echo $$PATH)),$(abspath $(n)/../share)),$(wildcard $(n)/automake*))