Index: /trunk/Config.kmk
===================================================================
--- /trunk/Config.kmk	(revision 2433)
+++ /trunk/Config.kmk	(revision 2434)
@@ -33,6 +33,6 @@
 KBUILD_VERSION_MAJOR = 0
 KBUILD_VERSION_MINOR = 1
-KBUILD_VERSION_PATCH = 98
-KBUILD_VERSION = 0.1.98
+KBUILD_VERSION_PATCH = 99
+KBUILD_VERSION = 0.1.99
 DEFS += \
 	KBUILD_VERSION_MAJOR=$(KBUILD_VERSION_MAJOR) \
Index: /trunk/kBuild/footer.kmk
===================================================================
--- /trunk/kBuild/footer.kmk	(revision 2433)
+++ /trunk/kBuild/footer.kmk	(revision 2434)
@@ -158,4 +158,5 @@
 	$(TOOL.$(bld_trg)) \
 	$(TOOL) \
+))
 else
 _TARGET_TOOL = $(strip $(firstword \
@@ -188,5 +189,5 @@
 	$(TOOL.$(bld_type)) \
 	$(TOOL) \
-	))
+))
 endif
 
@@ -2218,5 +2219,8 @@
 	$(SUFF_LIB))
 local out         := $(outbase)$(suff)
-local defpath     := $(firstword $($(target)_PATH) $($(target)_DEFPATH))
+local defpath     := $($(target)_DEFPATH)
+ifeq ($(defpath),)
+ local defpath    := $($(target)_PATH)
+endif
 TARGET_$(target)  := $(out)
 $(target)_1_TARGET:= $(out)
@@ -2474,5 +2478,8 @@
 TARGET_$(target)  := $(out)
 $(target)_1_TARGET:= $(out)
-local defpath     := $(firstword $($(target)_PATH) $($(target)_DEFPATH))
+local defpath     := $($(target)_DEFPATH)
+ifeq ($(defpath),)
+ local defpath    := $($(target)_PATH)
+endif
 # no local here - must be writable across some foreachs.
 othersrc          :=
@@ -3127,5 +3134,8 @@
 
 # Adjust the source if we got a default PATH. (This must be done this late!)
-local defpath := $(firstword $($(target)_PATH) $($(target)_DEFPATH))
+local defpath     := $($(target)_DEFPATH)
+ifeq ($(defpath),)
+ local defpath    := $($(target)_PATH)
+endif
 ifneq ($(defpath),)
  local srcsrc := $(abspathex $(srcsrc),$(defpath))
Index: /trunk/kBuild/header.kmk
===================================================================
--- /trunk/kBuild/header.kmk	(revision 2433)
+++ /trunk/kBuild/header.kmk	(revision 2434)
@@ -764,4 +764,16 @@
 endef
 
+##
+# Make an assignment to a deprecated variable.
+#
+# @param   $1   The variable name.
+# @param   $2   The value.
+# @param   $3   The variable to use instead.
+#
+ifdef KBUILD_WITH_DEPREATED_AS_ERROR
+ KB_FN_ASSIGN_DEPRECATED = $(eval $1 = $2$$(error $1 is deprecated, use $3 instead))
+else
+ KB_FN_ASSIGN_DEPRECATED = $(eval $1 = $2$$(warning $1 is deprecated, use $3 instead))
+endif
 
 
Index: /trunk/kBuild/subfooter.kmk
===================================================================
--- /trunk/kBuild/subfooter.kmk	(revision 2433)
+++ /trunk/kBuild/subfooter.kmk	(revision 2434)
@@ -44,10 +44,8 @@
 define def_subheader
  ifndef $(target)_PATH
-  ifdef $(target)_DEFPATH
-   $(target)_PATH := $($(target)_DEFPATH)
-  else
-   $(target)_PATH := $(PATH_SUB_CURRENT)
+  ifndef $(target)_DEFPATH
    $(target)_DEFPATH := $(PATH_SUB_CURRENT)
   endif
+  $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH), $(target)_DEFPATH)
  else ifndef $(target)_DEFPATH
   $(target)_DEFPATH := $($(target)_PATH)
