forked from OSchip/llvm-project
Support building for a single target architecture.
llvm-svn: 80943
This commit is contained in:
parent
ed8f32022e
commit
c7b06b3edf
|
|
@ -44,19 +44,24 @@ $(call Set,ActiveLibGen,$(ActiveObjPath)/libcompiler_rt.Generic.a)
|
||||||
$(call Set,ActiveLibOpt,$(ActiveObjPath)/libcompiler_rt.Optimized.a)
|
$(call Set,ActiveLibOpt,$(ActiveObjPath)/libcompiler_rt.Optimized.a)
|
||||||
|
|
||||||
# The sublibraries to use for a generic version.
|
# The sublibraries to use for a generic version.
|
||||||
$(call Set,GenericInputs,$(foreach arch,$(Archs),$(ActiveObjPath)/$(arch)/libcompiler_rt.Generic.a))
|
$(call Set,GenericInputs,$(foreach arch,$(TargetArchs),$(ActiveObjPath)/$(arch)/libcompiler_rt.Generic.a))
|
||||||
# The sublibraries to use for an optimized version.
|
# The sublibraries to use for an optimized version.
|
||||||
$(call Set,OptimizedInputs,$(foreach arch,$(Archs),$(ActiveObjPath)/$(arch)/libcompiler_rt.Optimized.a))
|
$(call Set,OptimizedInputs,$(foreach arch,$(TargetArchs),$(ActiveObjPath)/$(arch)/libcompiler_rt.Optimized.a))
|
||||||
|
|
||||||
# Provide top-level fat archive targets.
|
# Provide top-level fat archive targets. We make sure to not try to lipo if only
|
||||||
|
# building one target arch.
|
||||||
$(ActiveLibGen): $(GenericInputs) $(ActiveObjPath)/.dir
|
$(ActiveLibGen): $(GenericInputs) $(ActiveObjPath)/.dir
|
||||||
$(Summary) " UNIVERSAL: $(ActiveConfig): $$@"
|
$(Summary) " UNIVERSAL: $(ActiveConfig): $$@"
|
||||||
-$(Verb) $(RM) $$@
|
-$(Verb) $(RM) $$@
|
||||||
$(Verb) $(Lipo) -create -output $$@ $(GenericInputs)
|
$(if $(TargetArch), \
|
||||||
|
$(Verb) $(CP) $(GenericInputs) $$@, \
|
||||||
|
$(Verb) $(Lipo) -create -output $$@ $(GenericInputs))
|
||||||
$(ActiveLibOpt): $(OptimizedInputs) $(ActiveObjPath)/.dir
|
$(ActiveLibOpt): $(OptimizedInputs) $(ActiveObjPath)/.dir
|
||||||
$(Summary) " UNIVERSAL: $(ActiveConfig): $$@"
|
$(Summary) " UNIVERSAL: $(ActiveConfig): $$@"
|
||||||
-$(Verb) $(RM) $$@
|
-$(Verb) $(RM) $$@
|
||||||
$(Verb) $(Lipo) -create -output $$@ $(OptimizedInputs)
|
$(if $(TargetArch), \
|
||||||
|
$(Verb) $(CP) $(GenericInputs) $$@, \
|
||||||
|
$(Verb) $(Lipo) -create -output $$@ $(OptimizedInputs))
|
||||||
.PRECIOUS: $(ActiveObjPath)/.dir
|
.PRECIOUS: $(ActiveObjPath)/.dir
|
||||||
|
|
||||||
# Add to target lists.
|
# Add to target lists.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
###
|
###
|
||||||
# Configuration variables.
|
# Configuration variables.
|
||||||
|
|
||||||
|
OS := $(shell uname)
|
||||||
|
|
||||||
# Assume make is always run from top-level of source directory. Note
|
# Assume make is always run from top-level of source directory. Note
|
||||||
# than an Apple style build overrides these variables later in the
|
# than an Apple style build overrides these variables later in the
|
||||||
# makefile.
|
# makefile.
|
||||||
|
|
@ -8,8 +10,20 @@ ProjSrcRoot := $(shell pwd)
|
||||||
ProjObjRoot := $(ProjSrcRoot)
|
ProjObjRoot := $(ProjSrcRoot)
|
||||||
|
|
||||||
Configs := Debug Release Profile
|
Configs := Debug Release Profile
|
||||||
|
|
||||||
|
# The full list of architectures we support.
|
||||||
Archs := i386 ppc x86_64
|
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
|
Common.CFLAGS := -Wall -Werror
|
||||||
|
|
||||||
# These names must match the configs, see GetArgs function.
|
# These names must match the configs, see GetArgs function.
|
||||||
|
|
@ -17,10 +31,23 @@ Debug.CFLAGS := -g
|
||||||
Release.CFLAGS := -O3 -fomit-frame-pointer
|
Release.CFLAGS := -O3 -fomit-frame-pointer
|
||||||
Profile.CFLAGS := -pg -g
|
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
|
# Function: GetArgs config arch
|
||||||
#
|
#
|
||||||
# Return the compiler flags for the given 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)"))
|
$(error "Invalid configuration: $(1)"))
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
@ -37,6 +64,7 @@ RANLIB := ranlib
|
||||||
# FIXME: Remove these pipes once ranlib errors are fixed.
|
# FIXME: Remove these pipes once ranlib errors are fixed.
|
||||||
RANLIB.Flags := 2> /dev/null
|
RANLIB.Flags := 2> /dev/null
|
||||||
LIPO := lipo
|
LIPO := lipo
|
||||||
|
CP := cp
|
||||||
|
|
||||||
###
|
###
|
||||||
# Automatic and derived variables.
|
# Automatic and derived variables.
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,11 @@ else
|
||||||
ArchsToTraverse := $(OnlyArchs)
|
ArchsToTraverse := $(OnlyArchs)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# If we are only targetting a single arch, only traverse that.
|
||||||
|
ifneq ($(TargetArch),)
|
||||||
|
ArchsToTraverse := $(filter $(TargetArch), $(ArchsToTraverse))
|
||||||
|
endif
|
||||||
|
|
||||||
$(foreach config,$(ConfigsToTraverse), \
|
$(foreach config,$(ConfigsToTraverse), \
|
||||||
$(foreach arch,$(ArchsToTraverse), \
|
$(foreach arch,$(ArchsToTraverse), \
|
||||||
$(eval $(call CNA_subdir_template,$(config),$(arch),$(Dir)))))
|
$(eval $(call CNA_subdir_template,$(config),$(arch),$(Dir)))))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue