diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 9784298..9aabfae 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1256,6 +1256,7 @@ inherit() {
 	local B_DEPEND
 	local B_RDEPEND
 	local B_PDEPEND
+	local B_HDEPEND
 	while [ "$1" ]; do
 		location="${ECLASSDIR}/${1}.eclass"
 		olocation=""
@@ -1294,19 +1295,20 @@ inherit() {
 				EBUILD_OVERLAY_ECLASSES="${EBUILD_OVERLAY_ECLASSES} ${location}"
 		fi
 
-		#We need to back up the value of DEPEND and RDEPEND to B_DEPEND and B_RDEPEND
+		#We need to back up the value of DEPEND, RDEPEND and HDEPEND to B_DEPEND, B_RDEPEND and B_HDEPEND
 		#(if set).. and then restore them after the inherit call.
 
 		#turn off glob expansion
 		set -f
 
 		# Retain the old data and restore it later.
-		unset B_IUSE B_DEPEND B_RDEPEND B_PDEPEND
+		unset B_IUSE B_DEPEND B_RDEPEND B_PDEPEND B_HDEPEND
 		[ "${IUSE+set}"       = set ] && B_IUSE="${IUSE}"
 		[ "${DEPEND+set}"     = set ] && B_DEPEND="${DEPEND}"
 		[ "${RDEPEND+set}"    = set ] && B_RDEPEND="${RDEPEND}"
 		[ "${PDEPEND+set}"    = set ] && B_PDEPEND="${PDEPEND}"
-		unset IUSE DEPEND RDEPEND PDEPEND
+		[ "${HDEPEND+set}"    = set ] && B_HDEPEND="${HDEPEND}"
+		unset IUSE DEPEND RDEPEND PDEPEND HDEPEND
 		#turn on glob expansion
 		set +f
 
@@ -1321,6 +1323,7 @@ inherit() {
 		[ "${DEPEND+set}"     = set ] && export E_DEPEND="${E_DEPEND} ${DEPEND}"
 		[ "${RDEPEND+set}"    = set ] && export E_RDEPEND="${E_RDEPEND} ${RDEPEND}"
 		[ "${PDEPEND+set}"    = set ] && export E_PDEPEND="${E_PDEPEND} ${PDEPEND}"
+		[ "${HDEPEND+set}"    = set ] && export E_HDEPEND="${E_HDEPEND} ${HDEPEND}"
 
 		[ "${B_IUSE+set}"     = set ] && IUSE="${B_IUSE}"
 		[ "${B_IUSE+set}"     = set ] || unset IUSE
@@ -1334,6 +1337,9 @@ inherit() {
 		[ "${B_PDEPEND+set}"  = set ] && PDEPEND="${B_PDEPEND}"
 		[ "${B_PDEPEND+set}"  = set ] || unset PDEPEND
 
+		[ "${B_HDEPEND+set}"  = set ] && HDEPEND="${B_HDEPEND}"
+		[ "${B_HDEPEND+set}"  = set ] || unset HDEPEND
+
 		#turn on glob expansion
 		set +f
 
@@ -1593,7 +1599,7 @@ source_all_bashrcs() {
 # when portage is upgrading itself.
 
 READONLY_EBUILD_METADATA="DEFINED_PHASES DEPEND DESCRIPTION
-	EAPI HOMEPAGE INHERITED IUSE KEYWORDS LICENSE
+	EAPI HDEPEND HOMEPAGE INHERITED IUSE KEYWORDS LICENSE
 	PDEPEND PROVIDE RDEPEND RESTRICT SLOT SRC_URI"
 
 READONLY_PORTAGE_VARS="D EBUILD EBUILD_PHASE \
@@ -1767,7 +1773,7 @@ preprocess_ebuild_env() {
 export SANDBOX_ON="1"
 export S=${WORKDIR}/${P}
 
-unset E_IUSE E_DEPEND E_RDEPEND E_PDEPEND
+unset E_IUSE E_DEPEND E_RDEPEND E_PDEPEND E_HDEPEND
 
 # Turn of extended glob matching so that g++ doesn't get incorrectly matched.
 shopt -u extglob
@@ -1871,7 +1877,7 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then
 		# In order to ensure correct interaction between ebuilds and
 		# eclasses, they need to be unset before this process of
 		# interaction begins.
-		unset DEPEND RDEPEND PDEPEND IUSE
+		unset DEPEND RDEPEND PDEPEND HDEPEND IUSE
 
 		if [[ $PORTAGE_DEBUG != 1 || ${-/x/} != $- ]] ; then
 			source "$EBUILD" || die "error sourcing ebuild"
@@ -1894,13 +1900,19 @@ if ! hasq "$EBUILD_PHASE" clean cleanrm ; then
 			debug-print "RDEPEND: not set... Setting to: ${DEPEND}"
 		fi
 
+		if has "$EAPI" 0 1 2 3 3_pre2 ; then
+			export HDEPEND=${HDEPEND-${DEPEND}}
+			debug-print "HDEPEND: not set... Setting to: ${DEPEND}"
+		fi
+
 		# add in dependency info from eclasses
 		IUSE="${IUSE} ${E_IUSE}"
 		DEPEND="${DEPEND} ${E_DEPEND}"
 		RDEPEND="${RDEPEND} ${E_RDEPEND}"
 		PDEPEND="${PDEPEND} ${E_PDEPEND}"
+		HDEPEND="${HDEPEND} ${E_HDEPEND}"
 
-		unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND
+		unset ECLASS E_IUSE E_DEPEND E_RDEPEND E_PDEPEND E_HDEPEND
 
 		# alphabetically ordered by $EBUILD_PHASE value
 		case "$EAPI" in
@@ -2145,7 +2157,7 @@ ebuild_main() {
 
 		auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
 			DESCRIPTION KEYWORDS INHERITED IUSE UNUSED_00 PDEPEND PROVIDE EAPI
-			PROPERTIES DEFINED_PHASES UNUSED_05 UNUSED_04
+			PROPERTIES DEFINED_PHASES HDEPEND UNUSED_04
 			UNUSED_03 UNUSED_02 UNUSED_01"
 
 		#the extra $(echo) commands remove newlines
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index bba55ca..81a338d 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -30,7 +30,7 @@ class Package(Task):
 		"INHERITED", "IUSE", "KEYWORDS",
 		"LICENSE", "PDEPEND", "PROVIDE", "RDEPEND",
 		"repository", "PROPERTIES", "RESTRICT", "SLOT", "USE",
-		"_mtime_", "DEFINED_PHASES"]
+		"_mtime_", "DEFINED_PHASES", "HDEPEND"]
 
 	def __init__(self, **kwargs):
 		Task.__init__(self, **kwargs)
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index a466e7d..6e2deaf 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -1128,7 +1128,7 @@ class depgraph(object):
 		removal_action = "remove" in self._dynamic_config.myparams
 
 		edepend={}
-		depkeys = ["DEPEND","RDEPEND","PDEPEND"]
+		depkeys = ["DEPEND","RDEPEND","PDEPEND","HDEPEND"]
 		for k in depkeys:
 			edepend[k] = metadata[k]
 
@@ -1153,23 +1153,28 @@ class depgraph(object):
 			else:
 				# built packages do not have build time dependencies.
 				edepend["DEPEND"] = ""
+				edepend["HDEPEND"] = ""
 
 		if removal_action and self._frozen_config.myopts.get("--with-bdeps", "y") == "n":
 			edepend["DEPEND"] = ""
-
-		if removal_action:
-			bdeps_root = myroot
-		else:
-			bdeps_root = "/"
-			root_deps = self._frozen_config.myopts.get("--root-deps")
-			if root_deps is not None:
-				if root_deps is True:
-					bdeps_root = myroot
-				elif root_deps == "rdeps":
-					edepend["DEPEND"] = ""
+			edepend["HDEPEND"] = ""
+
+		root_deps = self._frozen_config.myopts.get("--root-deps")
+		if root_deps is None:
+			edepend["HDEPEND"], edepend["DEPEND"] = edepend["DEPEND"], ""
+		elif root_deps is True:
+			edepend["HDEPEND"] = ""
+		elif root_deps == "rdeps":
+			edepend["HDEPEND"] = edepend["DEPEND"] = ""
+		elif root_deps != "hdeps":
+			raise ValueError, "invalid --root-deps argument"
 
 		deps = (
-			(bdeps_root, edepend["DEPEND"],
+			("/", edepend["HDEPEND"],
+				self._priority(buildtime=(not bdeps_optional),
+				optional=bdeps_optional),
+				pkg.built),
+			(myroot, edepend["DEPEND"],
 				self._priority(buildtime=(not bdeps_optional),
 				optional=bdeps_optional),
 				pkg.built),
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index fd49ade..efc8b74 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -567,7 +567,7 @@ def help(myopts, havecolor=1):
 		for line in wrap(desc, desc_width):
 			print(desc_indent + line)
 		print()
-		print("       "+green("--root-deps[=rdeps]"))
+		print("       "+green("--root-deps[=rdeps|=hdeps]"))
 		desc = "If no argument is given then build-time dependencies of packages for " + \
 			"ROOT are installed to " + \
 			"ROOT instead of /. If the rdeps argument is given then discard " + \
@@ -576,7 +576,9 @@ def help(myopts, havecolor=1):
 			"be enabled under normal circumstances. For currently supported " + \
 			"EAPI values, the build-time dependencies are specified in the " + \
 			"DEPEND variable. However, behavior may change for new " + \
-			"EAPIs when related extensions are added in the future."
+			"EAPIs when related extensions are added in the future. " + \
+			"NEW: we now can give hdeps argument here for proper host/target " + \
+			"dependency seperation."
 		for line in wrap(desc, desc_width):
 			print(desc_indent + line)
 		print()
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 9e91ee9..124a828 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -398,7 +398,7 @@ def insert_optional_args(args):
 		'--jobs'       : valid_integers,
 		'--keep-going'           : ('n',),
 		'--rebuilt-binaries'     : ('n',),
-		'--root-deps'  : ('rdeps',),
+		'--root-deps'  : ('rdeps','hdeps',),
 		'--select'               : ('n',),
 		'--selective'            : ('n',),
 		"--use-ebuild-visibility": ('n',),
@@ -652,7 +652,7 @@ def parse_opts(tmpcmdline, silent=False):
 		"--root-deps": {
 			"help"    : "modify interpretation of depedencies",
 			"type"    : "choice",
-			"choices" :("True", "rdeps")
+			"choices" :("True", "rdeps", "hdeps")
 		},
 
 		"--select": {
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 764c974..029d685 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -494,7 +494,7 @@ auxdbkeys = (
 	'RESTRICT',  'HOMEPAGE',  'LICENSE',   'DESCRIPTION',
 	'KEYWORDS',  'INHERITED', 'IUSE', 'UNUSED_00',
 	'PDEPEND',   'PROVIDE', 'EAPI',
-	'PROPERTIES', 'DEFINED_PHASES', 'UNUSED_05', 'UNUSED_04',
+	'PROPERTIES', 'DEFINED_PHASES', 'HDEPEND', 'UNUSED_04',
 	'UNUSED_03', 'UNUSED_02', 'UNUSED_01',
 )
 auxdbkeylen=len(auxdbkeys)
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index cbbb290..0beb0a7 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -402,7 +402,7 @@ class portdbapi(dbapi):
 		self._aux_cache_keys = set(
 			["DEPEND", "EAPI", "INHERITED", "IUSE", "KEYWORDS", "LICENSE",
 			"PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND", "repository",
-			"RESTRICT", "SLOT", "DEFINED_PHASES"])
+			"RESTRICT", "SLOT", "DEFINED_PHASES", "HDEPEND"])
 
 		self._aux_cache = {}
 		self._broken_ebuilds = set()
