[llvm-commits] [compiler-rt] r93720 - in /compiler-rt/trunk: Makefile make/config.mk make/lib_info.mk make/lib_platforms.mk make/lib_util.mk make/options.mk make/platform/ make/platform/darwin_fat.mk make/platform/multi_arch.mk make/subdir.mk make/test/test-util.mk make/util.mk test/Unit/test test/timing/time

Daniel Dunbar daniel at zuster.org
Sun Jan 17 22:49:34 PST 2010


Author: ddunbar
Date: Mon Jan 18 00:49:33 2010
New Revision: 93720

URL: http://llvm.org/viewvc/llvm-project?rev=93720&view=rev
Log:
Add support for "platform" configurations, which define a suite of compiler-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.

Added:
    compiler-rt/trunk/make/lib_platforms.mk
    compiler-rt/trunk/make/options.mk
    compiler-rt/trunk/make/platform/
    compiler-rt/trunk/make/platform/darwin_fat.mk
    compiler-rt/trunk/make/platform/multi_arch.mk
Modified:
    compiler-rt/trunk/Makefile
    compiler-rt/trunk/make/config.mk
    compiler-rt/trunk/make/lib_info.mk
    compiler-rt/trunk/make/lib_util.mk
    compiler-rt/trunk/make/subdir.mk
    compiler-rt/trunk/make/test/test-util.mk
    compiler-rt/trunk/make/util.mk
    compiler-rt/trunk/test/Unit/test
    compiler-rt/trunk/test/timing/time

Modified: compiler-rt/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/Makefile?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/Makefile (original)
+++ compiler-rt/trunk/Makefile Mon Jan 18 00:49:33 2010
@@ -1,7 +1,7 @@
 SubDirs := lib
 
 # Set default rule before anything else.
-all::
+all: help
 
 include make/config.mk
 include make/util.mk
@@ -32,14 +32,22 @@
 	@echo "  VERBOSE=1: Use to show all commands [default=0]"
 	@echo
 	@echo "Available targets:"
-	@echo "  clean: clean all configurations"
-	@echo "  test:  run unit tests"
-	@echo "  all:   build all configurations"
+	@echo "  <platform name>: build the libraries for 'platform'"
+	@echo "  clean:           clean all configurations"
+	@echo "  test:            run unit tests"
+	@echo
+	@echo "  info-platforms:  list available platforms"
+	@echo "  help-devel:      print additional help for developers"
 	@echo
 
 help-devel: help
 	@echo "Development targets:"
+	@echo "  <platform name>-<config name>:"
+	@echo "    build the libraries for a single platform config"
+	@echo "  <platform name>-<config name>-<arch name>:"
+	@echo "    build the libraries for a single config and arch"
 	@echo "  info-functions: list available compiler-rt functions"
+	@echo "  help-hidden: print help for Makefile debugging"
 	@echo
 
 help-hidden: help-devel
@@ -59,6 +67,15 @@
 	  printf "  %-20s - available in (%s)\n" $(fn)\
 	    "$(foreach key,$(AvailableIn.$(fn)),$($(key).Dir))";)
 
+info-platforms:
+	@echo "compiler-rt Available Platforms"
+	@echo
+	@echo "Platforms:"
+	@$(foreach key,$(PlatformKeys),\
+	  printf "  %s - from '%s'\n" $($(key).Name) $($(key).Path);\
+	  printf "    %s\n" "$($(key).Description)";\
+	  printf "    Configurations: %s\n\n" "$($(key).Configs)";)
+
 # Provide default clean target which is extended by other templates.
 .PHONY: clean
 clean::
@@ -88,6 +105,128 @@
 include make/subdir.mk
 include make/lib_info.mk
 include make/lib_util.mk
