Home | History | Annotate | Download | only in make
      1 
      2 #
      3 # Make rules to build compiler_rt in Apple B&I infrastructure
      4 #
      5 
      6 # set ProjSrcRoot appropriately
      7 ProjSrcRoot := $(SRCROOT)
      8 # set ProjObjRoot appropriately
      9 ifdef OBJROOT
     10   ProjObjRoot := $(OBJROOT)
     11 else
     12   ProjObjRoot := $(ProjSrcRoot)
     13 endif
     14 
     15 ifeq (,$(SDKROOT))
     16 	INSTALL_TARGET = install-MacOSX
     17 else
     18 	INSTALL_TARGET = install-iOS
     19 endif
     20 
     21 
     22 
     23 # Log full compile lines in B&I logs and omit summary lines.
     24 Verb :=
     25 Summary := @true
     26 
     27 # List of functions needed for each architecture.
     28 
     29 # Copies any public headers to DSTROOT.
     30 installhdrs:
     31 
     32 
     33 # Copies source code to SRCROOT.
     34 installsrc:
     35 	cp -r . $(SRCROOT)
     36 
     37 
     38 install:  $(INSTALL_TARGET)
     39 
     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
     52 
     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 $@ 
     62 
     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 
     68 
     69 
     70 
     71 # Copy results to DSTROOT.
     72 install-iOS: $(SYMROOT)/libcompiler_rt-static.a \
     73              $(SYMROOT)/libcompiler_rt-dyld.a \
     74              $(SYMROOT)/libcompiler_rt.dylib
     75 	mkdir -p $(DSTROOT)/usr/local/lib
     76 	cp $(SYMROOT)/libcompiler_rt-static.a  \
     77 				    $(DSTROOT)/usr/local/lib/libcompiler_rt-static.a
     78 	mkdir -p $(DSTROOT)/usr/local/lib/dyld
     79 	cp $(SYMROOT)/libcompiler_rt-dyld.a  \
     80 				    $(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a
     81 	mkdir -p $(DSTROOT)/usr/lib/system
     82 	$(call GetCNAVar,STRIP,Platform.darwin_bni,Release,) -S $(SYMROOT)/libcompiler_rt.dylib \
     83 	    -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib
     84 
     85 	
     86 # Rule to make fat archive
     87 $(SYMROOT)/libcompiler_rt-static.a : $(foreach arch,$(RC_ARCHS), \
     88                          $(OBJROOT)/darwin_bni/Static/$(arch)/libcompiler_rt.a)
     89 	$(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o  $@
     90 
     91 # rule to make each archive slice for dyld (which removes a few archive members)
     92 $(OBJROOT)/libcompiler_rt-dyld-%.a : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a
     93 	cp $^ $@
     94 	DEL_LIST=`$(AR)  -t $@ | egrep 'apple_versioning|gcc_personality_v0|eprintf' | xargs echo` ; \
     95 	if [ -n "$${DEL_LIST}" ] ; \
     96 	then  \
     97 		$(call GetCNAVar,AR,Platform.darwin_bni,Release,) -d $@ $${DEL_LIST}; \
     98 		$(call GetCNAVar,RANLIB,Platform.darwin_bni,Release,) $@ ; \
     99 	fi
    100 
    101 # rule to make make archive for dyld
    102 $(SYMROOT)/libcompiler_rt-dyld.a : $(foreach arch,$(RC_ARCHS), \
    103                          $(OBJROOT)/libcompiler_rt-dyld-$(arch).a)
    104 	$(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o  $@
    105 
    106