@@ -58,5 +56,5 @@
  ifndef $(target)_0_OUTDIR
   $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
-  PATH_$(target) := $($(target)_0_OUTDIR)
+  $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
  endif
 endef
Index: /trunk/kBuild/subheader.kmk
===================================================================
--- /trunk/kBuild/subheader.kmk	(revision 2433)
+++ /trunk/kBuild/subheader.kmk	(revision 2434)
@@ -55,10 +55,8 @@
  define def_subfooter
   ifndef $(target)_PATH
-   ifdef $(target)_DEFPATH
-    $(target)_PATH := $($(target)_DEFPATH)
-   else
-    $(target)_PATH := $(PATH_SUB_CURRENT)
+   ifndef $(target)_DEFPATH
     $(target)_DEFPATH := $(PATH_SUB_CURRENT)
    endif
+   $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH), $(target)_DEFPATH)
   else ifndef $(target)_DEFPATH
    $(target)_DEFPATH := $($(target)_PATH)
@@ -69,5 +67,5 @@
   ifndef $(target)_0_OUTDIR
    $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
-   PATH_$(target) := $($(target)_0_OUTDIR)
+   $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
   endif
  endef
Index: /trunk/src/ash/Makefile.kmk
===================================================================
--- /trunk/src/ash/Makefile.kmk	(revision 2433)
+++ /trunk/src/ash/Makefile.kmk	(revision 2434)
@@ -50,5 +50,5 @@
 kmk_ash_DEFS.openbsd = \
 	HAVE_SYS_SIGNAME HAVE_SYSCTL_H HAVE_SETPROGNAME
-kmk_ash_INCS = $(PATH_kmk_ash) . # (the last is because of error.h)
+kmk_ash_INCS = $(kmk_ash_0_OUTDIR) . # (the last is because of error.h)
 kmk_ash_CFLAGS.win = -I. ## @todo kBuild bug?
 kmk_ash_INCS.win = win
@@ -79,7 +79,7 @@
 	bltin/kill.c \
 	bltin/test.c \
-	$(PATH_kmk_ash)/builtins.c \
-	$(PATH_kmk_ash)/init.c \
-	$(PATH_kmk_ash)/nodes.c
+	$(kmk_ash_0_OUTDIR)/builtins.c \
+	$(kmk_ash_0_OUTDIR)/init.c \
+	$(kmk_ash_0_OUTDIR)/nodes.c
 kmk_ash_SOURCES.linux = \
 	sys_signame.c \
@@ -99,12 +99,12 @@
 
 kmk_ash_INTERMEDIATES = \
-	$(PATH_kmk_ash)/builtins.h \
-	$(PATH_kmk_ash)/nodes.h \
-	$(PATH_kmk_ash)/token.h
+	$(kmk_ash_0_OUTDIR)/builtins.h \
+	$(kmk_ash_0_OUTDIR)/nodes.h \
+	$(kmk_ash_0_OUTDIR)/token.h
 kmk_ash_CLEAN = \
 	$(kmk_ash_INTERMEDIATES) \
-	$(PATH_kmk_ash)/builtins.c \
-	$(PATH_kmk_ash)/init.c \
-	$(PATH_kmk_ash)/nodes.c
+	$(kmk_ash_0_OUTDIR)/builtins.c \
+	$(kmk_ash_0_OUTDIR)/init.c \
+	$(kmk_ash_0_OUTDIR)/nodes.c
 
 kmk_ash.man_TEMPLATE = usr.bin.man
@@ -119,10 +119,10 @@
 #
 kmk_ash_DEPS :=
-kmk_ash_SOURCES += $(PATH_kmk_ash)/arith_lex.c
+kmk_ash_SOURCES += $(kmk_ash_0_OUTDIR)/arith_lex.c
 
 include $(FILE_KBUILD_SUB_FOOTER)
 
 define def_copy_generated
-$(PATH_kmk_ash)/$(src): generated/$(src)
+$(kmk_ash_0_OUTDIR)/$(src): generated/$(src)
 	$$(RM) -f $$@
 	$$(CP) -f $$^ $$@
