3 # Make rules to build compiler_rt in Apple B&I infrastructure
6 # set ProjSrcRoot appropriately
7 ProjSrcRoot
:= $(SRCROOT
)
8 # set ProjObjRoot appropriately
10 ProjObjRoot
:= $(OBJROOT
)
12 ProjObjRoot
:= $(ProjSrcRoot
)
16 INSTALL_TARGET
= install-MacOSX
18 INSTALL_TARGET
= install-iOS
23 # Log full compile lines in B&I logs and omit summary lines.
27 # List of functions needed for each architecture.
29 # Copies any public headers to DSTROOT.
33 # Copies source code to SRCROOT.
38 install: $(INSTALL_TARGET
)
40 # Copy results to DSTROOT.
41 install-MacOSX
: $(SYMROOT
)/libcompiler_rt.dylib \
42 $(SYMROOT
)/libcompiler_rt-dyld.a
43 mkdir
-p
$(DSTROOT
)/usr
/local
/lib
/dyld
44 cp
$(SYMROOT
)/libcompiler_rt-dyld.a \
45 $(DSTROOT
)/usr
/local
/lib
/dyld
/libcompiler_rt.a
46 mkdir
-p
$(DSTROOT
)/usr
/lib
/system
47 $(call GetCNAVar
,STRIP
,Platform.darwin_bni
,Release
,) -S
$(SYMROOT
)/libcompiler_rt.dylib \
48 -o
$(DSTROOT
)/usr
/lib
/system
/libcompiler_rt.dylib
49 cd
$(DSTROOT
)/usr
/lib
/system
; \
50 ln
-s libcompiler_rt.dylib libcompiler_rt_profile.dylib
; \
51 ln
-s libcompiler_rt.dylib libcompiler_rt_debug.dylib
53 # Rule to make each dylib slice
54 $(OBJROOT
)/libcompiler_rt-
%.dylib
: $(OBJROOT
)/darwin_bni
/Release
/%/libcompiler_rt.a
55 echo
"const char vers[] = \"@(#) $(RC_ProjectName)-$(RC_ProjectSourceVersion)\"; " > $(OBJROOT
)/version.c
56 $(call GetCNAVar
,CC
,Platform.darwin_bni
,Release
,$*) \
57 $(OBJROOT
)/version.c
-arch
$* -dynamiclib \
58 -install_name
/usr
/lib
/system
/libcompiler_rt.dylib \
59 -compatibility_version
1 -current_version
$(RC_ProjectSourceVersion
) \
60 -nodefaultlibs
-umbrella System
-dead_strip \
62 -Wl
,-upward-lsystem_m \
63 -Wl
,-upward-lsystem_c \
64 -Wl
,-upward-lsystem_platform \
67 -L
$(SDKROOT
)/usr
/lib
/system \
68 $(DYLIB_FLAGS
) -Wl
,-force_load
,$^
-o
$@
70 # Rule to make fat dylib
71 $(SYMROOT
)/libcompiler_rt.dylib
: $(foreach arch
,$(filter-out armv4t
,$(RC_ARCHS
)), \
72 $(OBJROOT
)/libcompiler_rt-
$(arch
).dylib
)
73 $(call GetCNAVar
,LIPO
,Platform.darwin_bni
,Release
,) -create
$^
-o
$@
74 $(call GetCNAVar
,DSYMUTIL
,Platform.darwin_bni
,Release
,) $@
77 # Copy results to DSTROOT.
78 install-iOS
: $(SYMROOT
)/libcompiler_rt-static.a \
79 $(SYMROOT
)/libcompiler_rt-dyld.a \
80 $(SYMROOT
)/libcompiler_rt.dylib
81 mkdir
-p
$(DSTROOT
)/usr
/local
/lib
82 cp
$(SYMROOT
)/libcompiler_rt-static.a \
83 $(DSTROOT
)/usr
/local
/lib
/libcompiler_rt-static.a
84 mkdir
-p
$(DSTROOT
)/usr
/local
/lib
/dyld
85 cp
$(SYMROOT
)/libcompiler_rt-dyld.a \
86 $(DSTROOT
)/usr
/local
/lib
/dyld
/libcompiler_rt.a
87 mkdir
-p
$(DSTROOT
)/usr
/lib
/system
88 $(call GetCNAVar
,STRIP
,Platform.darwin_bni
,Release
,) -S
$(SYMROOT
)/libcompiler_rt.dylib \
89 -o
$(DSTROOT
)/usr
/lib
/system
/libcompiler_rt.dylib
92 # Rule to make fat archive
93 $(SYMROOT
)/libcompiler_rt-static.a
: $(foreach arch
,$(RC_ARCHS
), \
94 $(OBJROOT
)/darwin_bni
/Static
/$(arch
)/libcompiler_rt.a
)
95 $(call GetCNAVar
,LIPO
,Platform.darwin_bni
,Release
,) -create
$^
-o
$@
97 # rule to make each archive slice for dyld (which removes a few archive members)
98 $(OBJROOT
)/libcompiler_rt-dyld-
%.a
: $(OBJROOT
)/darwin_bni
/Release
/%/libcompiler_rt.a
100 DEL_LIST
=`$(AR) -t $@ | egrep 'apple_versioning|gcc_personality_v0|eprintf' | xargs echo` ; \
101 if
[ -n
"$${DEL_LIST}" ] ; \
103 $(call GetCNAVar
,AR
,Platform.darwin_bni
,Release
,) -d
$@
$${DEL_LIST}; \
104 $(call GetCNAVar
,RANLIB
,Platform.darwin_bni
,Release
,) $@
; \
107 # rule to make make archive for dyld
108 $(SYMROOT
)/libcompiler_rt-dyld.a
: $(foreach arch
,$(RC_ARCHS
), \
109 $(OBJROOT
)/libcompiler_rt-dyld-
$(arch
).a
)
110 $(call GetCNAVar
,LIPO
,Platform.darwin_bni
,Release
,) -create
$^
-o
$@