summaryrefslogtreecommitdiff
path: root/makefiles/Makefile.tools
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-12-06 09:10:52 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-12-06 09:10:52 +0000
commit015ae9ea0c6b787319a1e53701c6da82c010c3f7 (patch)
treef63867a94156a6894bd83c49fcf72674748929ee /makefiles/Makefile.tools
parentf58dcd785752deaa097d9cdbef2c32964a62e3fc (diff)
downloadbuildsystem-015ae9ea0c6b787319a1e53701c6da82c010c3f7.tar.gz
buildsystem-015ae9ea0c6b787319a1e53701c6da82c010c3f7.tar.bz2
A couple of tweaks to HOST/TARGET sanitisation. This needs further improvement.
svn path=/trunk/tools/buildsystem/; revision=9718
Diffstat (limited to 'makefiles/Makefile.tools')
-rw-r--r--makefiles/Makefile.tools22
1 files changed, 14 insertions, 8 deletions
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools
index c5a243b..a2bd984 100644
--- a/makefiles/Makefile.tools
+++ b/makefiles/Makefile.tools
@@ -36,7 +36,12 @@ endif
# Host/target platform detection
###############################################################################
-HOST := $(shell uname -s)
+# Autodetect host if necessary
+ifeq ($(HOST),)
+ HOST := $(shell uname -s)
+endif
+
+# Simple host sanitisation
ifeq ($(HOST),)
# Don't ask
HOST := riscos
@@ -66,6 +71,11 @@ ifeq ($(TARGET),)
endif
endif
+# Sanitise HOST and TARGET
+# TODO: Ideally, we want the equivalent of s/[^A-Za-z0-9]/_/g here
+HOST := $(subst .,_,$(subst -,_,$(subst /,_,$(HOST))))
+TARGET := $(subst .,_,$(subst -,_,$(subst /,_,$(TARGET))))
+
# Now setup our tooling
ifeq ($(TARGET),riscos)
ifeq ($(HOST),riscos)
@@ -236,13 +246,9 @@ endif
ASFLAGS ?= -xassembler-with-cpp
-CFLAGS := $(CFLAGS) $(OPTCFLAGS)
-CXXFLAGS := $(CXXFLAGS) $(OPTCXXFLAGS)
-# Some attempt to sanitise TARGET and HOST when used as pre-defines
-CFLAGS := $(CFLAGS) -DBUILD_TARGET_$(subst .,_,$(subst -,_,$(TARGET)))
-CXXFLAGS := $(CXXFLAGS) -DBUILD_TARGET_$(subst .,_,$(subst -,_,$(TARGET)))
-CFLAGS := $(CFLAGS) -DBUILD_HOST_$(subst .,_,$(subst -,_,$(HOST)))
-CXXFLAGS := $(CXXFLAGS) -DBUILD_HOST_$(subst .,_,$(subst -,_,$(HOST)))
+CFLAGS := $(CFLAGS) $(OPTCFLAGS) -DBUILD_TARGET_$(TARGET) -DBUILD_HOST_$(HOST)
+CXXFLAGS := $(CXXFLAGS) $(OPTCXXFLAGS) \
+ -DBUILD_TARGET_$(TARGET) -DBUILD_HOST_$(HOST)
ASFLAGS := $(ASFLAGS) $(CFLAGS)
LDFLAGS := $(LDFLAGS) $(OPTLDFLAGS)