@@ -162,28 +162,28 @@
 BOOTSTRAP_SHELL ?= $(SHELL)
 
-$(PATH_kmk_ash)/builtins.h + $(PATH_kmk_ash)/builtins.c: \
+$(kmk_ash_0_OUTDIR)/builtins.h + $(kmk_ash_0_OUTDIR)/builtins.c: \
 		$(kmk_ash_PATH)/mkbuiltins \
 		$(kmk_ash_PATH)/shell.h \
 		$(kmk_ash_PATH)/builtins.def \
-		| $(call DIRDEP,$(PATH_kmk_ash))
+		| $(call DIRDEP,$(kmk_ash_0_OUTDIR))
 	$(BOOTSTRAP_SHELL) $+ $(dir $@)
-	[ -f $(PATH_kmk_ash)/builtins.h ]
+	[ -f $(kmk_ash_0_OUTDIR)/builtins.h ]
 
-$(PATH_kmk_ash)/nodes.h + $(PATH_kmk_ash)/nodes.c: \
+$(kmk_ash_0_OUTDIR)/nodes.h + $(kmk_ash_0_OUTDIR)/nodes.c: \
 		$(kmk_ash_PATH)/mknodes.sh \
 		$(kmk_ash_PATH)/nodetypes \
 		$(kmk_ash_PATH)/nodes.c.pat \
-		| $(call DIRDEP,$(PATH_kmk_ash))
+		| $(call DIRDEP,$(kmk_ash_0_OUTDIR))
 	$(BOOTSTRAP_SHELL) $+ $(dir $@)
 	[ -f $(dir $@)/nodes.h ]
 
-$(PATH_kmk_ash)/token.h: $(kmk_ash_PATH)/mktokens | $(call DIRDEP,$(PATH_kmk_ash))
+$(kmk_ash_0_OUTDIR)/token.h: $(kmk_ash_PATH)/mktokens | $(call DIRDEP,$(kmk_ash_0_OUTDIR))
 	$(BOOTSTRAP_SHELL) $+
 	$(MV) token.h $@
 
-$(PATH_kmk_ash)/init.c: \
+$(kmk_ash_0_OUTDIR)/init.c: \
 		$(kmk_ash_PATH)/mkinit.sh \
-		$(abspathex $(filter-out $(PATH_kmk_ash)/%,$(kmk_ash_SOURCES)), $(kmk_ash_PATH)) \
-		| $(call DIRDEP,$(PATH_kmk_ash))
+		$(abspathex $(filter-out $(kmk_ash_0_OUTDIR)/%,$(kmk_ash_SOURCES)), $(kmk_ash_PATH)) \
+		| $(call DIRDEP,$(kmk_ash_0_OUTDIR))
 	$(BOOTSTRAP_SHELL) $+
 	$(MV) init.c $@
Index: /trunk/src/kmk/Makefile.kmk
===================================================================
--- /trunk/src/kmk/Makefile.kmk	(revision 2433)
+++ /trunk/src/kmk/Makefile.kmk	(revision 2434)
@@ -39,20 +39,20 @@
 	KBUILD_TYPE=\"$(KBUILD_TYPE)\"
 TEMPLATE_BIN-KMK_DEPS = \
-	$(PATH_kmk)/config.h \
-	$(PATH_kmk)/fts.h
+	$(kmk_0_OUTDIR)/config.h \
+	$(kmk_0_OUTDIR)/fts.h
 TEMPLATE_BIN-KMK_CLEAN = $(TEMPLATE_BIN-KMK_DEPS)
 TEMPLATE_BIN-KMK_DEPS.solaris = \
-	$(PATH_kmk)/paths.h
+	$(kmk_0_OUTDIR)/paths.h
 TEMPLATE_BIN-KMK_CLEAN.solaris = $(TEMPLATE_BIN-KMK_DEPS.solaris)
 TEMPLATE_BIN-KMK_DEPS.win     = \
