tsan: better error message if we fail to intercept some function
[blocksruntime.git] / make / AppleBI.mk
blobb5e702b10e66c3cccc5f2e74b24f05e03e1d25b3
3 # Make rules to build compiler_rt in Apple B&I infrastructure
6 # set ProjSrcRoot appropriately
7 ProjSrcRoot := $(SRCROOT)
8 # set ProjObjRoot appropriately
9 ifdef OBJROOT
10 ProjObjRoot := $(OBJROOT)
11 else
12 ProjObjRoot := $(ProjSrcRoot)
13 endif
15 ifeq (,$(SDKROOT))
16 INSTALL_TARGET = install-MacOSX
17 else
18 INSTALL_TARGET = install-iOS
19 endif
23 # Log full compile lines in B&I logs and omit summary lines.
24 Verb :=
25 Summary := @true
27 # List of functions needed for each architecture.
29 # Copies any public headers to DSTROOT.
30 installhdrs:
33 # Copies source code to SRCROOT.
34 installsrc:
35 cp -r . $(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 -lSystem -umbrella System -dead_strip \
61 $(DYLIB_FLAGS) -Wl,-force_load,$^ -o $@
63 # Rule to make fat dylib
64 $(SYMROOT)/libcompiler_rt.dylib: $(foreach arch,$(filter-out armv4t,$(RC_ARCHS)), \
65 $(OBJROOT)/libcompiler_rt-$(arch).dylib)
66 $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@
67 $(call GetCNAVar,DSYMUTIL,Platform.darwin_bni,Release,) $@
70 # Copy results to DSTROOT.
71 install-iOS: $(SYMROOT)/libcompiler_rt-static.a \
72 $(SYMROOT)/libcompiler_rt-dyld.a \
73 $(SYMROOT)/libcompiler_rt.dylib
74 mkdir -p $(DSTROOT)/usr/local/lib
75 cp $(SYMROOT)/libcompiler_rt-static.a \
76 $(DSTROOT)/usr/local/lib/libcompiler_rt-static.a
77 mkdir -p $(DSTROOT)/usr/local/lib/dyld
78 cp $(SYMROOT)/libcompiler_rt-dyld.a \
79 $(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a
80 mkdir -p $(DSTROOT)/usr/lib/system
81 $(call GetCNAVar,STRIP,Platform.darwin_bni,Release,) -S $(SYMROOT)/libcompiler_rt.dylib \
82 -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib
85 # Rule to make fat archive
86 $(SYMROOT)/libcompiler_rt-static.a : $(foreach arch,$(RC_ARCHS), \
87 $(OBJROOT)/darwin_bni/Static/$(arch)/libcompiler_rt.a)
88 $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@
90 # rule to make each archive slice for dyld (which removes a few archive members)
91 $(OBJROOT)/libcompiler_rt-dyld-%.a : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a
92 cp $^ $@
93 DEL_LIST=`$(AR) -t $@ | egrep 'apple_versioning|gcc_personality_v0|eprintf' | xargs echo` ; \
94 if [ -n "$${DEL_LIST}" ] ; \
95 then \
96 $(call GetCNAVar,AR,Platform.darwin_bni,Release,) -d $@ $${DEL_LIST}; \
97 $(call GetCNAVar,RANLIB,Platform.darwin_bni,Release,) $@ ; \
100 # rule to make make archive for dyld
101 $(SYMROOT)/libcompiler_rt-dyld.a : $(foreach arch,$(RC_ARCHS), \
102 $(OBJROOT)/libcompiler_rt-dyld-$(arch).a)
103 $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@