diff --git a/Makefile b/Makefile
index dcd5bae72ef88708ce59690c8fdb8365d0f1080f..b67413b887309808b09a877e39310452d096e565 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ ifneq ($(OPENWRT_BUILD),1)
   override OPENWRT_BUILD=1
   export OPENWRT_BUILD
   include $(TOPDIR)/include/debug.mk
+  include $(TOPDIR)/include/depends.mk
   include $(TOPDIR)/include/toplevel.mk
 else
   include rules.mk
diff --git a/include/depends.mk b/include/depends.mk
index b488af9271893739abd9a24d153ec6c3afc855d0..4c31eb39843de6b6e65763e93162d54bb78c2b87 100644
--- a/include/depends.mk
+++ b/include/depends.mk
@@ -28,7 +28,7 @@ define rdep
 		) \
 		{ \
 			[ -f "$(2)_check.1" ] && mv "$(2)_check.1"; \
-		    $(SCRIPT_DIR)/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
+		    $(TOPDIR)/scripts/timestamp.pl $(DEP_FINDPARAMS) $(4) -n $(2) $(1) && { \
 				$(call debug_eval,$(SUBDIR),r,echo "No need to rebuild $(2)";) \
 				touch -r "$(2)" "$(2)_check"; \
 			} \
diff --git a/include/toplevel.mk b/include/toplevel.mk
index dcbcb3eb751ca3d3a85ee79aaaae7826ffbdc403..c92686019dc691694f28c76eda004b60d03a7e4d 100644
--- a/include/toplevel.mk
+++ b/include/toplevel.mk
@@ -52,7 +52,7 @@ prepare-tmpinfo: FORCE
 scripts/config/mconf:
 	@+$(MAKE) -C scripts/config all
 
-$(call  rdep,scripts/config,scripts/config/mconf)
+$(eval $(call rdep,scripts/config,scripts/config/mconf))
 
 scripts/config/conf:
 	@+$(MAKE) -C scripts/config conf