Index: compiler-rt/trunk/Makefile =================================================================== --- compiler-rt/trunk/Makefile +++ compiler-rt/trunk/Makefile @@ -1,275 +0,0 @@ -SubDirs := lib - -# Set default rule before anything else. -all: help - -include make/config.mk -include make/util.mk -# If SRCROOT is defined, assume we are doing an Apple style build. We should be -# able to use RC_XBS for this but that is unused during "make installsrc". -ifdef SRCROOT - include make/AppleBI.mk -endif - -# Make sure we don't build with a missing ProjObjRoot. -ifeq ($(ProjObjRoot),) -$(error Refusing to build with empty ProjObjRoot variable) -endif - -############## - -### -# Rules - -### -# Top level targets - -# FIXME: Document the available subtargets. -help: - @echo "usage: make [{VARIABLE=VALUE}*] target" - @echo - @echo "User variables:" - @echo " VERBOSE=1: Use to show all commands [default=0]" - @echo - @echo "Available targets:" - @echo " : 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 " -:" - @echo " build the libraries for a single platform config" - @echo " --:" - @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 - @echo "Debugging variables:" - @echo " DEBUGMAKE=1: enable some Makefile logging [default=]" - @echo " =2: enable more Makefile logging" - @echo - @echo "Debugging targets:" - @echo " make-print-FOO: print information on the variable 'FOO'" - @echo - -info-functions: - @echo "compiler-rt Available Functions" - @echo - @echo "All Functions: $(AvailableFunctions)" - @$(foreach fn,$(AvailableFunctions),\ - 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:: - -# Test -.PHONY: test -test: - cd test/Unit && ./test - -### -# Directory handling magic. - -# Create directories as needed, and timestamp their creation. -%/.dir: - $(Summary) " MKDIR: $*" - $(Verb) $(MKDIR) $* > /dev/null - $(Verb) echo 'Created.' > $@ - -# Remove directories -%/.remove: - $(Verb) $(RM) -r $* - -### -# Include child makefile fragments - -Dir := . -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.Name)-%) -.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)) -$(call Set,Tmp.SHARED_LIBRARY,$(strip \ - $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) -$(call Set,Tmp.SHARED_LIBRARY_SUFFIX,$(strip \ - $(call GetCNAVar,SHARED_LIBRARY_SUFFIX,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) - -# Compute the library suffix. -$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)), - $(call Set,Tmp.LibrarySuffix,$(Tmp.SHARED_LIBRARY_SUFFIX)), - $(call Set,Tmp.LibrarySuffix,a)) - -# 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),\ - $(strip \ - $(or $($(Tmp.Key).UniversalArchs.$(Tmp.Config)),\ - $($(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.$(Tmp.LibrarySuffix))) -$(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix): $(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.$(Tmp.LibrarySuffix) -.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 \ - $(AlwaysRequiredModules) \ - $(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.CC,$(strip \ - $(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) -$(call Set,Tmp.LDFLAGS,$(strip \ - $(call GetCNAVar,LDFLAGS,$(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)))) -$(call Set,Tmp.SHARED_LIBRARY,$(strip \ - $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) - -# Compute the library suffix. -$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)), - $(call Set,Tmp.LibrarySuffix,$(Tmp.SHARED_LIBRARY_SUFFIX)), - $(call Set,Tmp.LibrarySuffix,a)) - -# 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) $$@ -$(Tmp.ObjPath)/libcompiler_rt.dylib: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir - $(Summary) " DYLIB: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@" - $(Verb) $(Tmp.CC) -arch $(Tmp.Arch) -dynamiclib -o $$@ \ - $(Tmp.Inputs) $(Tmp.LDFLAGS) -$(Tmp.ObjPath)/libcompiler_rt.so: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir - $(Summary) " SO: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@" - $(Verb) $(Tmp.CC) -shared -o $$@ \ - $(Tmp.Inputs) $(Tmp.LDFLAGS) -.PRECIOUS: $(Tmp.ObjPath)/.dir - -# Per-Config-Arch Targets -$(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch):: $(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix) -.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.KERNEL_USE,$(strip \ - $(call GetCNAVar,KERNEL_USE,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) -$(call Set,Tmp.VISIBILITY_HIDDEN,$(strip \ - $(call GetCNAVar,VISIBILITY_HIDDEN,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) -$(call Set,Tmp.CFLAGS,$(strip \ - $(if $(call IsDefined,$(Tmp.Key).UniversalArchs),-arch $(Tmp.Arch),)\ - $(if $(call streq,$(Tmp.VISIBILITY_HIDDEN),1),\ - -fvisibility=hidden -DVISIBILITY_HIDDEN,)\ - $(if $(call streq,$(Tmp.KERNEL_USE),1),\ - -mkernel -DKERNEL_USE,)\ - $(call GetCNAVar,CFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) - -$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.s $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir - $(Summary) " ASSEMBLE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" - $(Verb) $(Tmp.CC) $(COMMON_ASMFLAGS) $(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) $(COMMON_ASMFLAGS) $(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) $(COMMON_CFLAGS) $(Tmp.CFLAGS) -c -o $$@ $$< -$(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.cc $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir - $(Summary) " COMPILE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" - $(Verb) $(Tmp.CC) $(COMMON_CXXFLAGS) $(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) - $(info ) -endif Index: compiler-rt/trunk/lib/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/Makefile.mk +++ compiler-rt/trunk/lib/Makefile.mk @@ -1,13 +0,0 @@ -#===- lib/Makefile.mk --------------------------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -SubDirs := - -# Add submodules. -SubDirs += builtins Index: compiler-rt/trunk/lib/builtins/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/builtins/Makefile.mk +++ compiler-rt/trunk/lib/builtins/Makefile.mk @@ -1,25 +0,0 @@ -#===- lib/builtins/Makefile.mk -----------------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -ModuleName := builtins -SubDirs := - -# Add arch specific optimized implementations. -SubDirs += i386 ppc x86_64 arm armv6m - -# Add ARM64 dir. -SubDirs += arm64 - -# Define the variables for this specific directory. -Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) -ObjNames := $(Sources:%.c=%.o) -Implementation := Generic - -# FIXME: use automatic dependencies? -Dependencies := $(wildcard $(Dir)/*.h) Index: compiler-rt/trunk/lib/builtins/arm/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/builtins/arm/Makefile.mk +++ compiler-rt/trunk/lib/builtins/arm/Makefile.mk @@ -1,20 +0,0 @@ -#===- lib/builtins/arm/Makefile.mk -------------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -ModuleName := builtins -SubDirs := -OnlyArchs := armv5 armv6 armv7 armv7k armv7m armv7em armv7s - -AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) -Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) -ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) -Implementation := Optimized - -# FIXME: use automatic dependencies? -Dependencies := $(wildcard lib/*.h $(Dir)/*.h) Index: compiler-rt/trunk/lib/builtins/arm64/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/builtins/arm64/Makefile.mk +++ compiler-rt/trunk/lib/builtins/arm64/Makefile.mk @@ -1,20 +0,0 @@ -#===- lib/builtins/arm64/Makefile.mk -----------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -ModuleName := builtins -SubDirs := -OnlyArchs := arm64 - -AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) -Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) -ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) -Implementation := Optimized - -# FIXME: use automatic dependencies? -Dependencies := $(wildcard lib/*.h $(Dir)/*.h) Index: compiler-rt/trunk/lib/builtins/armv6m/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/builtins/armv6m/Makefile.mk +++ compiler-rt/trunk/lib/builtins/armv6m/Makefile.mk @@ -1,20 +0,0 @@ -#===- lib/builtins/arm/Makefile.mk -------------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -ModuleName := builtins -SubDirs := -OnlyArchs := armv6m - -AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) -Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) -ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) -Implementation := Optimized - -# FIXME: use automatic dependencies? -Dependencies := $(wildcard lib/*.h $(Dir)/*.h) Index: compiler-rt/trunk/lib/builtins/i386/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/builtins/i386/Makefile.mk +++ compiler-rt/trunk/lib/builtins/i386/Makefile.mk @@ -1,20 +0,0 @@ -#===- lib/builtins/i386/Makefile.mk ------------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -ModuleName := builtins -SubDirs := -OnlyArchs := i386 - -AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) -Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) -ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) -Implementation := Optimized - -# FIXME: use automatic dependencies? -Dependencies := $(wildcard lib/*.h $(Dir)/*.h) Index: compiler-rt/trunk/lib/builtins/ppc/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/builtins/ppc/Makefile.mk +++ compiler-rt/trunk/lib/builtins/ppc/Makefile.mk @@ -1,20 +0,0 @@ -#===- lib/builtins/ppc/Makefile.mk -------------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -ModuleName := builtins -SubDirs := -OnlyArchs := ppc - -AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) -Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) -ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) -Implementation := Optimized - -# FIXME: use automatic dependencies? -Dependencies := $(wildcard lib/*.h $(Dir)/*.h) Index: compiler-rt/trunk/lib/builtins/x86_64/Makefile.mk =================================================================== --- compiler-rt/trunk/lib/builtins/x86_64/Makefile.mk +++ compiler-rt/trunk/lib/builtins/x86_64/Makefile.mk @@ -1,20 +0,0 @@ -#===- lib/builtins/x86_64/Makefile.mk ----------------------*- Makefile -*--===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -ModuleName := builtins -SubDirs := -OnlyArchs := x86_64 x86_64h - -AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) -Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) -ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) -Implementation := Optimized - -# FIXME: use automatic dependencies? -Dependencies := $(wildcard lib/*.h $(Dir)/*.h) Index: compiler-rt/trunk/make/AppleBI.mk =================================================================== --- compiler-rt/trunk/make/AppleBI.mk +++ compiler-rt/trunk/make/AppleBI.mk @@ -1,149 +0,0 @@ - -# -# Make rules to build compiler_rt in Apple B&I infrastructure -# - -# set ProjSrcRoot appropriately -ProjSrcRoot := $(SRCROOT) -# set ProjObjRoot appropriately -ifdef OBJROOT - ProjObjRoot := $(OBJROOT) -else - ProjObjRoot := $(ProjSrcRoot) -endif - -ifeq (,$(RC_PURPLE)) - INSTALL_TARGET = install-MacOSX -else - ifeq (,$(RC_INDIGO)) - INSTALL_TARGET = install-iOS - else - INSTALL_TARGET = install-iOS-Simulator - endif -endif - - - -# Log full compile lines in B&I logs and omit summary lines. -Verb := -Summary := @true - -# List of functions needed for each architecture. - -# Copies any public headers to DSTROOT. -installhdrs: - - -# Copies source code to SRCROOT. -installsrc: - cp -r . $(SRCROOT) - - -install: $(INSTALL_TARGET) - -# Copy results to DSTROOT. -install-MacOSX : $(SYMROOT)/libcompiler_rt.dylib \ - $(SYMROOT)/libcompiler_rt-dyld.a - mkdir -p $(DSTROOT)/usr/local/lib/dyld - cp $(SYMROOT)/libcompiler_rt-dyld.a \ - $(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a - mkdir -p $(DSTROOT)/usr/lib/system - $(call GetCNAVar,STRIP,Platform.darwin_bni,Release,) -S $(SYMROOT)/libcompiler_rt.dylib \ - -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib - cd $(DSTROOT)/usr/lib/system; \ - ln -s libcompiler_rt.dylib libcompiler_rt_profile.dylib; \ - ln -s libcompiler_rt.dylib libcompiler_rt_debug.dylib - -# Rule to make each dylib slice -$(OBJROOT)/libcompiler_rt-%.dylib : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a - echo "const char vers[] = \"@(#) $(RC_ProjectName)-$(RC_ProjectSourceVersion)\"; " > $(OBJROOT)/version.c - $(call GetCNAVar,CC,Platform.darwin_bni,Release,$*) \ - $(OBJROOT)/version.c -arch $* -dynamiclib \ - -install_name /usr/lib/system/libcompiler_rt.dylib \ - -compatibility_version 1 -current_version $(RC_ProjectSourceVersion) \ - -nodefaultlibs -umbrella System -dead_strip \ - -Wl,-upward-lunwind \ - -Wl,-upward-lsystem_m \ - -Wl,-upward-lsystem_c \ - -Wl,-upward-lsystem_kernel \ - -Wl,-upward-lsystem_platform \ - -Wl,-ldyld \ - -L$(SDKROOT)/usr/lib/system \ - $(DYLIB_FLAGS) -Wl,-force_load,$^ -o $@ - -# Rule to make fat dylib -$(SYMROOT)/libcompiler_rt.dylib: $(foreach arch,$(filter-out armv4t,$(RC_ARCHS)), \ - $(OBJROOT)/libcompiler_rt-$(arch).dylib) - $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@ - $(call GetCNAVar,DSYMUTIL,Platform.darwin_bni,Release,) $@ - - -# Copy results to DSTROOT. -install-iOS: $(SYMROOT)/libcompiler_rt-static.a \ - $(SYMROOT)/libcompiler_rt-dyld.a \ - $(SYMROOT)/libcompiler_rt.dylib - mkdir -p $(DSTROOT)/usr/local/lib - cp $(SYMROOT)/libcompiler_rt-static.a \ - $(DSTROOT)/usr/local/lib/libcompiler_rt-static.a - mkdir -p $(DSTROOT)/usr/local/lib/dyld - cp $(SYMROOT)/libcompiler_rt-dyld.a \ - $(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a - mkdir -p $(DSTROOT)/usr/lib/system - $(call GetCNAVar,STRIP,Platform.darwin_bni,Release,) -S $(SYMROOT)/libcompiler_rt.dylib \ - -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib - -# Rule to make fat archive -$(SYMROOT)/libcompiler_rt-static.a : $(foreach arch,$(RC_ARCHS), \ - $(OBJROOT)/darwin_bni/Static/$(arch)/libcompiler_rt.a) - $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@ - -# rule to make each archive slice for dyld (which removes a few archive members) -$(OBJROOT)/libcompiler_rt-dyld-%.a : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a - cp $^ $@ - DEL_LIST=`$(AR) -t $@ | egrep 'apple_versioning|gcc_personality_v0|eprintf' | xargs echo` ; \ - if [ -n "$${DEL_LIST}" ] ; \ - then \ - $(call GetCNAVar,AR,Platform.darwin_bni,Release,) -d $@ $${DEL_LIST}; \ - $(call GetCNAVar,RANLIB,Platform.darwin_bni,Release,) $@ ; \ - fi - -# rule to make make archive for dyld -$(SYMROOT)/libcompiler_rt-dyld.a : $(foreach arch,$(RC_ARCHS), \ - $(OBJROOT)/libcompiler_rt-dyld-$(arch).a) - $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@ - - - -# Copy results to DSTROOT. -install-iOS-Simulator: $(SYMROOT)/libcompiler_rt_sim.dylib \ - $(SYMROOT)/libcompiler_rt-dyld.a - mkdir -p $(DSTROOT)/$(SDKROOT)/usr/lib/system - $(call GetCNAVar,STRIP,Platform.darwin_bni,Release,) -S $(SYMROOT)/libcompiler_rt_sim.dylib \ - -o $(DSTROOT)/$(SDKROOT)/usr/lib/system/libcompiler_rt_sim.dylib - mkdir -p $(DSTROOT)/$(SDKROOT)/usr/local/lib/dyld - cp $(SYMROOT)/libcompiler_rt-dyld.a \ - $(DSTROOT)/$(SDKROOT)/usr/local/lib/dyld/libcompiler_rt.a - -# Rule to make fat dylib -$(SYMROOT)/libcompiler_rt_sim.dylib: $(foreach arch,$(RC_ARCHS), \ - $(OBJROOT)/libcompiler_rt_sim-$(arch).dylib) - $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@ - $(call GetCNAVar,DSYMUTIL,Platform.darwin_bni,Release,) $@ - -# Rule to make each dylib slice -$(OBJROOT)/libcompiler_rt_sim-%.dylib : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a - echo "const char vers[] = \"@(#) $(RC_ProjectName)-$(RC_ProjectSourceVersion)\"; " > $(OBJROOT)/version.c - $(call GetCNAVar,CC,Platform.darwin_bni,Release,$*) \ - $(OBJROOT)/version.c -arch $* -dynamiclib \ - -install_name /usr/lib/system/libcompiler_rt_sim.dylib \ - -compatibility_version 1 -current_version $(RC_ProjectSourceVersion) \ - -Wl,-unexported_symbol,___enable_execute_stack \ - -nostdlib \ - -Wl,-upward-lunwind_sim \ - -Wl,-upward-lsystem_sim_m \ - -Wl,-upward-lsystem_sim_c \ - -ldyld_sim \ - -Wl,-upward-lSystem \ - -umbrella System -Wl,-no_implicit_dylibs -L$(SDKROOT)/usr/lib/system -dead_strip \ - $(DYLIB_FLAGS) -Wl,-force_load,$^ -o $@ - Index: compiler-rt/trunk/make/config.mk =================================================================== --- compiler-rt/trunk/make/config.mk +++ compiler-rt/trunk/make/config.mk @@ -1,49 +0,0 @@ -### -# 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. -ProjSrcRoot := $(shell pwd) -ProjObjRoot := $(ProjSrcRoot) - -# The list of modules which are required to be built into every library. This -# should only be used for internal utilities which could be used in any other -# module. Any other cases the platform should be allowed to opt-in to. -AlwaysRequiredModules := int_util - -### -# Tool configuration variables. - -# FIXME: LLVM uses autoconf/mkinstalldirs ? -MKDIR := mkdir -p -DATE := date -LIPO := lipo -CP := cp -DSYMUTIL := dsymutil - -VERBOSE := 0 -DEBUGMAKE := - -### -# Automatic and derived variables. - -# Adjust settings for verbose mode -ifneq ($(VERBOSE),1) - Verb := @ -else - Verb := -endif - -Echo := @echo -ifndef Summary - Summary = $(Echo) -endif - -### -# Common compiler options -COMMON_INCLUDES=-I${ProjSrcRoot}/lib -I${ProjSrcRoot}/include -COMMON_CXXFLAGS=-std=c++11 -fno-exceptions -fPIC -funwind-tables $(COMMON_INCLUDES) -COMMON_CFLAGS=-fPIC $(COMMON_INCLUDES) -COMMON_ASMFLAGS=$(COMMON_INCLUDES) Index: compiler-rt/trunk/make/filter-inputs =================================================================== --- compiler-rt/trunk/make/filter-inputs +++ compiler-rt/trunk/make/filter-inputs @@ -1,25 +0,0 @@ -#!/usr/bin/env python - -#===- make/filter-inputs ---------------------------------------------------===# -# -# The LLVM Compiler Infrastructure -# -# This file is distributed under the University of Illinois Open Source -# License. See LICENSE.TXT for details. -# -#===------------------------------------------------------------------------===# - -# Given a list of files, return a new list of files taking only the -# first file for any particular filename. -def main(): - import os,sys - - seen = set() - for file in sys.argv[1:]: - base = os.path.basename(file) - if base not in seen: - seen.add(base) - print file - -if __name__ == '__main__': - main() Index: compiler-rt/trunk/make/lib_info.mk =================================================================== --- compiler-rt/trunk/make/lib_info.mk +++ compiler-rt/trunk/make/lib_info.mk @@ -1,59 +0,0 @@ -# compiler-rt Library Info -# -# This should be included once the subdirectory information has been loaded, and -# uses the utilities in 'util.mk'. -# -# This defines the following variables describing compiler-rt: -# AvailableFunctions - The entire list of function names (unmangled) the -# library can provide. -# CommonFunctions - The list of generic functions available. -# ArchFunctions. - The list of functions commonly available for -# 'arch'. This does not include any config specific -# functions. -# -# AvailableIn. - The list of subdir keys where 'function' is -# defined. - -# Determine the set of available modules. -AvailableModules := $(sort $(foreach key,$(SubDirKeys),\ - $($(key).ModuleName))) - -# Build a per-module map of subdir keys. -$(foreach key,$(SubDirKeys),\ - $(call Append,ModuleSubDirKeys.$($(key).ModuleName),$(key))) - -AvailableArchs := $(sort $(foreach key,$(SubDirKeys),\ - $($(key).OnlyArchs))) - -AvailableFunctions := $(sort $(foreach key,$(SubDirKeys),\ - $(basename $($(key).ObjNames)))) - -CommonFunctions := $(sort\ - $(foreach key,$(ModuleSubDirKeys.builtins),\ - $(if $(call strneq,,$(strip $($(key).OnlyArchs) $($(key).OnlyConfigs))),,\ - $(basename $($(key).ObjNames))))) - -# Compute common arch functions. -$(foreach key,$(ModuleSubDirKeys.builtins),\ - $(if $(call strneq,,$($(key).OnlyConfigs)),,\ - $(foreach arch,$($(key).OnlyArchs),\ - $(call Append,ArchFunctions.$(arch),$(sort \ - $(basename $($(key).ObjNames))))))) - -# Compute arch only functions. -$(foreach arch,$(AvailableArchs),\ - $(call Set,ArchFunctions.$(arch),$(sort $(ArchFunctions.$(arch))))\ - $(call Set,ArchOnlyFunctions.$(arch),\ - $(call set_difference,$(ArchFunctions.$(arch)),$(CommonFunctions)))) - -# Compute lists of where each function is available. -$(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 LDFLAGS FUNCTIONS OPTIMIZED \ - RANLIB RANLIBFLAGS \ - VISIBILITY_HIDDEN KERNEL_USE \ - SHARED_LIBRARY SHARED_LIBRARY_SUFFIX STRIP LIPO DSYMUTIL Index: compiler-rt/trunk/make/lib_platforms.mk =================================================================== --- compiler-rt/trunk/make/lib_platforms.mk +++ compiler-rt/trunk/make/lib_platforms.mk @@ -1,82 +0,0 @@ -# compiler-rt Configuration Support -# -# This should be included following 'lib_util.mk'. - -# The simple variables configurations can define. -PlainConfigVariables := Configs Description -PerConfigVariables := UniversalArchs 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)))) Index: compiler-rt/trunk/make/lib_util.mk =================================================================== --- compiler-rt/trunk/make/lib_util.mk +++ compiler-rt/trunk/make/lib_util.mk @@ -1,65 +0,0 @@ -# Library Utility Functions -# -# 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 -# the configuration 'config' and on given arch. -SelectFunctionDir = $(strip \ - $(call Set,Tmp.SelectFunctionDir,$(call SelectFunctionDirs,$(1),$(2),$(3),$(4)))\ - $(if $(call streq,1,$(words $(Tmp.SelectFunctionDir))),\ - $(Tmp.SelectFunctionDir),\ - $(error SelectFunctionDir: invalid function name "$(3)" ($(strip\ - $(if $(call streq,0,$(words $(Tmp.SelectFunctionDir))),\ - no such function,\ - function implemented in multiple directories!!!)))))) - -# Helper functions that select the entire list of subdirs where a function is -# defined with a certain specificity. -SelectFunctionDirs_Opt_ConfigAndArch = $(strip \ - $(foreach key,$(AvailableIn.$(3)),\ - $(if $(and $(call streq,Optimized,$($(key).Implementation)),\ - $(call contains,$($(key).OnlyConfigs),$(1)),\ - $(call contains,$($(key).OnlyArchs),$(2))),$(key),))) -SelectFunctionDirs_Opt_Config = $(strip \ - $(foreach key,$(AvailableIn.$(3)),\ - $(if $(and $(call streq,Optimized,$($(key).Implementation)),\ - $(call contains,$($(key).OnlyConfigs),$(1))),$(key),))) -SelectFunctionDirs_Opt_Arch = $(strip \ - $(foreach key,$(AvailableIn.$(3)),\ - $(if $(and $(call streq,Optimized,$($(key).Implementation)),\ - $(call contains,$($(key).OnlyArchs),$(2))),$(key),))) -SelectFunctionDirs_Gen = $(strip \ - $(foreach key,$(AvailableIn.$(3)),\ - $(if $(call streq,Generic,$($(key).Implementation)),$(key)))) - -# Helper function to select the right set of dirs in generic priority order. -SelectFunctions_Gen = \ - $(or $(call SelectFunctionDirs_Gen,$(1),$(2),$(3)),\ - $(call SelectFunctionDirs_Opt_ConfigAndArch,$(1),$(2),$(3)), \ - $(call SelectFunctionDirs_Opt_Config,$(1),$(2),$(3)), \ - $(call SelectFunctionDirs_Opt_Arch,$(1),$(2),$(3))) - -# Helper function to select the right set of dirs in optimized priority order. -SelectFunctions_Opt = \ - $(or $(call SelectFunctionDirs_Opt_ConfigAndArch,$(1),$(2),$(3)), \ - $(call SelectFunctionDirs_Opt_Config,$(1),$(2),$(3)), \ - $(call SelectFunctionDirs_Opt_Arch,$(1),$(2),$(3)), \ - $(call SelectFunctionDirs_Gen,$(1),$(2),$(3))) - -# Helper function to select the right set of dirs (which should be exactly one) -# for a function. -SelectFunctionDirs = \ - $(if $(call streq,1,$(4)),\ - $(call SelectFunctions_Opt,$(1),$(2),$(3)),\ - $(call SelectFunctions_Gen,$(1),$(2),$(3))) Index: compiler-rt/trunk/make/options.mk =================================================================== --- compiler-rt/trunk/make/options.mk +++ compiler-rt/trunk/make/options.mk @@ -1,48 +0,0 @@ -# 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 - -# Whether function definitions should use hidden visibility. This adds the -# -fvisibility=hidden compiler option and uses .private_extern annotations in -# assembly files. -# -# FIXME: Make this more portable. When that is done, it should probably be the -# default. -VISIBILITY_HIDDEN := 0 - -# Whether the library is being built for kernel use. -KERNEL_USE := 0 - -# Whether the library should be built as a shared object. -SHARED_LIBRARY := 0 - -# Miscellaneous tools. - -AR := ar -# FIXME: Remove these pipes once ranlib errors are fixed. -ARFLAGS := cru 2> /dev/null - -LDFLAGS := - -RANLIB := ranlib -# FIXME: Remove these pipes once ranlib errors are fixed. -RANLIBFLAGS := 2> /dev/null - -STRIP := strip -LIPO := lipo -DSYMUTIL := dsymutil - -SHARED_LIBRARY_SUFFIX := so Index: compiler-rt/trunk/make/platform/clang_darwin.mk =================================================================== --- compiler-rt/trunk/make/platform/clang_darwin.mk +++ compiler-rt/trunk/make/platform/clang_darwin.mk @@ -1,468 +0,0 @@ -# These are the functions which clang needs when it is targeting a previous -# version of the OS. The issue is that the backend may use functions which were -# not present in the libgcc that shipped on the platform. In such cases, we link -# with a version of the library which contains private_extern definitions of all -# the extra functions which might be referenced. - -Description := Static runtime libraries for clang/Darwin. - -# A function that ensures we don't try to build for architectures and SDKs -# that we don't have working toolchains for. Arguments: -# (1): List of architectures -# (2): Library name -# (3): SDK path -# The result is a possibly empty subset of the architectures from argument 1. -CheckArches = \ - $(shell \ - result=""; \ - if [ "X$(3)" != X ]; then \ - for arch in $(1); do \ - if $(LD) -v 2>&1 | grep "configured to support" \ - | tr ' ' '\n' | grep "^$$arch$$" >/dev/null 2>/dev/null; then \ - if $(CC) -arch $$arch \ - -integrated-as \ - $(ProjSrcRoot)/make/platform/clang_darwin_test_input.c \ - -isysroot $(3) \ - -o /dev/null > /dev/null 2> /dev/null; then \ - result="$$result$$arch "; \ - else \ - printf 1>&2 \ - "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'"; \ - printf 1>&2 " (clang or system libraries do not support it)\n"; \ - fi; \ - else \ - printf 1>&2 \ - "warning: clang_darwin.mk: dropping arch '$$arch' from lib '$(2)'";\ - printf 1>&2 " (ld does not support it)\n"; \ - fi; \ - done; \ - fi; \ - echo $$result) - -XCRun = \ - $(shell \ - result=`xcrun -find $(1) 2> /dev/null`; \ - if [ "$$?" != "0" ]; then result=$(1); fi; \ - echo $$result) -# Prefer building with the internal SDKs. -XCRunSdkPath = \ - $(shell \ - result=`xcrun --sdk $(1).internal --show-sdk-path 2> /dev/null`; \ - if [ "$$?" != "0" ]; then \ - result=`xcrun --sdk $(1) --show-sdk-path 2> /dev/null`; \ - if [ "$$?" != "0" ]; then result=""; fi; \ - fi; \ - echo $$result) -### - -CC := $(call XCRun,clang) -LD := $(shell $(CC) -print-prog-name=ld) -AR := $(call XCRun,ar) -RANLIB := $(call XCRun,ranlib) -STRIP := $(call XCRun,strip) -LIPO := $(call XCRun,lipo) -DSYMUTIL := $(call XCRun,dsymutil) - -OSX_SDK := $(call XCRunSdkPath,macosx) -IOS_SDK := $(call XCRunSdkPath,iphoneos) -IOSSIM_SDK := $(call XCRunSdkPath,iphonesimulator) - -Configs := -UniversalArchs := - -# Configuration solely for providing access to an eprintf symbol, which may -# still be referenced from Darwin system headers. This symbol is only ever -# needed on i386. -Configs += eprintf -UniversalArchs.eprintf := $(call CheckArches,i386,eprintf,$(OSX_SDK)) - -# Configuration for targeting 10.4. We need a few functions missing from -# libgcc_s.10.4.dylib. We only build x86 slices since clang doesn't really -# support targeting PowerPC. -Configs += 10.4 -UniversalArchs.10.4 := $(call CheckArches,i386 x86_64,10.4,$(OSX_SDK)) - -# Configuration for targeting iOS for a couple of functions that didn't -# make it into libSystem. -Configs += ios -UniversalArchs.ios := $(call CheckArches,i386 x86_64,ios,$(IOSSIM_SDK)) -UniversalArchs.ios += $(call CheckArches,armv7 arm64,ios,$(IOS_SDK)) - -# Configuration for targeting OSX. These functions may not be in libSystem -# so we should provide our own. -Configs += osx -UniversalArchs.osx := $(call CheckArches,i386 x86_64 x86_64h,osx,$(OSX_SDK)) - -# Configuration for use with kernel/kexts. -Configs += cc_kext -UniversalArchs.cc_kext := $(call CheckArches,i386 x86_64 x86_64h,cc_kext,$(OSX_SDK)) - -# Configuration for use with iOS kernel/kexts -Configs += cc_kext_ios -UniversalArchs.cc_kext_ios += $(call CheckArches,armv7,cc_kext_ios,$(IOS_SDK)) - -# Darwin 10.6 has a bug in cctools that makes it unable to use ranlib on our ARM -# object files. If we are on that platform, strip out all ARM archs. We still -# build the libraries themselves so that Clang can find them where it expects -# them, even though they might not have an expected slice. -ifneq ($(shell test -x /usr/bin/sw_vers && sw_vers -productVersion | grep 10.6),) -UniversalArchs.ios := $(filter-out armv7, $(UniversalArchs.ios)) -UniversalArchs.cc_kext_ios := $(filter-out armv7, $(UniversalArchs.cc_kext_ios)) -endif - -# If RC_SUPPORTED_ARCHS is defined, treat it as a list of the architectures we -# are intended to support and limit what we try to build to that. -ifneq ($(RC_SUPPORTED_ARCHS),) -$(foreach config,$(Configs),\ - $(call Set,UniversalArchs.$(config),\ - $(filter $(RC_SUPPORTED_ARCHS),$(UniversalArchs.$(config))))) -endif - -# Remove empty configs if we end up dropping all the requested -# archs for a particular config. -$(foreach config,$(Configs),\ - $(if $(strip $(UniversalArchs.$(config))),,\ - $(call Set,Configs,$(filter-out $(config),$(Configs))))) - -### - -# Forcibly strip off any -arch, as that totally breaks our universal support. -override CC := $(subst -arch ,-arch_,$(CC)) -override CC := $(patsubst -arch_%,,$(CC)) - -CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer - -# Always set deployment target arguments for every build, these libraries should -# never depend on the environmental overrides. We simply set them to minimum -# supported deployment target -- nothing in the compiler-rt libraries should -# actually depend on the deployment target. -OSX_DEPLOYMENT_ARGS := -mmacosx-version-min=10.4 -IOS_DEPLOYMENT_ARGS := -mios-version-min=1.0 -IOS6_DEPLOYMENT_ARGS := -mios-version-min=6.0 -IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=1.0 - -OSX_DEPLOYMENT_ARGS += -isysroot $(OSX_SDK) -IOS_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK) -IOS6_DEPLOYMENT_ARGS += -isysroot $(IOS_SDK) -IOSSIM_DEPLOYMENT_ARGS += -isysroot $(IOSSIM_SDK) - -CFLAGS.eprintf := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) -CFLAGS.10.4 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) - -SANITIZER_MACOSX_DEPLOYMENT_ARGS := -mmacosx-version-min=10.7 -SANITIZER_IOSSIM_DEPLOYMENT_ARGS := -mios-simulator-version-min=7.0 \ - -isysroot $(IOSSIM_SDK) -SANITIZER_CFLAGS := -fno-builtin -gline-tables-only -stdlib=libc++ - - -CFLAGS.ios.i386 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) -CFLAGS.ios.x86_64 := $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS) -CFLAGS.ios.armv7 := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) -CFLAGS.ios.armv7k := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) -CFLAGS.ios.armv7s := $(CFLAGS) $(IOS_DEPLOYMENT_ARGS) -CFLAGS.ios.arm64 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS) -CFLAGS.osx.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) -CFLAGS.osx.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) -CFLAGS.osx.x86_64h := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) -CFLAGS.cc_kext.i386 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) -CFLAGS.cc_kext.x86_64 := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) -CFLAGS.cc_kext.x86_64h := $(CFLAGS) $(OSX_DEPLOYMENT_ARGS) -CFLAGS.cc_kext_ios.armv7 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS) -CFLAGS.cc_kext_ios.armv7k := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS) -CFLAGS.cc_kext_ios.armv7s := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS) -CFLAGS.cc_kext_ios.arm64 := $(CFLAGS) $(IOS6_DEPLOYMENT_ARGS) - -SANITIZER_LDFLAGS := -stdlib=libc++ -lc++ -lc++abi - -ATOMIC_FUNCTIONS := \ - atomic_flag_clear \ - atomic_flag_clear_explicit \ - atomic_flag_test_and_set \ - atomic_flag_test_and_set_explicit \ - atomic_signal_fence \ - atomic_thread_fence - -FP16_FUNCTIONS := \ - extendhfsf2 \ - truncdfhf2 \ - truncsfhf2 - -FUNCTIONS.eprintf := eprintf -FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf - -FUNCTIONS.ios := divmodsi4 udivmodsi4 mulosi4 mulodi4 muloti4 \ - $(ATOMIC_FUNCTIONS) $(FP16_FUNCTIONS) -# On x86, the divmod functions reference divsi. -FUNCTIONS.ios.i386 := $(FUNCTIONS.ios) \ - divsi3 udivsi3 -FUNCTIONS.ios.x86_64 := $(FUNCTIONS.ios.i386) -FUNCTIONS.ios.arm64 := mulsc3 muldc3 divsc3 divdc3 udivti3 umodti3 \ - $(ATOMIC_FUNCTIONS) - -FUNCTIONS.osx := mulosi4 mulodi4 muloti4 $(ATOMIC_FUNCTIONS) $(FP16_FUNCTIONS) - -CCKEXT_PROFILE_FUNCTIONS := \ - InstrProfiling \ - InstrProfilingBuffer \ - InstrProfilingPlatformDarwin - -CCKEXT_COMMON_FUNCTIONS := \ - $(CCKEXT_PROFILE_FUNCTIONS) \ - absvdi2 \ - absvsi2 \ - addvdi3 \ - addvsi3 \ - ashldi3 \ - ashrdi3 \ - bswapdi2 \ - bswapsi2 \ - clzdi2 \ - clzsi2 \ - cmpdi2 \ - ctzdi2 \ - ctzsi2 \ - divdc3 \ - divdi3 \ - divsc3 \ - divmodsi4 \ - udivmodsi4 \ - do_global_dtors \ - eprintf \ - extendhfsf2 \ - ffsdi2 \ - fixdfdi \ - fixsfdi \ - fixunsdfdi \ - fixunsdfsi \ - fixunssfdi \ - fixunssfsi \ - floatdidf \ - floatdisf \ - floatundidf \ - floatundisf \ - gcc_bcmp \ - lshrdi3 \ - moddi3 \ - muldc3 \ - muldi3 \ - mulsc3 \ - mulvdi3 \ - mulvsi3 \ - negdi2 \ - negvdi2 \ - negvsi2 \ - paritydi2 \ - paritysi2 \ - popcountdi2 \ - popcountsi2 \ - powidf2 \ - powisf2 \ - subvdi3 \ - subvsi3 \ - truncdfhf2 \ - truncsfhf2 \ - ucmpdi2 \ - udiv_w_sdiv \ - udivdi3 \ - udivmoddi4 \ - umoddi3 - -CCKEXT_ARM_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ - adddf3 \ - addsf3 \ - aeabi_cdcmpeq \ - aeabi_cdrcmple \ - aeabi_cfcmpeq \ - aeabi_cfrcmple \ - aeabi_dcmpeq \ - aeabi_dcmpge \ - aeabi_dcmpgt \ - aeabi_dcmple \ - aeabi_dcmplt \ - aeabi_drsub \ - aeabi_fcmpeq \ - aeabi_fcmpge \ - aeabi_fcmpgt \ - aeabi_fcmple \ - aeabi_fcmplt \ - aeabi_frsub \ - aeabi_idivmod \ - aeabi_uidivmod \ - cmpdf2 \ - cmpsf2 \ - div0 \ - divdf3 \ - divsf3 \ - divsi3 \ - extendsfdf2 \ - ffssi2 \ - fixdfsi \ - fixsfsi \ - floatsidf \ - floatsisf \ - floatunsidf \ - floatunsisf \ - comparedf2 \ - comparesf2 \ - modsi3 \ - muldf3 \ - mulsf3 \ - mulodi4 \ - negdf2 \ - negsf2 \ - subdf3 \ - subsf3 \ - switch16 \ - switch32 \ - switch8 \ - switchu8 \ - truncdfsf2 \ - udivsi3 \ - umodsi3 \ - unorddf2 \ - unordsf2 - -CCKEXT_ARMVFP_FUNCTIONS := $(CCKEXT_ARM_FUNCTIONS) \ - adddf3vfp \ - addsf3vfp \ - divdf3vfp \ - divsf3vfp \ - eqdf2vfp \ - eqsf2vfp \ - extendsfdf2vfp \ - fixdfsivfp \ - fixsfsivfp \ - fixunsdfsivfp \ - fixunssfsivfp \ - floatsidfvfp \ - floatsisfvfp \ - floatunssidfvfp \ - floatunssisfvfp \ - gedf2vfp \ - gesf2vfp \ - gtdf2vfp \ - gtsf2vfp \ - ledf2vfp \ - lesf2vfp \ - ltdf2vfp \ - ltsf2vfp \ - muldf3vfp \ - mulsf3vfp \ - nedf2vfp \ - nesf2vfp \ - subdf3vfp \ - subsf3vfp \ - truncdfsf2vfp \ - unorddf2vfp \ - unordsf2vfp - -CCKEXT_ARM64_FUNCTIONS := \ - $(CCKEXT_PROFILE_FUNCTIONS) \ - divdc3 \ - divsc3 \ - muldc3 \ - mulsc3 \ - udivti3 \ - umodti3 - -FUNCTIONS.cc_kext_ios.armv7 := $(CCKEXT_ARMVFP_FUNCTIONS) -FUNCTIONS.cc_kext_ios.armv7k := $(CCKEXT_ARMVFP_FUNCTIONS) -FUNCTIONS.cc_kext_ios.armv7s := $(CCKEXT_ARMVFP_FUNCTIONS) -FUNCTIONS.cc_kext_ios.arm64 := $(CCKEXT_ARM64_FUNCTIONS) - -CCKEXT_X86_FUNCTIONS := $(CCKEXT_COMMON_FUNCTIONS) \ - divxc3 \ - fixunsxfdi \ - fixunsxfsi \ - fixxfdi \ - floatdixf \ - floatundixf \ - mulxc3 \ - powixf2 - -FUNCTIONS.cc_kext.i386 := $(CCKEXT_X86_FUNCTIONS) \ - ffssi2 \ - i686.get_pc_thunk.eax \ - i686.get_pc_thunk.ebp \ - i686.get_pc_thunk.ebx \ - i686.get_pc_thunk.ecx \ - i686.get_pc_thunk.edi \ - i686.get_pc_thunk.edx \ - i686.get_pc_thunk.esi - -FUNCTIONS.cc_kext.x86_64 := $(CCKEXT_X86_FUNCTIONS) \ - absvti2 \ - addvti3 \ - ashlti3 \ - ashrti3 \ - clzti2 \ - cmpti2 \ - ctzti2 \ - divti3 \ - ffsti2 \ - fixdfti \ - fixsfti \ - fixunsdfti \ - fixunssfti \ - fixunsxfti \ - fixxfti \ - floattidf \ - floattisf \ - floattixf \ - floatuntidf \ - floatuntisf \ - floatuntixf \ - lshrti3 \ - modti3 \ - multi3 \ - mulvti3 \ - negti2 \ - negvti2 \ - parityti2 \ - popcountti2 \ - subvti3 \ - ucmpti2 \ - udivmodti4 \ - udivti3 \ - umodti3 - -FUNCTIONS.cc_kext.x86_64h := $(FUNCTIONS.cc_kext.x86_64) - -# FIXME: Currently, compiler-rt is missing implementations for a number of the -# functions that need to go into libcc_kext.a. Filter them out for now. -CCKEXT_MISSING_FUNCTIONS := \ - cmpdf2 cmpsf2 div0 \ - ffssi2 \ - udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \ - bswapsi2 \ - gcc_bcmp \ - do_global_dtors \ - i686.get_pc_thunk.eax i686.get_pc_thunk.ebp i686.get_pc_thunk.ebx \ - i686.get_pc_thunk.ecx i686.get_pc_thunk.edi i686.get_pc_thunk.edx \ - i686.get_pc_thunk.esi \ - aeabi_cdcmpeq aeabi_cdrcmple aeabi_cfcmpeq aeabi_cfrcmple aeabi_dcmpeq \ - aeabi_dcmpge aeabi_dcmpgt aeabi_dcmple aeabi_dcmplt aeabi_drsub aeabi_fcmpeq \ - aeabi_fcmpge aeabi_fcmpgt aeabi_fcmple aeabi_fcmplt aeabi_frsub aeabi_idivmod \ - aeabi_uidivmod - -FUNCTIONS.cc_kext_ios.armv7 := \ - $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.armv7)) -FUNCTIONS.cc_kext_ios.armv7k := \ - $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.armv7k)) -FUNCTIONS.cc_kext_ios.armv7s := \ - $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.armv7s)) -FUNCTIONS.cc_kext_ios.arm64 := \ - $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext_ios.arm64)) -FUNCTIONS.cc_kext.i386 := \ - $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.i386)) -FUNCTIONS.cc_kext.x86_64 := \ - $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.x86_64)) -FUNCTIONS.cc_kext.x86_64h := \ - $(filter-out $(CCKEXT_MISSING_FUNCTIONS),$(FUNCTIONS.cc_kext.x86_64h)) - -KERNEL_USE.cc_kext := 1 -KERNEL_USE.cc_kext_ios := 1 - -VISIBILITY_HIDDEN := 1 - -SHARED_LIBRARY_SUFFIX := dylib Index: compiler-rt/trunk/make/platform/clang_darwin_test_input.c =================================================================== --- compiler-rt/trunk/make/platform/clang_darwin_test_input.c +++ compiler-rt/trunk/make/platform/clang_darwin_test_input.c @@ -1,15 +0,0 @@ -/* Include the headers we use in int_lib.h, to verify that they work. */ - -#include -#include -#include -#include -#include - -// Force us to link at least one symbol in a system library -// to detect systems where we don't have those for a given -// architecture. -int main(int argc, const char **argv) { - int x; - memcpy(&x,&argc,sizeof(int)); -} Index: compiler-rt/trunk/make/platform/clang_linux.mk =================================================================== --- compiler-rt/trunk/make/platform/clang_linux.mk +++ compiler-rt/trunk/make/platform/clang_linux.mk @@ -1,92 +0,0 @@ -Description := Static runtime libraries for clang/Linux. - -### - -CC := clang -Arch := unknown -Configs := - -# We don't currently have any general purpose way to target architectures other -# than the compiler defaults (because there is no generalized way to invoke -# cross compilers). For now, we just find the target architecture of the -# compiler and only define configurations we know that compiler can generate. -CompilerTargetTriple := $(shell \ - LANG=C $(CC) -v 2>&1 | grep 'Target:' | cut -d' ' -f2) -ifeq ($(CompilerTargetTriple),) -$(error "unable to infer compiler target triple for $(CC)") -endif - -# Only define configs if we detected a linux target. -ifneq ($(findstring -linux-,$(CompilerTargetTriple)),) - -# Define configs only if arch in triple is i386 or x86_64 -CompilerTargetArch := $(firstword $(subst -, ,$(CompilerTargetTriple))) -ifeq ($(call contains,i386 x86_64,$(CompilerTargetArch)),true) - -# TryCompile compiler source flags -# Returns exit code of running a compiler invocation. -TryCompile = \ - $(shell \ - cflags=""; \ - for flag in $(3); do \ - cflags="$$cflags $$flag"; \ - done; \ - $(1) $$cflags $(2) -o /dev/null > /dev/null 2> /dev/null ; \ - echo $$?) - -test_source = $(ProjSrcRoot)/make/platform/clang_linux_test_input.c -ifeq ($(CompilerTargetArch),i386) - SupportedArches := i386 - ifeq ($(call TryCompile,$(CC),$(test_source),-m64),0) - SupportedArches += x86_64 - endif -else - SupportedArches := x86_64 - ifeq ($(call TryCompile,$(CC),$(test_source),-m32),0) - SupportedArches += i386 - endif -endif - -# Build runtime libraries for i386. -ifeq ($(call contains,$(SupportedArches),i386),true) -Configs += builtins-i386 profile-i386 -Arch.builtins-i386 := i386 -Arch.profile-i386 := i386 -endif - -# Build runtime libraries for x86_64. -ifeq ($(call contains,$(SupportedArches),x86_64),true) -Configs += builtins-x86_64 profile-x86_64 -Arch.builtins-x86_64 := x86_64 -Arch.profile-x86_64 := x86_64 -endif - -endif - -endif - -### - -CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer - -CFLAGS.builtins-i386 := $(CFLAGS) -m32 -CFLAGS.builtins-x86_64 := $(CFLAGS) -m64 -CFLAGS.profile-i386 := $(CFLAGS) -m32 -CFLAGS.profile-x86_64 := $(CFLAGS) -m64 - -FUNCTIONS.builtins-i386 := $(CommonFunctions) $(ArchFunctions.i386) -FUNCTIONS.builtins-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) -FUNCTIONS.profile-i386 := GCDAProfiling InstrProfiling InstrProfilingBuffer \ - InstrProfilingFile InstrProfilingPlatformOther \ - InstrProfilingRuntime InstrProfilingUtil \ - InstrProfilingWriter InstrProfilingValue \ - InstrProfilingMerge InstrProfilingMergeFile -FUNCTIONS.profile-x86_64 := $(FUNCTIONS.profile-i386) - -# Always use optimized variants. -OPTIMIZED := 1 - -# We don't need to use visibility hidden on Linux. -VISIBILITY_HIDDEN := 0 - -SHARED_LIBRARY_SUFFIX := so Index: compiler-rt/trunk/make/platform/clang_linux_test_input.c =================================================================== --- compiler-rt/trunk/make/platform/clang_linux_test_input.c +++ compiler-rt/trunk/make/platform/clang_linux_test_input.c @@ -1,4 +0,0 @@ -// This file is used to check if we can produce working executables -// for i386 and x86_64 archs on Linux. -#include -int main(){} Index: compiler-rt/trunk/make/platform/clang_macho_embedded.mk =================================================================== --- compiler-rt/trunk/make/platform/clang_macho_embedded.mk +++ compiler-rt/trunk/make/platform/clang_macho_embedded.mk @@ -1,297 +0,0 @@ -# These are the functions which clang needs when it is targeting a previous -# version of the OS. The issue is that the backend may use functions which were -# not present in the libgcc that shipped on the platform. In such cases, we link -# with a version of the library which contains private_extern definitions of all -# the extra functions which might be referenced. - -Description := Static runtime libraries for embedded clang/Darwin - -# A function that ensures we don't try to build for architectures that we -# don't have working toolchains for. -CheckArches = \ - $(shell \ - result=""; \ - for arch in $(1); do \ - if $(CC) -arch $$arch -c \ - -integrated-as \ - $(ProjSrcRoot)/make/platform/clang_macho_embedded_test_input.c \ - -o /dev/null > /dev/null 2> /dev/null; then \ - result="$$result$$arch "; \ - else \ - printf 1>&2 \ - "warning: clang_macho_embedded.mk: dropping arch '$$arch' from lib '$(2)'\n"; \ - fi; \ - done; \ - echo $$result) - -XCRun = \ - $(shell \ - result=`xcrun -find $(1) 2> /dev/null`; \ - if [ "$$?" != "0" ]; then result=$(1); fi; \ - echo $$result) - -### - -CC := $(call XCRun,clang) -AR := $(call XCRun,ar) -RANLIB := $(call XCRun,ranlib) -STRIP := $(call XCRun,strip) -LIPO := $(call XCRun,lipo) -DSYMUTIL := $(call XCRun,dsymutil) - -Configs := -UniversalArchs := - -# Soft-float version of the runtime. No floating-point instructions will be used -# and the ABI (out of necessity) passes floating values in normal registers: -# non-VFP variant of the AAPCS. -UniversalArchs.soft_static := $(call CheckArches,armv6m armv7m armv7em armv7,soft_static) -Configs += $(if $(UniversalArchs.soft_static),soft_static) - -# Hard-float version of the runtime. On ARM VFP instructions and registers are -# allowed, and floating point values get passed in them. VFP variant of the -# AAPCS. -UniversalArchs.hard_static := $(call CheckArches,armv7em armv7 i386 x86_64,hard_static) -Configs += $(if $(UniversalArchs.hard_static),hard_static) - -UniversalArchs.soft_pic := $(call CheckArches,armv6m armv7m armv7em armv7,soft_pic) -Configs += $(if $(UniversalArchs.soft_pic),soft_pic) - -UniversalArchs.hard_pic := $(call CheckArches,armv7em armv7 i386 x86_64,hard_pic) -Configs += $(if $(UniversalArchs.hard_pic),hard_pic) - -CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding - -PIC_CFLAGS := -fPIC -STATIC_CFLAGS := -static - -CFLAGS_SOFT := -mfloat-abi=soft -CFLAGS_HARD := -mfloat-abi=hard - -CFLAGS_ARMV7 := -target thumbv7-apple-darwin-eabi -CFLAGS_I386 := -march=pentium - -CFLAGS.soft_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_SOFT) -CFLAGS.hard_static := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_HARD) -CFLAGS.soft_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_SOFT) -CFLAGS.hard_pic := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_HARD) - -CFLAGS.soft_static.armv7 := $(CFLAGS.soft_static) $(CFLAGS_ARMV7) -CFLAGS.hard_static.armv7 := $(CFLAGS.hard_static) $(CFLAGS_ARMV7) -CFLAGS.soft_pic.armv7 := $(CFLAGS.soft_pic) $(CFLAGS_ARMV7) -CFLAGS.hard_pic.armv7 := $(CFLAGS.hard_pic) $(CFLAGS_ARMV7) - -# x86 platforms ignore -mfloat-abi options and complain about doing so. Despite -# this they're hard-float. -CFLAGS.hard_static.i386 := $(CFLAGS) $(STATIC_CFLAGS) $(CFLAGS_I386) -CFLAGS.hard_pic.i386 := $(CFLAGS) $(PIC_CFLAGS) $(CFLAGS_I386) -CFLAGS.hard_static.x86_64 := $(CFLAGS) $(STATIC_CFLAGS) -CFLAGS.hard_pic.x86_64 := $(CFLAGS) $(PIC_CFLAGS) - -# Functions not wanted: -# + eprintf is obsolete anyway -# + *vfp: designed for Thumb1 CPUs with VFPv2 - -COMMON_FUNCTIONS := \ - absvdi2 \ - absvsi2 \ - addvdi3 \ - addvsi3 \ - ashldi3 \ - ashrdi3 \ - bswapdi2 \ - bswapsi2 \ - clzdi2 \ - clzsi2 \ - cmpdi2 \ - ctzdi2 \ - ctzsi2 \ - divdc3 \ - divdi3 \ - divsc3 \ - divmodsi4 \ - udivmodsi4 \ - do_global_dtors \ - ffsdi2 \ - fixdfdi \ - fixsfdi \ - fixunsdfdi \ - fixunsdfsi \ - fixunssfdi \ - fixunssfsi \ - floatdidf \ - floatdisf \ - floatundidf \ - floatundisf \ - gcc_bcmp \ - lshrdi3 \ - moddi3 \ - muldc3 \ - muldi3 \ - mulsc3 \ - mulvdi3 \ - mulvsi3 \ - negdi2 \ - negvdi2 \ - negvsi2 \ - paritydi2 \ - paritysi2 \ - popcountdi2 \ - popcountsi2 \ - powidf2 \ - powisf2 \ - subvdi3 \ - subvsi3 \ - ucmpdi2 \ - udiv_w_sdiv \ - udivdi3 \ - udivmoddi4 \ - umoddi3 \ - adddf3 \ - addsf3 \ - cmpdf2 \ - cmpsf2 \ - div0 \ - divdf3 \ - divsf3 \ - divsi3 \ - extendsfdf2 \ - extendhfsf2 \ - ffssi2 \ - fixdfsi \ - fixsfsi \ - floatsidf \ - floatsisf \ - floatunsidf \ - floatunsisf \ - comparedf2 \ - comparesf2 \ - modsi3 \ - muldf3 \ - mulsf3 \ - negdf2 \ - negsf2 \ - subdf3 \ - subsf3 \ - truncdfhf2 \ - truncdfsf2 \ - truncsfhf2 \ - udivsi3 \ - umodsi3 \ - unorddf2 \ - unordsf2 \ - atomic_flag_clear \ - atomic_flag_clear_explicit \ - atomic_flag_test_and_set \ - atomic_flag_test_and_set_explicit \ - atomic_signal_fence \ - atomic_thread_fence - -ARM_FUNCTIONS := \ - aeabi_cdcmpeq \ - aeabi_cdrcmple \ - aeabi_cfcmpeq \ - aeabi_cfrcmple \ - aeabi_dcmpeq \ - aeabi_dcmpge \ - aeabi_dcmpgt \ - aeabi_dcmple \ - aeabi_dcmplt \ - aeabi_drsub \ - aeabi_fcmpeq \ - aeabi_fcmpge \ - aeabi_fcmpgt \ - aeabi_fcmple \ - aeabi_fcmplt \ - aeabi_frsub \ - aeabi_idivmod \ - aeabi_uidivmod \ - -# ARM Assembly implementation which requires Thumb2 (i.e. won't work on v6M). -THUMB2_FUNCTIONS := \ - switch16 \ - switch32 \ - switch8 \ - switchu8 \ - sync_fetch_and_add_4 \ - sync_fetch_and_sub_4 \ - sync_fetch_and_and_4 \ - sync_fetch_and_or_4 \ - sync_fetch_and_xor_4 \ - sync_fetch_and_nand_4 \ - sync_fetch_and_max_4 \ - sync_fetch_and_umax_4 \ - sync_fetch_and_min_4 \ - sync_fetch_and_umin_4 \ - sync_fetch_and_add_8 \ - sync_fetch_and_sub_8 \ - sync_fetch_and_and_8 \ - sync_fetch_and_or_8 \ - sync_fetch_and_xor_8 \ - sync_fetch_and_nand_8 \ - sync_fetch_and_max_8 \ - sync_fetch_and_umax_8 \ - sync_fetch_and_min_8 \ - sync_fetch_and_umin_8 - -I386_FUNCTIONS := \ - i686.get_pc_thunk.eax \ - i686.get_pc_thunk.ebp \ - i686.get_pc_thunk.ebx \ - i686.get_pc_thunk.ecx \ - i686.get_pc_thunk.edi \ - i686.get_pc_thunk.edx \ - i686.get_pc_thunk.esi - -# FIXME: Currently, compiler-rt is missing implementations for a number of the -# functions. Filter them out for now. -MISSING_FUNCTIONS := \ - cmpdf2 cmpsf2 div0 \ - ffssi2 \ - udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \ - bswapsi2 \ - gcc_bcmp \ - do_global_dtors \ - i686.get_pc_thunk.eax i686.get_pc_thunk.ebp i686.get_pc_thunk.ebx \ - i686.get_pc_thunk.ecx i686.get_pc_thunk.edi i686.get_pc_thunk.edx \ - i686.get_pc_thunk.esi \ - aeabi_cdcmpeq aeabi_cdrcmple aeabi_cfcmpeq aeabi_cfrcmple aeabi_dcmpeq \ - aeabi_dcmpge aeabi_dcmpgt aeabi_dcmple aeabi_dcmplt aeabi_drsub \ - aeabi_fcmpeq \ aeabi_fcmpge aeabi_fcmpgt aeabi_fcmple aeabi_fcmplt \ - aeabi_frsub aeabi_idivmod aeabi_uidivmod - -FUNCTIONS_ARMV6M := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS) -FUNCTIONS_ARM_ALL := $(COMMON_FUNCTIONS) $(ARM_FUNCTIONS) $(THUMB2_FUNCTIONS) -FUNCTIONS_I386 := $(COMMON_FUNCTIONS) $(I386_FUNCTIONS) -FUNCTIONS_X86_64 := $(COMMON_FUNCTIONS) - -FUNCTIONS_ARMV6M := \ - $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARMV6M)) -FUNCTIONS_ARM_ALL := \ - $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_ARM_ALL)) -FUNCTIONS_I386 := \ - $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_I386)) -FUNCTIONS_X86_64 := \ - $(filter-out $(MISSING_FUNCTIONS),$(FUNCTIONS_X86_64)) - -FUNCTIONS.soft_static.armv6m := $(FUNCTIONS_ARMV6M) -FUNCTIONS.soft_pic.armv6m := $(FUNCTIONS_ARMV6M) - -FUNCTIONS.soft_static.armv7m := $(FUNCTIONS_ARM_ALL) -FUNCTIONS.soft_pic.armv7m := $(FUNCTIONS_ARM_ALL) - -FUNCTIONS.soft_static.armv7em := $(FUNCTIONS_ARM_ALL) -FUNCTIONS.hard_static.armv7em := $(FUNCTIONS_ARM_ALL) -FUNCTIONS.soft_pic.armv7em := $(FUNCTIONS_ARM_ALL) -FUNCTIONS.hard_pic.armv7em := $(FUNCTIONS_ARM_ALL) - -FUNCTIONS.soft_static.armv7 := $(FUNCTIONS_ARM_ALL) -FUNCTIONS.hard_static.armv7 := $(FUNCTIONS_ARM_ALL) -FUNCTIONS.soft_pic.armv7 := $(FUNCTIONS_ARM_ALL) -FUNCTIONS.hard_pic.armv7 := $(FUNCTIONS_ARM_ALL) - -FUNCTIONS.hard_static.i386 := $(FUNCTIONS_I386) -FUNCTIONS.hard_pic.i386 := $(FUNCTIONS_I386) - -FUNCTIONS.hard_static.x86_64 := $(FUNCTIONS_X86_64) -FUNCTIONS.hard_pic.x86_64 := $(FUNCTIONS_X86_64) Index: compiler-rt/trunk/make/platform/clang_mingw.mk =================================================================== --- compiler-rt/trunk/make/platform/clang_mingw.mk +++ compiler-rt/trunk/make/platform/clang_mingw.mk @@ -1,30 +0,0 @@ -Description := Static runtime libraries for mingw-w64 - -### - -CC ?= cc -AR ?= ar - -Arch := unknown -Configs := - -SupportedArches := x86_64 i386 arm - -Configs += builtins-x86_64 builtins-i386 builtins-arm -Arch.builtins-x86_64 := x86_64 -Arch.builtins-i386 := i386 -Arch.builtins-arm := arm - -### - -CFLAGS := -Wall -O3 -fomit-frame-pointer -CFLAGS.builtins-x86_64 := -target x86_64-windows-gnu $(CFLAGS) -CFLAGS.builtins-i386 := -target i686-windows-gnu $(CFLAGS) -CFLAGS.builtins-arm := -target armv7-windows-gnu $(CFLAGS) - -FUNCTIONS.builtins-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64) -FUNCTIONS.builtins-i386 := $(CommonFunctions) $(ArchFunctions.i386) -FUNCTIONS.builtins-arm := $(CommonFunctions) $(ArchFunctions.arm) - -# Always use optimized variants. -OPTIMIZED := 1 Index: compiler-rt/trunk/make/platform/darwin_bni.mk =================================================================== --- compiler-rt/trunk/make/platform/darwin_bni.mk +++ compiler-rt/trunk/make/platform/darwin_bni.mk @@ -1,135 +0,0 @@ - -Description := Target for Darwin using an Apple-style build. - -Configs := Debug Release Profile Static - -# We override this with RC_ARCHS because B&I may want to build on an ARCH we -# haven't explicitly defined support for. If all goes well, this will just work -# and the resulting lib will just have generic versions for anything unknown. -UniversalArchs := $(RC_ARCHS) - -ifneq (,$(SDKROOT)) - override CC := $(shell xcrun -sdk $(SDKROOT) -find clang || echo "false") - AR := $(shell xcrun -sdk $(SDKROOT) -find ar || echo "false") - RANLIB := $(shell xcrun -sdk $(SDKROOT) -find ranlib || echo "false") - STRIP := $(shell xcrun -sdk $(SDKROOT) -find strip || echo "false") - LIPO := $(shell xcrun -sdk $(SDKROOT) -find lipo || echo "false") - DSYMUTIL := $(shell xcrun -sdk $(SDKROOT) -find dsymutil || echo "false") -endif - -ifneq ($(IPHONEOS_DEPLOYMENT_TARGET),) - DEPLOYMENT_FLAGS := -miphoneos-version-min=$(IPHONEOS_DEPLOYMENT_TARGET) -else - ifneq ($(MACOSX_DEPLOYMENT_TARGET),) - DEPLOYMENT_FLAGS := -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) - endif -endif - -ifneq (,$(SDKROOT)) - DEPLOYMENT_FLAGS += -isysroot $(SDKROOT) -endif - -CFLAGS := -Wall -Os -fomit-frame-pointer -g $(DEPLOYMENT_FLAGS) -CFLAGS.Static := $(CFLAGS) -static -DYLIB_FLAGS := $(DEPLOYMENT_FLAGS) \ - -Xarch_arm -Wl,-alias_list,$(SRCROOT)/lib/builtins/arm/softfloat-alias.list - -VISIBILITY_HIDDEN := 0 -VISIBILITY_HIDDEN.Static := 1 - - -FUNCTIONS := absvdi2 absvsi2 addvdi3 addvsi3 ashldi3 ashrdi3 \ - clzdi2 clzsi2 cmpdi2 ctzdi2 ctzsi2 \ - divdc3 divdi3 divsc3 ffsdi2 \ - fixdfdi fixsfdi fixunsdfdi fixunsdfsi fixunssfdi \ - fixunssfsi floatdidf floatdisf floatundidf floatundisf \ - gcc_personality_v0 lshrdi3 moddi3 muldc3 muldi3 mulosi4 \ - mulodi4 muloti4 mulsc3 mulvdi3 mulvsi3 negdi2 negvdi2 negvsi2 \ - paritydi2 paritysi2 popcountdi2 popcountsi2 powidf2 \ - powisf2 subvdi3 subvsi3 ucmpdi2 udivdi3 \ - udivmoddi4 umoddi3 apple_versioning eprintf atomic \ - atomic_flag_clear atomic_flag_clear_explicit \ - atomic_flag_test_and_set atomic_flag_test_and_set_explicit \ - atomic_signal_fence atomic_thread_fence \ - extendhfsf2 truncdfhf2 truncsfhf2 - -FUNCTIONS.i386 := $(FUNCTIONS) \ - divxc3 fixunsxfdi fixunsxfsi fixxfdi floatdixf \ - floatundixf mulxc3 powixf2 clear_cache \ - enable_execute_stack -FUNCTIONS.ppc := $(FUNCTIONS) \ - divtc3 fixtfdi fixunstfdi floatditf floatunditf \ - gcc_qadd gcc_qdiv gcc_qmul gcc_qsub multc3 \ - powitf2 restFP saveFP trampoline_setup \ - clear_cache enable_execute_stack -FUNCTIONS.x86_64 := $(FUNCTIONS) \ - absvti2 addvti3 ashlti3 ashrti3 clzti2 cmpti2 \ - ctzti2 divti3 divxc3 ffsti2 fixdfti fixsfti \ - fixunsdfti fixunssfti fixunsxfdi fixunsxfsi \ - fixunsxfti fixxfdi fixxfti floatdixf floattidf \ - floattisf floattixf floatundixf floatuntidf \ - floatuntisf floatuntixf lshrti3 modti3 multi3 \ - muloti4 mulvti3 mulxc3 negti2 negvti2 parityti2 \ - popcountti2 powixf2 subvti3 ucmpti2 udivmodti4 \ - udivti3 umodti3 clear_cache enable_execute_stack - -FUNCTIONS.armv4t := $(FUNCTIONS) - -FUNCTIONS.armv5 := $(FUNCTIONS) \ - adddf3 addsf3 bswapdi2 bswapsi2 \ - comparedf2 comparesf2 extendsfdf2 \ - divdf3 divsf3 \ - fixdfsi fixsfsi fixunsdfsi fixunssfsi \ - floatsidf floatsisf floatunsidf floatunsisf \ - muldf3 mulsf3 \ - negdf2 negsf2 \ - truncdfsf2 \ - modsi3 umodsi3 udivsi3 divsi3 udivmodsi4 divmodsi4 \ - switch8 switchu8 switch16 switch32 \ - sync_synchronize - -FUNCTIONS.armv6 := $(FUNCTIONS) \ - comparedf2 comparesf2 \ - adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ - divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ - fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ - floatsidfvfp floatsisfvfp floatunssidfvfp floatunssisfvfp \ - gedf2vfp gesf2vfp gtdf2vfp gtsf2vfp \ - ledf2vfp lesf2vfp ltdf2vfp ltsf2vfp \ - muldf3vfp mulsf3vfp \ - nedf2vfp nesf2vfp \ - subdf3vfp subsf3vfp truncdfsf2vfp unorddf2vfp unordsf2vfp \ - modsi3 umodsi3 udivsi3 divsi3 udivmodsi4 divmodsi4 \ - switch8 switchu8 switch16 switch32 \ - restore_vfp_d8_d15_regs save_vfp_d8_d15_regs \ - sync_synchronize - -FUNCTIONS.armv7 := $(FUNCTIONS) \ - comparedf2 comparesf2 \ - adddf3vfp addsf3vfp bswapdi2 bswapsi2 divdf3vfp \ - divsf3vfp eqdf2vfp eqsf2vfp extendsfdf2vfp \ - fixdfsivfp fixsfsivfp fixunsdfsivfp fixunssfsivfp \ - floatsidfvfp floatsisfvfp floatunssidfvfp floatunssisfvfp \ - gedf2vfp gesf2vfp gtdf2vfp gtsf2vfp \ - ledf2vfp lesf2vfp ltdf2vfp ltsf2vfp \ - muldf3vfp mulsf3vfp \ - nedf2vfp nesf2vfp \ - subdf3vfp subsf3vfp truncdfsf2vfp unorddf2vfp unordsf2vfp \ - modsi3 umodsi3 udivsi3 divsi3 udivmodsi4 divmodsi4 - -FUNCTIONS.armv7s := $(FUNCTIONS.armv7) - -FUNCTIONS.arm64 := divti3 modti3 \ - udivmodti4 \ - udivti3 umodti3 \ - mulsc3 muldc3 \ - powisf2 powidf2 \ - clzti2 \ - fixdfti fixsfti \ - fixunsdfti fixunssfti fixunssfti \ - floattidf floattisf floatuntidf floatuntisf \ - gcc_personality_v0 atomic \ - atomic_flag_clear atomic_flag_clear_explicit \ - atomic_flag_test_and_set \ - atomic_flag_test_and_set_explicit \ - atomic_signal_fence atomic_thread_fence Index: compiler-rt/trunk/make/platform/multi_arch.mk =================================================================== --- compiler-rt/trunk/make/platform/multi_arch.mk +++ compiler-rt/trunk/make/platform/multi_arch.mk @@ -1,15 +0,0 @@ -Description := Example configuration for build two libraries for separate \ -architectures. - -Configs := m32 m64 -Arch := i386 -Arch.m64 := x86_64 - -CC := clang - -CFLAGS := -Wall -Werror -CFLAGS.m32 := $(CFLAGS) -m32 -O3 -CFLAGS.m64 := $(CFLAGS) -m64 -O3 - -FUNCTIONS := moddi3 floatundixf udivdi3 -FUNCTIONS.m64 := $(FUNCTIONS) lshrdi3 Index: compiler-rt/trunk/make/subdir.mk =================================================================== --- compiler-rt/trunk/make/subdir.mk +++ compiler-rt/trunk/make/subdir.mk @@ -1,92 +0,0 @@ -# This file is intended to be included from each subdirectory makefile. -# -# Subdirectory makefiles must define: -# SubDirs - The subdirectories to traverse. -# -# Subdirectory makefiles may define: -# ModuleName - The library name for objects in that directory. -# ObjNames - The objects available in that directory. -# Implementation - The library configuration the objects should go in (Generic -# or Optimized) -# Dependencies - Any dependences for the object files. -# OnlyArchs - Only build the objects for the listed archs. -# OnlyConfigs - Only build the objects for the listed configurations. - -ifeq ($(Dir),) - $(error "No Dir variable defined.") -endif - -### -# Include child makefile fragments - -# The list of variables which are intended to be overridden in a subdirectory -# makefile. -RequiredSubdirVariables := SubDirs -OptionalSubdirVariables := ModuleName OnlyArchs OnlyConfigs \ - ObjNames Implementation Dependencies - -# Template: subdir_traverse_template subdir -define subdir_traverse_template -$(call Set,Dir,$(1)) -ifneq ($(DEBUGMAKE),) - $$(info MAKE: $(Dir): Processing subdirectory) -endif - -# Construct the variable key for this directory. -$(call Set,DirKey,SubDir.$(subst .,,$(subst /,__,$(1)))) -$(call Append,SubDirKeys,$(DirKey)) -$(call Set,$(DirKey).Dir,$(Dir)) - -# Reset subdirectory specific variables to sentinel value. -$$(foreach var,$$(RequiredSubdirVariables) $$(OptionalSubdirVariables),\ - $$(call Set,$$(var),UNDEFINED)) - -# Get the subdirectory variables. -include $(1)/Makefile.mk - -ifeq ($(DEBUGMAKE),2) -$$(foreach var,$(RequiredSubdirVariables) $(OptionalSubdirVariables),\ - $$(if $$(call strneq,UNDEFINED,$$($$(var))), \ - $$(info MAKE: $(Dir): $$(var) is defined), \ - $$(info MAKE: $(Dir): $$(var) is undefined))) -endif - -# Check for undefined required variables, and unset sentinel value from optional -# variables. -$$(foreach var,$(RequiredSubdirVariables),\ - $$(if $$(call strneq,UNDEFINED,$$($$(var))),, \ - $$(error $(Dir): variable '$$(var)' was not undefined))) -$$(foreach var,$(OptionalSubdirVariables),\ - $$(if $$(call strneq,UNDEFINED,$$($$(var))),, \ - $$(call Set,$$(var),))) - -# Collect all subdirectory variables for subsequent use. -$$(foreach var,$(RequiredSubdirVariables) $(OptionalSubdirVariables),\ - $$(call Set,$(DirKey).$$(var),$$($$(var)))) - -# Recurse. -include make/subdir.mk - -# Restore directory variable, for cleanliness. -$$(call Set,Dir,$(1)) - -ifneq ($(DEBUGMAKE),) - $$(info MAKE: $$(Dir): Done processing subdirectory) -endif -endef - -# Evaluate this now so we do not have to worry about order of evaluation. - -SubDirsList := $(strip \ - $(if $(call streq,.,$(Dir)),\ - $(SubDirs),\ - $(SubDirs:%=$(Dir)/%))) -ifeq ($(SubDirsList),) -else - ifneq ($(DEBUGMAKE),) - $(info MAKE: Descending into subdirs: $(SubDirsList)) - endif - - $(foreach subdir,$(SubDirsList),\ - $(eval $(call subdir_traverse_template,$(subdir)))) -endif Index: compiler-rt/trunk/make/test/test-util.mk =================================================================== --- compiler-rt/trunk/make/test/test-util.mk +++ compiler-rt/trunk/make/test/test-util.mk @@ -1,66 +0,0 @@ -include make/util.mk - -streq_t0 = $(call streq,,) -$(call AssertEqual,streq_t0,true) -streq_t1 = $(call streq,b,) -$(call AssertEqual,streq_t1,) -streq_t2 = $(call streq,,b) -$(call AssertEqual,streq_t2,) -streq_t3 = $(call streq,b,b) -$(call AssertEqual,streq_t3,true) -streq_t4 = $(call streq,bb,b) -$(call AssertEqual,streq_t4,) -streq_t5 = $(call streq,b,bb) -$(call AssertEqual,streq_t5,) -streq_t6 = $(call streq,bb,bb) -$(call AssertEqual,streq_t6,true) - -strneq_t7 = $(call strneq,,) -$(call AssertEqual,strneq_t7,) -strneq_t8 = $(call strneq,b,) -$(call AssertEqual,strneq_t8,true) -strneq_t9 = $(call strneq,,b) -$(call AssertEqual,strneq_t9,true) -strneq_t10 = $(call strneq,b,b) -$(call AssertEqual,strneq_t10,) -strneq_t11 = $(call strneq,bb,b) -$(call AssertEqual,strneq_t11,true) -strneq_t12 = $(call strneq,b,bb) -$(call AssertEqual,strneq_t12,true) -strneq_t13 = $(call strneq,bb,bb) -$(call AssertEqual,strneq_t13,) - -contains_t0 = $(call contains,a b b c,a) -$(call AssertEqual,contains_t0,true) -contains_t1 = $(call contains,a b b c,b) -$(call AssertEqual,contains_t1,true) -contains_t2 = $(call contains,a b b c,c) -$(call AssertEqual,contains_t2,true) -contains_t3 = $(call contains,a b b c,d) -$(call AssertEqual,contains_t3,) - -isdefined_t0_defined_var := 0 -isdefined_t0 = $(call IsDefined,isdefined_t0_defined_var) -$(call AssertEqual,isdefined_t0,true) -isdefined_t1 = $(call IsDefined,isdefined_t1_never_defined_var) -$(call AssertEqual,isdefined_t1,) - -varordefault_t0_var := 1 -varordefault_t0 = $(call VarOrDefault,varordefault_t0_var.opt,$(varordefault_t0_var)) -$(call AssertEqual,varordefault_t0,1) -varordefault_t1_var := 1 -varordefault_t1_var.opt := 2 -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 - Index: compiler-rt/trunk/make/util.mk =================================================================== --- compiler-rt/trunk/make/util.mk +++ compiler-rt/trunk/make/util.mk @@ -1,114 +0,0 @@ -# Generic Makefile Utilities - -### -# Utility functions - -# Function: streq LHS RHS -# -# Return "true" if LHS == RHS, otherwise "". -# -# LHS == RHS <=> (LHS subst RHS is empty) and (RHS subst LHS is empty) -streq = $(if $(1),$(if $(subst $(1),,$(2))$(subst $(2),,$(1)),,true),$(if $(2),,true)) - -# Function: strneq LHS RHS -# -# Return "true" if LHS != RHS, otherwise "". -strneq = $(if $(call streq,$(1),$(2)),,true) - -# Function: contains list item -# -# Return "true" if 'list' contains the value 'item'. -contains = $(if $(strip $(foreach i,$(1),$(if $(call streq,$(2),$(i)),T,))),true,) - -# Function: is_subset a b -# Return "true" if 'a' is a subset of 'b'. -is_subset = $(if $(strip $(set_difference $(1),$(2))),,true) - -# Function: set_difference a b -# Return a - b. -set_difference = $(foreach i,$(1),$(if $(call contains,$(2),$(i)),,$(i))) - -# Function: Set variable value -# -# Set the given make variable to the given value. -Set = $(eval $(1) := $(2)) - -# Function: Append variable value -# -# Append the given value to the given make variable. -Append = $(eval $(1) += $(2)) - -# Function: IsDefined variable -# -# Check whether the given variable is defined. -IsDefined = $(call strneq,undefined,$(flavor $(1))) - -# Function: IsUndefined variable -# -# Check whether the given variable is undefined. -IsUndefined = $(call streq,undefined,$(flavor $(1))) - -# Function: VarOrDefault variable default-value -# -# Get the value of the given make variable, or the default-value if the variable -# is undefined. -VarOrDefault = $(if $(call IsDefined,$(1)),$($(1)),$(2)) - -# Function: CheckValue variable -# -# Print the name, definition, and value of a variable, for testing make -# utilities. -# -# Example: -# foo = $(call streq,a,a) -# $(call CheckValue,foo) -# Example Output: -# 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 -Assert = $(if $(1),,\ - $(error Assertion failed: $(2))) - -# Function: AssertEqual variable expected-value -# -# Check that the value of a variable is 'expected-value'. -AssertEqual = \ - $(if $(call streq,$($(1)),$(2)),,\ - $(error Assertion failed: $(1): $(value $(1)) - $($(1)) != $(2))) - -# Function: CheckCommandLineOverrides list -# -# Check that all command line variables are in the given list. This routine is -# useful for validating that users aren't trying to override something which -# will not work. -CheckCommandLineOverrides = \ - $(foreach arg,$(MAKEOVERRIDES),\ - $(call Set,varname,$(firstword $(subst =, ,$(arg)))) \ - $(if $(call contains,$(1),$(varname)),,\ - $(error "Invalid command line override: $(1) $(varname) (not supported)"))) - -### -# Clean up make behavior - -# Cancel all suffix rules. We don't want no stinking suffix rules. -.SUFFIXES: - -### -# Debugging - -# General debugging rule, use 'make print-XXX' to print the definition, value -# and origin of XXX. -make-print-%: - $(error PRINT: $(value $*) = "$($*)" (from $(origin $*)))