]> git.saurik.com Git - apple/ld64.git/blobdiff - unit-tests/include/common.makefile
ld64-224.1.tar.gz
[apple/ld64.git] / unit-tests / include / common.makefile
index 7222efa3774d64124f0b575c4b93374231f85a38..fdb62126dbe893a6deef7719d4b80648c0cfebed 100644 (file)
@@ -6,7 +6,8 @@ SHELL = /bin/sh
 ARCH ?= $(shell arch)
 
 # set default to be all
 ARCH ?= $(shell arch)
 
 # set default to be all
-VALID_ARCHS ?= "ppc ppc64 i386 x86_64 armv6"
+VALID_ARCHS ?= "i386 x86_64 armv6"
+
 
 MYDIR=$(shell cd ../../bin;pwd)
 LD                     = ld
 
 MYDIR=$(shell cd ../../bin;pwd)
 LD                     = ld
@@ -14,26 +15,33 @@ OBJECTDUMP  = ObjectDump
 MACHOCHECK     = machocheck
 OTOOL          = otool
 REBASE         = rebase
 MACHOCHECK     = machocheck
 OTOOL          = otool
 REBASE         = rebase
+DYLDINFO       = dyldinfo
 
 ifdef BUILT_PRODUCTS_DIR
        # if run within Xcode, add the just built tools to the command path
        PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH}
 
 ifdef BUILT_PRODUCTS_DIR
        # if run within Xcode, add the just built tools to the command path
        PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${PATH}
-       COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${MYDIR}:${COMPILER_PATH}
+       COMPILER_PATH := ${BUILT_PRODUCTS_DIR}:${COMPILER_PATH}
+       LD_PATH     = ${BUILT_PRODUCTS_DIR}
        LD                      = ${BUILT_PRODUCTS_DIR}/ld
        OBJECTDUMP      = ${BUILT_PRODUCTS_DIR}/ObjectDump
        MACHOCHECK      = ${BUILT_PRODUCTS_DIR}/machocheck
        REBASE          = ${BUILT_PRODUCTS_DIR}/rebase
        LD                      = ${BUILT_PRODUCTS_DIR}/ld
        OBJECTDUMP      = ${BUILT_PRODUCTS_DIR}/ObjectDump
        MACHOCHECK      = ${BUILT_PRODUCTS_DIR}/machocheck
        REBASE          = ${BUILT_PRODUCTS_DIR}/rebase
+       UNWINDDUMP  = ${BUILT_PRODUCTS_DIR}/unwinddump
+       DYLDINFO        = ${BUILT_PRODUCTS_DIR}/dyldinfo
 else
        ifneq "$(findstring /unit-tests/test-cases/, $(shell pwd))" ""
                # if run from Terminal inside unit-test directory
 else
        ifneq "$(findstring /unit-tests/test-cases/, $(shell pwd))" ""
                # if run from Terminal inside unit-test directory
-               RELEASEDIR=$(shell cd ../../../build/Release;pwd)
+               RELEASEADIR=$(shell cd ../../../build/Release-assert;pwd)
                DEBUGDIR=$(shell cd ../../../build/Debug;pwd)
                DEBUGDIR=$(shell cd ../../../build/Debug;pwd)
-               PATH := ${RELEASEDIR}:${DEBUGDIR}:${MYDIR}:${PATH}
-               COMPILER_PATH := ${RELEASEDIR}:${DEBUGDIR}:${MYDIR}:${COMPILER_PATH}
-               LD                      = ${RELEASEDIR}/ld
-               OBJECTDUMP      = ${RELEASEDIR}/ObjectDump
-               MACHOCHECK      = ${RELEASEDIR}/machocheck
-               REBASE          = ${RELEASEDIR}/rebase
+               PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${MYDIR}:${PATH}
+               COMPILER_PATH := ${RELEASEADIR}:${RELEASEDIR}:${DEBUGDIR}:${COMPILER_PATH}
+               LD_PATH     = ${DEBUGDIR}
+               LD                      = ${DEBUGDIR}/ld
+               OBJECTDUMP      = ${DEBUGDIR}/ObjectDump
+               MACHOCHECK      = ${DEBUGDIR}/machocheck
+               REBASE          = ${DEBUGDIR}/rebase
+               UNWINDDUMP  = ${DEBUGDIR}/unwinddump
+               DYLDINFO        = ${DEBUGDIR}/dyldinfo
        else
                PATH := ${MYDIR}:${PATH}:
                COMPILER_PATH := ${MYDIR}:${COMPILER_PATH}:
        else
                PATH := ${MYDIR}:${PATH}:
                COMPILER_PATH := ${MYDIR}:${COMPILER_PATH}:
@@ -41,50 +49,90 @@ else
 endif
 export PATH
 export COMPILER_PATH
 endif
 export PATH
 export COMPILER_PATH
+export GCC_EXEC_PREFIX=garbage
 
 
+ifeq ($(ARCH),ppc)
+       SDKExtra = -isysroot /Developer/SDKs/MacOSX10.6.sdk
+endif
 
 
-CC              = gcc-4.2 -arch ${ARCH} ${SDKExtra}
-CCFLAGS = -Wall -std=c99
+CC              = $(shell xcrun -find clang) -arch ${ARCH} ${SDKExtra}
+CCFLAGS = -Wall 
 ASMFLAGS =
 ASMFLAGS =
