X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=compilation;h=69d6d9982aef8ab42d59616cdb7a08c1a005d3f9;hb=e93e77990a9e1fa893109df1c89b2b6e09b38cdc;hp=609534503dc9fc11e126da16f8082642f97ea140;hpb=cbff2fcb6dadd1def39f23ab938eb8df7c9fa57b;p=bash.d.git diff --git a/compilation b/compilation index 6095345..69d6d99 100644 --- a/compilation +++ b/compilation @@ -1,7 +1,37 @@ -#!/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. -export LDFLAGS="-Wl,-O1 -Wl,--as-needed" + 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