mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 11:39:35 +00:00
<rdar://problem/9624306> clean up darwin platform to use xcrun. Set up variables in darwin_bni.mk. Use GetCNAVar in AppleBI.mk
llvm-svn: 133487
This commit is contained in:
parent
b4a791f7bc
commit
1f9470589b
@ -14,17 +14,12 @@ endif
|
||||
|
||||
ifeq (,$(SDKROOT))
|
||||
INSTALL_TARGET = install-MacOSX
|
||||
LD_OTHER_FLAGS =
|
||||
else
|
||||
INSTALL_TARGET = install-iOS
|
||||
CFLAGS.Release.armv6 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT)
|
||||
CFLAGS.Release.armv7 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT)
|
||||
CFLAGS.Static.armv6 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) -static
|
||||
CFLAGS.Static.armv7 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) -static
|
||||
LD_OTHER_FLAGS = -Wl,-alias_list,$(SRCROOT)/lib/arm/softfloat-alias.list -isysroot $(SDKROOT)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
# Log full compile lines in B&I logs and omit summary lines.
|
||||
Verb :=
|
||||
Summary := @true
|
||||
@ -49,7 +44,7 @@ install-MacOSX : $(SYMROOT)/libcompiler_rt.dylib \
|
||||
cp $(SYMROOT)/libcompiler_rt-dyld.a \
|
||||
$(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a
|
||||
mkdir -p $(DSTROOT)/usr/lib/system
|
||||
strip -S $(SYMROOT)/libcompiler_rt.dylib \
|
||||
$(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; \
|
||||
@ -58,16 +53,17 @@ install-MacOSX : $(SYMROOT)/libcompiler_rt.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
|
||||
$(CC.Release) $(OBJROOT)/version.c -arch $* -dynamiclib \
|
||||
$(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 -lSystem -umbrella System -dead_strip \
|
||||
$(LD_OTHER_FLAGS) -Wl,-force_load,$^ -o $@
|
||||
$(DYLIB_FLAGS) -Wl,-force_load,$^ -o $@
|
||||
|
||||
# Rule to make fat dylib
|
||||
$(SYMROOT)/libcompiler_rt.dylib: $(foreach arch,$(RC_ARCHS), \
|
||||
$(OBJROOT)/libcompiler_rt-$(arch).dylib)
|
||||
lipo -create $^ -o $@
|
||||
$(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@
|
||||
|
||||
|
||||
|
||||
@ -83,25 +79,27 @@ install-iOS: $(SYMROOT)/libcompiler_rt-static.a \
|
||||
cp $(SYMROOT)/libcompiler_rt-dyld.a \
|
||||
$(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a
|
||||
mkdir -p $(DSTROOT)/usr/lib/system
|
||||
strip -S $(SYMROOT)/libcompiler_rt.dylib \
|
||||
$(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)
|
||||
lipo -create $^ -o $@
|
||||
$(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@
|
||||
|
||||
# rule to make each archive slice for dyld
|
||||
# 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 $^ $@
|
||||
ar -d $@ apple_versioning.o
|
||||
ar -d $@ gcc_personality_v0.o
|
||||
ar -d $@ eprintf.o
|
||||
ranlib $@
|
||||
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)
|
||||
lipo -create $^ -o $@
|
||||
$(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@
|
||||
|
||||
|
@ -8,17 +8,30 @@ Configs := Debug Release Profile Static
|
||||
# and the resulting lib will just have generic versions for anything unknown.
|
||||
UniversalArchs := $(RC_ARCHS)
|
||||
|
||||
ifeq (,$(SDKROOT))
|
||||
CC.Release := $(CC)
|
||||
CC.Static := $(CC)
|
||||
else
|
||||
CC.Release := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc
|
||||
CC.Static := /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/cc
|
||||
ifneq (,$(SDKROOT))
|
||||
override CC := $(shell xcrun -sdk $(SDKROOT) -find clang)
|
||||
AR := $(shell xcrun -sdk $(SDKROOT) -find ar)
|
||||
RANLIB := $(shell xcrun -sdk $(SDKROOT) -find ranlib)
|
||||
STRIP := $(shell xcrun -sdk $(SDKROOT) -find strip)
|
||||
LIPO := $(shell xcrun -sdk $(SDKROOT) -find lipo)
|
||||
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
|
||||
|
||||
CFLAGS := -Wall -Os -fomit-frame-pointer -g
|
||||
CFLAGS.Static := $(CFLAGS) -static
|
||||
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/arm/softfloat-alias.list
|
||||
|
||||
VISIBILITY_HIDDEN := 0
|
||||
VISIBILITY_HIDDEN.Static := 1
|
||||
|
Loading…
Reference in New Issue
Block a user