]> gitweb.michael.orlitzky.com - bash.d.git/blobdiff - compilation
sage: set SAGE_DEBUG=no.
[bash.d.git] / compilation
index b13a39120562d3b8b0c2c3b4235c0a99bb307b8f..ecc3dac9b13c53e6efd2e363d84d728ad9b299bc 100644 (file)
@@ -1,10 +1,36 @@
-#!/bin/bash
+#!/bin/sh
 
-# Grab CFLAGS, etc. from make.conf.
-source /etc/portage/make.conf
+# Grab CFLAGS, etc. from our profile after first processing its parent
+# profiles recursively
+load_profile_defaults() {
+    local profile="${1}"
+    if [ -f "${profile}/parent" ]; then
+       for parent in $(cat "${profile}/parent"); do
+           local _parent_path="${profile}/${parent}"
+           load_profile_defaults "${_parent_path}"
+       done
+    fi
 
-# LDFLAGS comes from.. somewhere else.
-LDFLAGS="-Wl,-O1 -Wl,--as-needed"
+    if [ -f "${profile}/make.defaults" ]; then
+       if [ -r "${profile}/make.defaults" ]; then
+          . "${profile}/make.defaults"
+       fi
+    fi
+}
 
-# Portage does this for us.
-MAKE="make ${MAKEOPTS}"
+load_profile_defaults /etc/portage/make.profile
+
+
+# and from make.conf, allowing the values in make.conf to override the
+# ones in the profile.
+if [ -f /etc/portage/make.conf ]; then
+    if [ -r /etc/portage/make.conf ]; then
+       . /etc/portage/make.conf
+    fi
+fi
+
+# These are really the only variables that make sense to export to
+# subsequent commands.
+export CFLAGS
+export CXXFLAGS
+export LDFLAGS