+VERSION_NEW_LINKEDIT = -mmacosx-version-min=10.6
+VERSION_OLD_LINKEDIT = -mmacosx-version-min=10.4
+LD_NEW_LINKEDIT = -macosx_version_min 10.6
 
 
-CXX              = g++-4.2 -arch ${ARCH} ${SDKExtra}
-CXXFLAGS = -Wall
+CXX              = $(shell xcrun -find clang++) -arch ${ARCH} ${SDKExtra}
+CXXFLAGS = -Wall -stdlib=libc++ 
+
+IOS_SDK = $(shell xcodebuild -sdk iphoneos7.0.internal -version Path)
 
 ifeq ($(ARCH),armv6)
 
 ifeq ($(ARCH),armv6)
-       SDKExtra = -isysroot /Developer/SDKs/Extra
-  LDFLAGS := -syslibroot /Developer/SDKs/Extra
+  LDFLAGS := -syslibroot $(IOS_SDK)
   override FILEARCH = arm
   override FILEARCH = arm
+  CC = $(shell xcrun -find clang) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) 
+  CXX = $(shell xcrun -find clang++) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK) 
+  VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0
+  VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0
+  LD_SYSROOT = -syslibroot $(IOS_SDK)
+  LD_NEW_LINKEDIT = -ios_version_min 4.0
 else
   FILEARCH = $(ARCH)
 endif
 
 ifeq ($(ARCH),armv7)
 else
   FILEARCH = $(ARCH)
 endif
 
 ifeq ($(ARCH),armv7)
-       SDKExtra = -isysroot /Developer/SDKs/Extra
-  LDFLAGS := -syslibroot /Developer/SDKs/Extra
+  LDFLAGS := -syslibroot $(IOS_SDK)
   override FILEARCH = arm
   override FILEARCH = arm
+  CC = $(shell xcrun -find clang) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK)
+  CXX = $(shell xcrun -find clang++) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK)
+  VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0
+  VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0
+  LD_SYSROOT = -syslibroot $(IOS_SDK)
+  LD_NEW_LINKEDIT = -ios_version_min 4.0
 else
   FILEARCH = $(ARCH)
 endif
 
 ifeq ($(ARCH),thumb)
 else
   FILEARCH = $(ARCH)
 endif
 
 ifeq ($(ARCH),thumb)
-       SDKExtra = -isysroot /Developer/SDKs/Extra
-  LDFLAGS := -syslibroot /Developer/SDKs/Extra
+  LDFLAGS := -syslibroot $(IOS_SDK)
   CCFLAGS += -mthumb
   CXXFLAGS += -mthumb
   override ARCH = armv6
   override FILEARCH = arm
   CCFLAGS += -mthumb
   CXXFLAGS += -mthumb
   override ARCH = armv6
   override FILEARCH = arm
+  CC = $(shell xcrun -find clang) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK)
+  CXX = $(shell xcrun -find clang++) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK)
+  VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0
+  VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0
+  LD_SYSROOT = -syslibroot $(IOS_SDK)
+  LD_NEW_LINKEDIT = -ios_version_min 4.0
 else
   FILEARCH = $(ARCH)
 endif
 
 ifeq ($(ARCH),thumb2)
 else
   FILEARCH = $(ARCH)
 endif
 
 ifeq ($(ARCH),thumb2)
-       SDKExtra = -isysroot /Developer/SDKs/Extra
-  LDFLAGS := -syslibroot /Developer/SDKs/Extra
+  LDFLAGS := -syslibroot $(IOS_SDK)
   CCFLAGS += -mthumb
   CXXFLAGS += -mthumb
   override ARCH = armv7
   override FILEARCH = arm
   CCFLAGS += -mthumb
   CXXFLAGS += -mthumb
   override ARCH = armv7
   override FILEARCH = arm
-       CC = /Volumes/Leopard/Developer/Platforms/iPhoneOS.platform/usr/bin/gcc-4.2 -arch ${ARCH}
+  CC = $(shell xcrun -find clang) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK)
+  CXX = $(shell xcrun -find clang++) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=5.0 -isysroot $(IOS_SDK)
+  VERSION_NEW_LINKEDIT = -miphoneos-version-min=4.0
+  VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0
+  LD_SYSROOT = -syslibroot $(IOS_SDK)
+  LD_NEW_LINKEDIT = -ios_version_min 4.0
+else
+  FILEARCH = $(ARCH)
+endif
+
+ifeq ($(ARCH),arm64)
+  LDFLAGS := -syslibroot $(IOS_SDK)
+  CC = $(shell xcrun --sdk iphoneos.internal -find clang) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=7.0 -isysroot $(IOS_SDK)
+  CXX = $(shell xcrun --sdk iphoneos.internal -find clang++) -arch ${ARCH} -ccc-install-dir ${LD_PATH} -miphoneos-version-min=7.0 -isysroot $(IOS_SDK)
+  VERSION_NEW_LINKEDIT = -miphoneos-version-min=7.0
+  VERSION_OLD_LINKEDIT = -miphoneos-version-min=3.0
+  LD_SYSROOT = -syslibroot $(IOS_SDK)
+  LD_NEW_LINKEDIT = -ios_version_min 7.0
 else
   FILEARCH = $(ARCH)
 endif
 else
   FILEARCH = $(ARCH)
 endif