]> gitweb.michael.orlitzky.com - bash.d.git/blobdiff - compilation.sh
Give everything a ".sh" suffix.
[bash.d.git] / compilation.sh
diff --git a/compilation.sh b/compilation.sh
new file mode 100644 (file)
index 0000000..7613425
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# compilation
+#
+
+# 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
+
+    if [ -f "${profile}/make.defaults" ]; then
+       if [ -r "${profile}/make.defaults" ]; then
+          . "${profile}/make.defaults"
+       fi
+    fi
+}
+
+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 FCFLAGS
+export LDFLAGS
+
+# This variable isn't standard, but I've started including it in my
+# Haskell makefiles so that we don't have to hard-code user preferences
+# (these flags) in the cabal files that *everyone* uses.
+export HCFLAGS
+