-	$(PATH_kmk)/sysexits.h \
-	$(PATH_kmk)/unistd.h \
-	$(PATH_kmk)/paths.h \
-	$(PATH_kmk)/grp.h \
-	$(PATH_kmk)/pwd.h \
-	$(PATH_kmk)/inttypes.h
+	$(kmk_0_OUTDIR)/sysexits.h \
+	$(kmk_0_OUTDIR)/unistd.h \
+	$(kmk_0_OUTDIR)/paths.h \
+	$(kmk_0_OUTDIR)/grp.h \
+	$(kmk_0_OUTDIR)/pwd.h \
+	$(kmk_0_OUTDIR)/inttypes.h
 TEMPLATE_BIN-KMK_CFLAGS.win.amd64 = $(TEMPLATE_BIN-THREADED_CFLAGS.win.amd64) -wd4244 -wd4267
 TEMPLATE_BIN-KMK_CLEAN.win = $(TEMPLATE_BIN-KMK_DEPS.win)
-TEMPLATE_BIN-KMK_INCS = $(PATH_kmk) . $(TEMPLATE_BIN-THREADED_INCS)
+TEMPLATE_BIN-KMK_INCS = $(kmk_0_OUTDIR) . $(TEMPLATE_BIN-THREADED_INCS)
 TEMPLATE_BIN-KMK_INCS.darwin = glob
 TEMPLATE_BIN-KMK_INCS.dragonfly = glob
@@ -63,7 +63,7 @@
 ifdef ELECTRIC_HEAP # for electric heap (see electric.c) - windows only.
 ifeq ($(KBUILD_TARGET),win)
- TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) /FI$(kmk_PATH)/electric.h -DELECTRIC_HEAP=1
+ TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) /FI$(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
 else
- TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -include $(kmk_PATH)/electric.h -DELECTRIC_HEAP=1
+ TEMPLATE_BIN-KMK_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -include $(kmk_DEFPATH)/electric.h -DELECTRIC_HEAP=1
 endif
 endif
@@ -491,6 +491,6 @@
 # Use checked in config.h instead of running ./Configure for it.
 #
-kmk_config.h.$(KBUILD_TARGET) := $(kmk_PATH)/config.h.$(KBUILD_TARGET)
-$(PATH_kmk)/config.h: $(kmk_config.h.$(KBUILD_TARGET))
+kmk_config.h.$(KBUILD_TARGET) := $(kmk_DEFPATH)/config.h.$(KBUILD_TARGET)
+$(kmk_0_OUTDIR)/config.h: $(kmk_config.h.$(KBUILD_TARGET))
 	$(MKDIR) -p $(dir $@)
 	$(CP) $^ $@
@@ -499,23 +499,23 @@
 # Some missing headers.
 #
-$(PATH_kmk)/fts.h: $(kmk_PATH)/kmkbuiltin/ftsfake.h | $(call DIRDEP,$(PATH_kmk))
+$(kmk_0_OUTDIR)/fts.h: $(kmk_DEFPATH)/kmkbuiltin/ftsfake.h | $(call DIRDEP,$(kmk_0_OUTDIR))
 	$(CP) $^ $@
 
-$(PATH_kmk)/unistd.h: | $(call DIRDEP,$(PATH_kmk))
+$(kmk_0_OUTDIR)/unistd.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
 	$(ECHO_EXT) > $@
 
-$(PATH_kmk)/sysexits.h: | $(call DIRDEP,$(PATH_kmk))
+$(kmk_0_OUTDIR)/sysexits.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
 	$(ECHO_EXT) > $@
 
-$(PATH_kmk)/inttypes.h: | $(call DIRDEP,$(PATH_kmk))
+$(kmk_0_OUTDIR)/inttypes.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
 	$(ECHO_EXT) > $@
 
-$(PATH_kmk)/paths.h: | $(call DIRDEP,$(PATH_kmk))
+$(kmk_0_OUTDIR)/paths.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
 	$(ECHO_EXT) > $@
 
-$(PATH_kmk)/pwd.h: | $(call DIRDEP,$(PATH_kmk))
+$(kmk_0_OUTDIR)/pwd.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
 	$(ECHO_EXT) > $@
 
-$(PATH_kmk)/grp.h: | $(call DIRDEP,$(PATH_kmk))
+$(kmk_0_OUTDIR)/grp.h: | $(call DIRDEP,$(kmk_0_OUTDIR))
 	$(ECHO_EXT) > $@
 
@@ -571,20 +571,20 @@
 
 test_stack:
-	$(MAKE) -f $(kmk_PATH)/testcase-stack.kmk
+	$(MAKE) -f $(kmk_DEFPATH)/testcase-stack.kmk
 
 test_math:
-	$(MAKE) -f $(kmk_PATH)/testcase-math.kmk
+	$(MAKE) -f $(kmk_DEFPATH)/testcase-math.kmk
 
 test_if1of:
-	$(MAKE) -f $(kmk_PATH)/testcase-if1of.kmk
+	$(MAKE) -f $(kmk_DEFPATH)/testcase-if1of.kmk
 
 test_local:
-	$(MAKE) -f $(kmk_PATH)/testcase-local.kmk
+	$(MAKE) -f $(kmk_DEFPATH)/testcase-local.kmk
 
 test_includedep:
-	$(MAKE) -f $(kmk_PATH)/testcase-includedep.kmk
+	$(MAKE) -f $(kmk_DEFPATH)/testcase-includedep.kmk
 
 test_2ndtargetexp:
-	$(MAKE) -f $(kmk_PATH)/testcase-2ndtargetexp.kmk
+	$(MAKE) -f $(kmk_DEFPATH)/testcase-2ndtargetexp.kmk
 
 test_30_continued_on_failure_worker:
@@ -603,5 +603,5 @@
 
 test_lazy_deps_vars:
-	$(MAKE) -C $(kmk_PATH) -f testcase-lazy-deps-vars.kmk
+	$(MAKE) -C $(kmk_DEFPATH) -f testcase-lazy-deps-vars.kmk
 
 
Index: /trunk/src/sed/Makefile.kmk
===================================================================
--- /trunk/src/sed/Makefile.kmk	(revision 2433)
+++ /trunk/src/sed/Makefile.kmk	(revision 2434)
@@ -34,9 +34,9 @@
 kmk_sed_TEMPLATE = BIN
 kmk_sed_DEPS = \
-	$(PATH_kmk_sed)/config.h \
-	$(PATH_kmk_sed)/regex.h
+	$(kmk_sed_0_OUTDIR)/config.h \
+	$(kmk_sed_0_OUTDIR)/regex.h
 kmk_sed_CLEAN = $(kmk_sed_DEPS)
 kmk_sed_INCS = \
-	$(PATH_kmk_sed) \
+	$(kmk_sed_0_OUTDIR) \
 	. \
 	lib \
@@ -87,7 +87,7 @@
 # Use checked in config.h instead of running ./configure for it.
 #
-kmk_sed_config.h.$(KBUILD_TARGET) := $(kmk_sed_PATH)/config.h.$(KBUILD_TARGET)
+kmk_sed_config.h.$(KBUILD_TARGET) := $(kmk_sed_DEFPATH)/config.h.$(KBUILD_TARGET)
 
-$(PATH_kmk_sed)/config.h: $(kmk_sed_config.h.$(KBUILD_TARGET)) | $(call DIRDEP,$(PATH_kmk_sed))
+$(kmk_sed_0_OUTDIR)/config.h: $(kmk_sed_config.h.$(KBUILD_TARGET)) | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
 	$(CP) -f $^ $@
 
@@ -95,5 +95,5 @@
 # Use the regex lib shipped with sed and not anything installed on the system.
 #
-$(PATH_kmk_sed)/regex.h: $(kmk_sed_PATH)/lib/regex_.h | $(call DIRDEP,$(PATH_kmk_sed))
+$(kmk_sed_0_OUTDIR)/regex.h: $(kmk_sed_DEFPATH)/lib/regex_.h | $(call DIRDEP,$(kmk_sed_0_OUTDIR))
 	$(CP) -f $^ $@
 
