-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for "platform" configurations, which define a suite of co…
…mpiler-rt libraries to generate. - Each library may be built with different flags and for different architectures, and there is support for building Darwin style fat archives. - Uses an ambituous amount of make programming, but should be hidden to users and developers. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@93720 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
13 changed files
with
358 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# compiler-rt Configuration Support | ||
# | ||
# This should be included following 'lib_util.mk'. | ||
|
||
# The simple variables configurations can define. | ||
PlainConfigVariables := Configs UniversalArchs Description | ||
PerConfigVariables := Arch $(AvailableOptions) | ||
RequiredConfigVariables := Configs Description | ||
|
||
### | ||
# Load Platforms | ||
|
||
# Template: subdir_traverse_template subdir | ||
define load_platform_template | ||
$(call Set,PlatformName,$(basename $(notdir $(1)))) | ||
ifneq ($(DEBUGMAKE),) | ||
$$(info MAKE: $(PlatformName): Loading platform) | ||
endif | ||
|
||
# Construct the variable key for this directory. | ||
$(call Set,PlatformKey,Platform.$(PlatformName)) | ||
$(call Append,PlatformKeys,$(PlatformKey)) | ||
$(call Set,$(PlatformKey).Name,$(PlatformName)) | ||
$(call Set,$(PlatformKey).Path,$(1)) | ||
|
||
# Reset platform specific variables to sentinel value. | ||
$$(foreach var,$(PlainConfigVariables) $(PerConfigVariables),\ | ||
$$(call Set,$$(var),UNDEFINED)) | ||
$$(foreach var,$(PerConfigVariables),\ | ||
$$(foreach config,$$(Configs),\ | ||
$$(call Set,$$(var).$$(config),UNDEFINED))) | ||
$$(foreach var,$(PerConfigVariables),\ | ||
$$(foreach arch,$(AvailableArchs),\ | ||
$$(call Set,$$(var).$$(arch),UNDEFINED))) | ||
|
||
# Get the platform variables. | ||
include make/options.mk | ||
include $(1) | ||
|
||
# Check for undefined required variables. | ||
$$(foreach var,$(RequiredConfigVariables),\ | ||
$$(if $$(call strneq,UNDEFINED,$$($$(var))),, \ | ||
$$(error $(Dir): variable '$$(var)' was not undefined))) | ||
|
||
# Check that exactly one of UniversalArchs or Arch was defined. | ||
$$(if $$(and $$(call strneq,UNDEFINED,$$(UniversalArchs)),\ | ||
$$(call strneq,UNDEFINED,$$(Arch))),\ | ||
$$(error '$(1)': cannot define both 'UniversalArchs' and 'Arch')) | ||
$$(if $$(or $$(call strneq,UNDEFINED,$$(UniversalArchs)),\ | ||
$$(call strneq,UNDEFINED,$$(Arch))),,\ | ||
$$(error '$(1)': must define one of 'UniversalArchs' and 'Arch')) | ||
|
||
# Collect all the platform variables for subsequent use. | ||
$$(foreach var,$(PlainConfigVariables) $(PerConfigVariables),\ | ||
$$(if $$(call strneq,UNDEFINED,$$($$(var))),\ | ||
$$(call CopyVariable,$$(var),$(PlatformKey).$$(var)))) | ||
$$(foreach var,$(PerConfigVariables),\ | ||
$$(foreach config,$$(Configs),\ | ||
$$(if $$(call strneq,UNDEFINED,$$($$(var).$$(config))),\ | ||
$$(call CopyVariable,$$(var).$$(config),$(PlatformKey).$$(var).$$(config))))\ | ||
$$(foreach arch,$(AvailableArchs),\ | ||
$$(if $$(call strneq,UNDEFINED,$$($$(var).$$(arch))),\ | ||
$$(call CopyVariable,$$(var).$$(arch),$(PlatformKey).$$(var).$$(arch))))\ | ||
$$(foreach config,$$(Configs),\ | ||
$$(foreach arch,$(AvailableArchs),\ | ||
$$(if $$(call strneq,UNDEFINED,$$($$(var).$$(config).$$(arch))),\ | ||
$$(call CopyVariable,$$(var).$$(config).$$(arch),\ | ||
$(PlatformKey).$$(var).$$(config).$$(arch)))))) | ||
|
||
ifneq ($(DEBUGMAKE),) | ||
$$(info MAKE: $(PlatformName): Done loading platform) | ||
endif | ||
endef | ||
|
||
# Evaluate this now so we do not have to worry about order of evaluation. | ||
PlatformFiles := $(wildcard make/platform/*.mk) | ||
ifneq ($(DEBUGMAKE),) | ||
$(info MAKE: Loading platforms: $(PlatformFiles)) | ||
endif | ||
|
||
$(foreach file,$(PlatformFiles),\ | ||
$(eval $(call load_platform_template,$(file)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Options which may be overriden for platforms, etc. | ||
# | ||
# This list of such variables should be kept up to date with AvailableOptions in | ||
# 'make/lib_info.mk'. | ||
|
||
# The compiler to use. | ||
CC := gcc | ||
|
||
# The compiler flags to use. | ||
CFLAGS := -Wall -Werror | ||
|
||
# The list of functions to include in the library. | ||
FUNCTIONS := | ||
|
||
# Whether optimized function implementations should be used. | ||
OPTIMIZED := 1 | ||
|
||
# Miscellaneous tools. | ||
|
||
AR := ar | ||
# FIXME: Remove these pipes once ranlib errors are fixed. | ||
ARFLAGS := cru 2> /dev/null | ||
RANLIB := ranlib | ||
# FIXME: Remove these pipes once ranlib errors are fixed. | ||
RANLIBFLAGS := 2> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Configurations to build | ||
# | ||
# This section must define: | ||
# Description - A description of this target. | ||
# Configs - The names of each configuration to build; this is used to build | ||
# multiple libraries inside a single configuration file (for | ||
# example, Debug and Release builds, or builds with and without | ||
# software floating point). | ||
# | ||
# This section must define one of: | ||
# UniveralArchs - A list of architectures to build for, when using universal build | ||
# support (e.g., on Darwin). This should only be used to build fat | ||
# libraries, simply building multiple libraries for different | ||
# architectures should do so using distinct configs, with the | ||
# appropriate choices for CC and CFLAGS. | ||
# | ||
# Arch - The target architecture; this must match the compiler-rt name for the | ||
# architecture and is used to find the appropriate function | ||
# implementations. | ||
# | ||
# When not universal builds, this section may define: | ||
# Arch.<Config Name> - Set the target architecture on a per-config basis. | ||
|
||
Description := Target for building universal libraries for Darwin. | ||
|
||
Configs := Debug Release Profile | ||
UniversalArchs := i386 ppc x86_64 | ||
|
||
# Platform Options | ||
# | ||
# This section may override any of the variables in make/options.mk, using: | ||
# <Option Name> := ... option value ... | ||
# | ||
# See make/options.mk for the available options and their meanings. Options can | ||
# be override on a per-config, per-arch, or per-config-and-arch basis using: | ||
# <Option Name>.<Config Name> := ... | ||
# <Option Name>.<Arch Name> := ... | ||
# <Option Name>.<Config Name>.<Arch Name> := ... | ||
|
||
CC := gcc | ||
|
||
CFLAGS := -Wall -Werror | ||
CFLAGS.Debug := $(CFLAGS) -g | ||
CFLAGS.Release := $(CFLAGS) -O3 -fomit-frame-pointer | ||
CFLAGS.Profile := $(CFLAGS) -pg -g | ||
|
||
FUNCTIONS.i386 := $(CommonFunctions) $(ArchFunctions.i386) | ||
FUNCTIONS.ppc := $(CommonFunctions) $(ArchFunctions.ppc) | ||
FUNCTIONS.x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) | ||
FUNCTIONS.armv6 := $(CommonFunctions) $(ArchFunctions.armv6) | ||
FUNCTIONS.armv7 := $(CommonFunctions) $(ArchFunctions.armv7) | ||
|
||
OPTIMIZED.Debug := 0 |
Oops, something went wrong.