summaryrefslogtreecommitdiff
path: root/make/config.mk
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-03 20:49:22 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-03 20:49:22 +0000
commit866d2824095a5bc78307c103347695b52f3d49f0 (patch)
treebb0d91c85f7f9fe62ca44d500698f799a62f99e2 /make/config.mk
parent172e105cf58333a1a55468095c51d22868296a68 (diff)
Support building for a single target architecture.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@80943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'make/config.mk')
-rw-r--r--make/config.mk30
1 files changed, 29 insertions, 1 deletions
diff --git a/make/config.mk b/make/config.mk
index 726e8ba41..d2c614c9a 100644
--- a/make/config.mk
+++ b/make/config.mk
@@ -1,6 +1,8 @@
###
# Configuration variables.
+OS := $(shell uname)
+
# Assume make is always run from top-level of source directory. Note
# than an Apple style build overrides these variables later in the
# makefile.
@@ -8,8 +10,20 @@ ProjSrcRoot := $(shell pwd)
ProjObjRoot := $(ProjSrcRoot)
Configs := Debug Release Profile
+
+# The full list of architectures we support.
Archs := i386 ppc x86_64
+# If TargetArch is defined, only build for that architecture (and don't use
+# -arch).
+ifeq ($(OS), Darwin)
+ TargetArch :=
+ TargetArchs := $(Archs)
+else
+ TargetArch := i386
+ TargetArchs := $(TargetArch)
+endif
+
Common.CFLAGS := -Wall -Werror
# These names must match the configs, see GetArgs function.
@@ -17,10 +31,23 @@ Debug.CFLAGS := -g
Release.CFLAGS := -O3 -fomit-frame-pointer
Profile.CFLAGS := -pg -g
+# Function: GetArchArgs arch
+#
+# Return the compiler flags for the given arch.
+ifeq ($(OS), Darwin)
+ GetArchArgs = -arch $(1)
+else
+ # Check that we are only trying to build the target arch.
+ GetArchArgs = $(if $(subst $(TargetArch),,$(1)), \
+ $(error "Invalid configuration, no -arch support: $(1)"), \
+ )
+endif
+
# Function: GetArgs config arch
#
# Return the compiler flags for the given config & arch.
-GetArgs = $(if $($(1).CFLAGS),$(Common.CFLAGS) $($(1).CFLAGS) -arch $(2), \
+GetArgs = $(if $($(1).CFLAGS), \
+ $(Common.CFLAGS) $($(1).CFLAGS) $(call GetArchArgs,$(2)), \
$(error "Invalid configuration: $(1)"))
###
@@ -37,6 +64,7 @@ RANLIB := ranlib
# FIXME: Remove these pipes once ranlib errors are fixed.
RANLIB.Flags := 2> /dev/null
LIPO := lipo
+CP := cp
###
# Automatic and derived variables.