+include make/lib_platforms.mk
+
+###
+# Define Platform Rules
+
+define PerPlatform_template
+$(call Set,Tmp.Key,$(1))
+$(call Set,Tmp.Name,$($(Tmp.Key).Name))
+$(call Set,Tmp.Configs,$($(Tmp.Key).Configs))
+$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name))
+
+# Top-Level Platform Target
+$(Tmp.Name):: $(Tmp.Configs:%=$(Tmp.ObjPath)/%/libcompiler_rt.a)
+.PHONY: $(Tmp.Name)
+
+clean::
+	$(Verb) rm -rf $(Tmp.ObjPath)
+
+# Per-Config Libraries
+$(foreach config,$(Tmp.Configs),\
+  $(call PerPlatformConfig_template,$(config)))
+endef
+
+define PerPlatformConfig_template
+$(call Set,Tmp.Config,$(1))
+$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config))
+
+# Compute the archs to build, depending on whether this is a universal build or
+# not.
+$(call Set,Tmp.ArchsToBuild,\
+  $(if $(call IsDefined,$(Tmp.Key).UniversalArchs),\
+       $($(Tmp.Key).UniversalArchs),\
+       $(call VarOrDefault,$(Tmp.Key).Arch.$(Tmp.Config),$($(Tmp.Key).Arch))))
+
+# Copy or lipo to create the per-config library.
+$(call Set,Tmp.Inputs,$(Tmp.ArchsToBuild:%=$(Tmp.ObjPath)/%/libcompiler_rt.a))
+$(Tmp.ObjPath)/libcompiler_rt.a: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
+	$(Summary) "  FINAL-ARCHIVE: $(Tmp.Name)/$(Tmp.Config): $$@"
+	-$(Verb) $(RM) $$@
+	$(if $(call streq,1,$(words $(Tmp.ArchsToBuild))), \
+	  $(Verb) $(CP) $(Tmp.Inputs) $$@, \
+	  $(Verb) $(LIPO) -create -output $$@ $(Tmp.Inputs))
+.PRECIOUS: $(Tmp.ObjPath)/.dir
+
+# Per-Config Targets
+$(Tmp.Name)-$(Tmp.Config):: $(Tmp.ObjPath)/libcompiler_rt.a
+.PHONY: $(Tmp.Name)-$(Tmp.Config)
+
+# Per-Config-Arch Libraries
+$(foreach arch,$(Tmp.ArchsToBuild),\
+  $(call PerPlatformConfigArch_template,$(arch)))
+endef
+
+define PerPlatformConfigArch_template
+$(call Set,Tmp.Arch,$(1))
+$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch))
+$(call Set,Tmp.Functions,$(strip \
+  $(call GetCNAVar,FUNCTIONS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.Optimized,$(strip \
+  $(call GetCNAVar,OPTIMIZED,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.AR,$(strip \
+  $(call GetCNAVar,AR,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.ARFLAGS,$(strip \
+  $(call GetCNAVar,ARFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.RANLIB,$(strip \
+  $(call GetCNAVar,RANLIB,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.RANLIBFLAGS,$(strip \
+  $(call GetCNAVar,RANLIBFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+
+# Compute the object inputs for this library.
+$(call Set,Tmp.Inputs,\
+  $(foreach fn,$(sort $(Tmp.Functions)),\
+    $(call Set,Tmp.FnDir,\
+      $(call SelectFunctionDir,$(Tmp.Config),$(Tmp.Arch),$(fn),$(Tmp.Optimized)))\
+    $(Tmp.ObjPath)/$(Tmp.FnDir)/$(fn).o))
+$(Tmp.ObjPath)/libcompiler_rt.a: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir
+	$(Summary) "  ARCHIVE:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@"
+	-$(Verb) $(RM) $$@
+	$(Verb) $(Tmp.AR) $(Tmp.ARFLAGS) $$@ $(Tmp.Inputs)
+	$(Verb) $(Tmp.RANLIB) $(Tmp.RANLIBFLAGS) $$@
+.PRECIOUS: $(Tmp.ObjPath)/.dir
+
+# Per-Config-Arch Targets
+$(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch):: $(Tmp.ObjPath)/libcompiler_rt.a
+.PHONY: $(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch)
+
+# Per-Config-Arch-SubDir Objects
+$(foreach key,$(SubDirKeys),\
+  $(call PerPlatformConfigArchSubDir_template,$(key)))
+endef
+
+define PerPlatformConfigArchSubDir_template
+$(call Set,Tmp.SubDirKey,$(1))
+$(call Set,Tmp.SubDir,$($(Tmp.SubDirKey).Dir))
+$(call Set,Tmp.SrcPath,$(ProjSrcRoot)/$(Tmp.SubDir))
+$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch)/$(Tmp.SubDirKey))
+$(call Set,Tmp.Dependencies,$($(Tmp.SubDirKey).Dependencies))
+$(call Set,Tmp.CC,$(strip \
+  $(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.CFLAGS,$(strip \
+  $(call GetCNAVar,CFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))
+$(call Set,Tmp.ArchFlag,$(strip \
+  $(if $(call IsDefined,$(Tmp.Key).UniversalArchs),-arch $(Tmp.Arch),)))
+
+$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.s $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
+	$(Summary) "  ASSEMBLE:  $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<"
+	$(Verb) $(Tmp.CC) $(Tmp.ArchFlag) $(Tmp.CFLAGS)  -c -o $$@ $$<
+$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.S $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
+	$(Summary) "  ASSEMBLE:  $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<"
+	$(Verb) $(Tmp.CC) $(Tmp.ArchFlag) $(Tmp.CFLAGS) -c -o $$@ $$<
+$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.c $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir
+	$(Summary) "  COMPILE:   $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<"
+	$(Verb) $(Tmp.CC) $(Tmp.ArchFlag) $(Tmp.CFLAGS) -c -o $$@ $$<
+.PRECIOUS: $(Tmp.ObjPath)/.dir
+
+endef
+
+# Run templates.
+$(foreach key,$(PlatformKeys),\
+  $(eval $(call PerPlatform_template,$(key))))
+
+###
 
 ifneq ($(DEBUGMAKE),)
   $(info MAKE: Done processing Makefile)

Modified: compiler-rt/trunk/make/config.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/config.mk?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/make/config.mk (original)
+++ compiler-rt/trunk/make/config.mk Mon Jan 18 00:49:33 2010
@@ -11,16 +11,9 @@
 ###
 # Tool configuration variables.
 
-CC := gcc
 # FIXME: LLVM uses autoconf/mkinstalldirs ?
 MKDIR := mkdir -p
 DATE := date
-AR := ar
-# FIXME: Remove these pipes once ranlib errors are fixed.
-AR.Flags := cru 2> /dev/null
-RANLIB := ranlib
-# FIXME: Remove these pipes once ranlib errors are fixed.
-RANLIB.Flags := 2> /dev/null
 LIPO := lipo
 CP := cp
 
@@ -38,9 +31,6 @@
 endif
 
 Echo := @echo
-Archive := $(AR) $(AR.Flags)
-Ranlib := $(RANLIB) $(RANLIB.Flags)
-Lipo := $(LIPO)
 ifndef Summary
-	Summary = $(Echo)
+  Summary = $(Echo)
 endif

Modified: compiler-rt/trunk/make/lib_info.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/lib_info.mk?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/make/lib_info.mk (original)
+++ compiler-rt/trunk/make/lib_info.mk Mon Jan 18 00:49:33 2010
@@ -42,3 +42,8 @@
 $(foreach key,$(SubDirKeys),\
   $(foreach fn,$(basename $($(key).ObjNames)),\
     $(call Append,AvailableIn.$(fn),$(key))))
+
+# The names of all the available options.
+AvailableOptions := AR ARFLAGS \
+                    CC CFLAGS FUNCTIONS OPTIMIZED \
+                    RANLIB RANLIBFLAGS

Added: compiler-rt/trunk/make/lib_platforms.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/lib_platforms.mk?rev=93720&view=auto

==============================================================================
--- compiler-rt/trunk/make/lib_platforms.mk (added)
+++ compiler-rt/trunk/make/lib_platforms.mk Mon Jan 18 00:49:33 2010
@@ -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))))

Modified: compiler-rt/trunk/make/lib_util.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/lib_util.mk?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/make/lib_util.mk (original)
+++ compiler-rt/trunk/make/lib_util.mk Mon Jan 18 00:49:33 2010
@@ -2,6 +2,15 @@
 #
 # This should be included following 'lib_info.mk'.
 
+# Function: GetCNAVar variable-name platform-key config arch
+#
+# Get a per-config-and-arch variable value.
+GetCNAVar = $(strip \
+  $(or $($(2).$(1).$(3).$(4)), \
+       $($(2).$(1).$(3)), \
+       $($(2).$(1).$(4)), \
+       $($(2).$(1))))
+
 # Function: SelectFunctionDir config arch function-name optimized
 #
 # Choose the appropriate implementation directory to use for 'function-name' in

Added: compiler-rt/trunk/make/options.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/options.mk?rev=93720&view=auto

==============================================================================
--- compiler-rt/trunk/make/options.mk (added)
+++ compiler-rt/trunk/make/options.mk Mon Jan 18 00:49:33 2010
@@ -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

Added: compiler-rt/trunk/make/platform/darwin_fat.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/darwin_fat.mk?rev=93720&view=auto

==============================================================================
--- compiler-rt/trunk/make/platform/darwin_fat.mk (added)
+++ compiler-rt/trunk/make/platform/darwin_fat.mk Mon Jan 18 00:49:33 2010
@@ -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

Added: compiler-rt/trunk/make/platform/multi_arch.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/multi_arch.mk?rev=93720&view=auto

==============================================================================
--- compiler-rt/trunk/make/platform/multi_arch.mk (added)
+++ compiler-rt/trunk/make/platform/multi_arch.mk Mon Jan 18 00:49:33 2010
@@ -0,0 +1,16 @@
+Description := Example configuration for build two libraries for separate \
+architectures.
+
+Configs := m32 m64
+Arch := i386
+Arch.m64 := x86_64
+
+CC := gcc
+CC.m32 := clang
+
+CFLAGS := -Wall -Werror
+CFLAGS.m32 := $(CFLAGS) -m32 -O3
+CFLAGS.m64 := $(CFLAGS) -m64 -O3
+
+FUNCTIONS := moddi3 floatundixf udivdi3
+FUNCTIONS.m64 := $(FUNCTIONS) lshrdi3
\ No newline at end of file

Modified: compiler-rt/trunk/make/subdir.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/subdir.mk?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/make/subdir.mk (original)
+++ compiler-rt/trunk/make/subdir.mk Mon Jan 18 00:49:33 2010
@@ -74,7 +74,11 @@
 endef
 
 # Evaluate this now so we do not have to worry about order of evaluation.
-SubDirsList := $(SubDirs:%=$(Dir)/%)
+
+SubDirsList := $(strip \
+  $(if $(call streq,.,$(Dir)),\
+       $(SubDirs),\
+       $(SubDirs:%=$(Dir)/%)))
 ifeq ($(SubDirsList),)
 else
   ifneq ($(DEBUGMAKE),)

Modified: compiler-rt/trunk/make/test/test-util.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/test/test-util.mk?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/make/test/test-util.mk (original)
+++ compiler-rt/trunk/make/test/test-util.mk Mon Jan 18 00:49:33 2010
@@ -53,6 +53,13 @@
 varordefault_t1 = $(call VarOrDefault,varordefault_t1_var.opt,$(varordefault_t1_var))
 $(call AssertEqual,varordefault_t1,2)
 
+$(call CopyVariable,copyvariable_t0_src,copyvariable_t0_dst)
+copyvariable_t0 = $(call IsUndefined,copyvariable_t0_dst)
+$(call AssertEqual,copyvariable_t0,true)
+copyvariable_t1_src = 1
+$(call CopyVariable,copyvariable_t1_src,copyvariable_t1)
+$(call AssertEqual,copyvariable_t1,1)
+
 all:
 	@true
 .PHONY: all

Modified: compiler-rt/trunk/make/util.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/util.mk?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/make/util.mk (original)
+++ compiler-rt/trunk/make/util.mk Mon Jan 18 00:49:33 2010
@@ -66,6 +66,15 @@
 #   CHECKVALUE: foo: $(call streq,,) - true
 CheckValue = $(info CHECKVALUE: $(1): $(value $(1)) - $($(1)))
 
+# Function: CopyVariable src dst
+#
+# Copy the value of the variable 'src' to 'dst', taking care to not define 'dst'
+# if 'src' is undefined. The destination variable must be undefined.
+CopyVariable = \
+  $(call AssertValue,$(call IsUndefined,$(2)),destination is already defined)\
+  $(if $(call IsUndefined,$(1)),,\
+       $(call Set,$(2),$($(1))))
+
 # Function: Assert value message
 #
 # Check that a value is true, or give an error including the given message

Modified: compiler-rt/trunk/test/Unit/test
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/test?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/test/Unit/test (original)
+++ compiler-rt/trunk/test/Unit/test Mon Jan 18 00:49:33 2010
@@ -40,14 +40,14 @@
     fi
     if test "$REMOTE" = "1"
     then 
-      if gcc $CFLAGS $FILE ../../Release/libcompiler_rt.Optimized.a $LIBS $EXTRA -o ./remote/$FILE.exe
+      if gcc $CFLAGS $FILE ../../darwin_fat/Release/libcompiler_rt.a $LIBS $EXTRA -o ./remote/$FILE.exe
       then
         echo "Built $FILE.exe for $ARCH"
       else
         echo "$FILE failed to compile"
       fi
     else
-      if gcc $CFLAGS $FILE ../../Release/libcompiler_rt.Optimized.a $LIBS $EXTRA
+      if gcc $CFLAGS $FILE ../../darwin_fat/Release/libcompiler_rt.a $LIBS $EXTRA
       then
         echo "Testing $FILE for $ARCH"
         if ./a.out

Modified: compiler-rt/trunk/test/timing/time
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/timing/time?rev=93720&r1=93719&r2=93720&view=diff

==============================================================================
--- compiler-rt/trunk/test/timing/time (original)
+++ compiler-rt/trunk/test/timing/time Mon Jan 18 00:49:33 2010
@@ -27,8 +27,7 @@
 		echo "Timing $FILE for $ARCH"
 
 		test $ARCH $FILE libgcc ""
-                test $ARCH $FILE untuned ../../Release/libcompiler_rt.Generic.a
-                test $ARCH $FILE tuned ../../Release/libcompiler_rt.Optimized.a
+                test $ARCH $FILE tuned ../../darwin_fat/Release/libcompiler_rt.a
                 if [ -f "$INSTALLED" ]; then
                     test $ARCH $FILE installed $INSTALLED
 		fi





More information about the llvm-commits mailing list