-# Grab CFLAGS, etc. from make.conf.
-source /etc/portage/make.conf
+# Grab CFLAGS, etc. from the profile...
+if [ -f /etc/portage/make.profile/make.defaults ]; then
+ source /etc/portage/make.profile/make.defaults
+fi
+
+# and from make.conf, allowing the values in make.conf to override the
+# ones in the profile.
+if [ -f /etc/portage/make.conf ]; then
+ source /etc/portage/make.conf
+fi
+
+
+# Not a portage variable, but it's real handy.
+REPOS="${DISTDIR}/../repositories"
+