summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-10-08 15:41:30 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-10-18 11:44:33 +0530
commitcf3fdf8e98f44591227ddfddbaa4a8015bcd8a12 (patch)
tree5d743e2025d562cbc2291361a77958961caf022b
parentf781df7d060c809faa54bcbcafa1d02b36723aa4 (diff)
darwin.config: De-duplicate *C*FLAGS and LDFLAGS appending
We include this config twice for universal builds, so avoid overly-verbose CFLAGS/LDFLAGS/etc by only appending if not already in the list
-rw-r--r--config/darwin.config16
1 files changed, 13 insertions, 3 deletions
diff --git a/config/darwin.config b/config/darwin.config
index 775fcfe9..1a62acc2 100644
--- a/config/darwin.config
+++ b/config/darwin.config
@@ -62,10 +62,20 @@ incl_dir = os.path.join(prefix, 'include')
if not os.path.exists(incl_dir):
os.makedirs(incl_dir)
+# Append to these flags if not already present
for f in ['CFLAGS', 'CCASFLAGS', 'CXXFLAGS', 'OBJCFLAGS']:
- os.environ[f] += ' %s -I%s %s ' % (arch_cflags, incl_dir, sdk)
-
-os.environ['LDFLAGS'] += ' %s %s ' % (arch_ldflags, sdk)
+ if arch_cflags not in os.environ[f]:
+ os.environ[f] += ' %s ' % arch_cflags
+ incflag = '-I' + incl_dir
+ if incflag not in os.environ[f]:
+ os.environ[f] += ' %s ' % incflag
+ if sdk not in os.environ[f]:
+ os.environ[f] += ' %s ' % sdk
+
+if arch_ldflags not in os.environ['LDFLAGS']:
+ os.environ['LDFLAGS'] += ' %s ' % arch_ldflags
+if sdk not in os.environ['LDFLAGS']:
+ os.environ['LDFLAGS'] += ' %s ' % sdk
os.environ['STRIP'] = 'strip'
os.environ['LD'] = 'ld'