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
19 INSTALL_TARGET
= install-iOS
21 INSTALL_TARGET
= install-iOS-Simulator
27 # Log full compile lines in B&I logs and omit summary lines.
31 # List of functions needed for each architecture.
33 # Copies any public headers to DSTROOT.
37 # Copies source code to SRCROOT.
42 install: $(INSTALL_TARGET
)
44 # Copy results to DSTROOT.
45 install-MacOSX
: $(SYMROOT
)/libcompiler_rt.dylib \
46 $(SYMROOT
)/libcompiler_rt-dyld.a
47 mkdir
-p
$(DSTROOT
)/usr
/local
/lib
/dyld
48 cp
$(SYMROOT
)/libcompiler_rt-dyld.a \
49 $(DSTROOT
)/usr
/local
/lib
/dyld
/libcompiler_rt.a
50 mkdir
-p
$(DSTROOT
)/usr
/lib
/system
51 $(call GetCNAVar
,STRIP
,Platform.darwin_bni
,Release
,) -S
$(SYMROOT
)/libcompiler_rt.dylib \
52 -o
$(DSTROOT
)/usr
/lib
/system
/libcompiler_rt.dylib
53 cd
$(DSTROOT
)/usr
/lib
/system
; \
54 ln
-s libcompiler_rt.dylib libcompiler_rt_profile.dylib
; \
55 ln
-s libcompiler_rt.dylib libcompiler_rt_debug.dylib
57 # Rule to make each dylib slice
58 $(OBJROOT
)/libcompiler_rt-
%.dylib
: $(OBJROOT
)/darwin_bni
/Release
/%/libcompiler_rt.a
59 echo
"const char vers[] = \"@(#) $(RC_ProjectName)-$(RC_ProjectSourceVersion)\"; " > $(OBJROOT
)/version.c
60 $(call GetCNAVar
,CC
,Platform.darwin_bni
,Release
,$*) \
61 $(OBJROOT
)/version.c
-arch
$* -dynamiclib \
62 -install_name
/usr
/lib
/system
/libcompiler_rt.dylib \
63 -compatibility_version
1 -current_version
$(RC_ProjectSourceVersion
) \
64 -nodefaultlibs
-umbrella System
-dead_strip \
66 -Wl
,-upward-lsystem_m \
67 -Wl
,-upward-lsystem_c \
68 -Wl
,-upward-lsystem_kernel \
69 -Wl
,-upward-lsystem_platform \
71 -L
$(SDKROOT
)/usr
/lib
/system \
72 $(DYLIB_FLAGS
) -Wl
,-force_load
,$^
-o
$@
74 # Rule to make fat dylib
75 $(SYMROOT
)/libcompiler_rt.dylib
: $(foreach arch
,$(filter-out armv4t
,$(RC_ARCHS
)), \
76 $(OBJROOT
)/libcompiler_rt-
$(arch
).dylib
)
77 $(call GetCNAVar
,LIPO
,Platform.darwin_bni
,Release
,) -create
$^
-o
$@
78 $(call GetCNAVar
,DSYMUTIL
,Platform.darwin_bni
,Release
,) $@
81 # Copy results to DSTROOT.
82 install-iOS
: $(SYMROOT
)/libcompiler_rt-static.a \
83 $(SYMROOT
)/libcompiler_rt-dyld.a \
84 $(SYMROOT
)/libcompiler_rt.dylib
85 mkdir
-p
$(DSTROOT
)/usr
/local
/lib
86 cp
$(SYMROOT
)/libcompiler_rt-static.a \
87 $(DSTROOT
)/usr
/local
/lib
/libcompiler_rt-static.a
88 mkdir
-p
$(DSTROOT
)/usr
/local
/lib
/dyld
89 cp
$(SYMROOT
)/libcompiler_rt-dyld.a \
90 $(DSTROOT
)/usr
/local
/lib
/dyld
/libcompiler_rt.a
91 mkdir
-p
$(DSTROOT
)/usr
/lib
/system
92 $(call GetCNAVar
,STRIP
,Platform.darwin_bni
,Release
,) -S
$(SYMROOT
)/libcompiler_rt.dylib \
93 -o
$(DSTROOT
)/usr
/lib
/system
/libcompiler_rt.dylib
95 # Rule to make fat archive
96 $(SYMROOT
)/libcompiler_rt-static.a
: $(foreach arch
,$(RC_ARCHS
), \
97 $(OBJROOT
)/darwin_bni
/Static
/$(arch
)/libcompiler_rt.a
)
98 $(call GetCNAVar
,LIPO
,Platform.darwin_bni
,Release
,) -create
$^
-o
$@
100 # rule to make each archive slice for dyld (which removes a few archive members)
101 $(OBJROOT
)/libcompiler_rt-dyld-
%.a
: $(OBJROOT
)/darwin_bni
/Release
/%/libcompiler_rt.a
103 DEL_LIST
=`$(AR) -t $@ | egrep 'apple_versioning|gcc_personality_v0|eprintf' | xargs echo` ; \
104 if
[ -n
"$${DEL_LIST}" ] ; \
106 $(call GetCNAVar
,AR
,Platform.darwin_bni
,Release
,) -d
$@
$${DEL_LIST}; \
107 $(call GetCNAVar
,RANLIB
,Platform.darwin_bni
,Release
,) $@
; \
110 # rule to make make archive for dyld
111 $(SYMROOT
)/libcompiler_rt-dyld.a
: $(foreach arch
,$(RC_ARCHS
), \
112 $(OBJROOT
)/libcompiler_rt-dyld-
$(arch
).a
)
113 $(call GetCNAVar
,LIPO
,Platform.darwin_bni
,Release
,) -create
$^
-o
$@
117 # Copy results to DSTROOT.
118 install-iOS-Simulator
: $(SYMROOT
)/libcompiler_rt_sim.dylib \
119 $(SYMROOT
)/libcompiler_rt-dyld.a
120 mkdir
-p
$(DSTROOT
)/$(SDKROOT
)/usr
/lib
/system
121 $(call GetCNAVar
,STRIP
,Platform.darwin_bni
,Release
,) -S
$(SYMROOT
)/libcompiler_rt_sim.dylib \
122 -o
$(DSTROOT
)/$(SDKROOT
)/usr
/lib
/system
/libcompiler_rt_sim.dylib
123 mkdir
-p
$(DSTROOT
)/$(SDKROOT
)/usr
/local
/lib
/dyld
124 cp
$(SYMROOT
)/libcompiler_rt-dyld.a \
125 $(DSTROOT
)/$(SDKROOT
)/usr
/local
/lib
/dyld
/libcompiler_rt.a
127 # Rule to make fat dylib
128 $(SYMROOT
)/libcompiler_rt_sim.dylib
: $(foreach arch
,$(RC_ARCHS
), \
129 $(OBJROOT
)/libcompiler_rt_sim-
$(arch
).dylib
)
130 $(call GetCNAVar
,LIPO
,Platform.darwin_bni
,Release
,) -create
$^
-o
$@
131 $(call GetCNAVar
,DSYMUTIL
,Platform.darwin_bni
,Release
,) $@
133 # Rule to make each dylib slice
134 $(OBJROOT
)/libcompiler_rt_sim-
%.dylib
: $(OBJROOT
)/darwin_bni
/Release
/%/libcompiler_rt.a
135 echo
"const char vers[] = \"@(#) $(RC_ProjectName)-$(RC_ProjectSourceVersion)\"; " > $(OBJROOT
)/version.c
136 $(call GetCNAVar
,CC
,Platform.darwin_bni
,Release
,$*) \
137 $(OBJROOT
)/version.c
-arch
$* -dynamiclib \
138 -install_name
/usr
/lib
/system
/libcompiler_rt_sim.dylib \
139 -compatibility_version
1 -current_version
$(RC_ProjectSourceVersion
) \
140 -Wl
,-unexported_symbol
,___enable_execute_stack \
142 -Wl
,-upward-lunwind_sim \
143 -Wl
,-upward-lsystem_sim_m \
144 -Wl
,-upward-lsystem_sim_c \
146 -Wl
,-upward-lSystem \
147 -umbrella System
-Wl
,-no_implicit_dylibs
-L
$(SDKROOT
)/usr
/lib
/system
-dead_strip \
148 $(DYLIB_FLAGS
) -Wl
,-force_load
,$^
-o
$@