Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 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 | |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 15 | ifeq (,$(SDKROOT)) |
| 16 | INSTALL_TARGET = install-MacOSX |
| 17 | else |
Nick Kledzik | dc0b559 | 2010-07-04 18:29:23 +0000 | [diff] [blame] | 18 | INSTALL_TARGET = install-iOS |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 19 | endif |
| 20 | |
| 21 | |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 22 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 23 | # Log full compile lines in B&I logs and omit summary lines. |
| 24 | Verb := |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 25 | Summary := @true |
| 26 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 27 | # List of functions needed for each architecture. |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 28 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 29 | # Copies any public headers to DSTROOT. |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 30 | installhdrs: |
| 31 | |
| 32 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 33 | # Copies source code to SRCROOT. |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 34 | installsrc: |
Daniel Dunbar | 3c2a776 | 2010-01-18 06:49:42 +0000 | [diff] [blame] | 35 | cp -r . $(SRCROOT) |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 36 | |
| 37 | |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 38 | install: $(INSTALL_TARGET) |
| 39 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 40 | # Copy results to DSTROOT. |
Nick Kledzik | 7956ca9 | 2011-04-14 00:45:01 +0000 | [diff] [blame] | 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 |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 46 | mkdir -p $(DSTROOT)/usr/lib/system |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 47 | $(call GetCNAVar,STRIP,Platform.darwin_bni,Release,) -S $(SYMROOT)/libcompiler_rt.dylib \ |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 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 |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 52 | |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 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 |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 56 | $(call GetCNAVar,CC,Platform.darwin_bni,Release,$*) \ |
| 57 | $(OBJROOT)/version.c -arch $* -dynamiclib \ |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 58 | -install_name /usr/lib/system/libcompiler_rt.dylib \ |
| 59 | -compatibility_version 1 -current_version $(RC_ProjectSourceVersion) \ |
Nick Kledzik | ef3667a | 2013-03-05 00:16:52 +0000 | [diff] [blame] | 60 | -nodefaultlibs -umbrella System -dead_strip \ |
| 61 | -Wl,-upward-lunwind \ |
| 62 | -Wl,-upward-lsystem_m \ |
| 63 | -Wl,-upward-lsystem_c \ |
Nick Kledzik | e04a1fd | 2013-05-21 23:02:04 +0000 | [diff] [blame] | 64 | -Wl,-upward-lsystem_platform \ |
Nick Kledzik | ef3667a | 2013-03-05 00:16:52 +0000 | [diff] [blame] | 65 | -Wl,-ldyld \ |
| 66 | -Wl,-lsystem_kernel \ |
| 67 | -L$(SDKROOT)/usr/lib/system \ |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 68 | $(DYLIB_FLAGS) -Wl,-force_load,$^ -o $@ |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 69 | |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 70 | # Rule to make fat dylib |
Nick Kledzik | a11b52f | 2011-09-27 20:05:27 +0000 | [diff] [blame] | 71 | $(SYMROOT)/libcompiler_rt.dylib: $(foreach arch,$(filter-out armv4t,$(RC_ARCHS)), \ |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 72 | $(OBJROOT)/libcompiler_rt-$(arch).dylib) |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 73 | $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@ |
Nick Kledzik | c0973d6 | 2012-11-26 22:48:51 +0000 | [diff] [blame] | 74 | $(call GetCNAVar,DSYMUTIL,Platform.darwin_bni,Release,) $@ |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 75 | |
| 76 | |
| 77 | # Copy results to DSTROOT. |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 78 | install-iOS: $(SYMROOT)/libcompiler_rt-static.a \ |
Nick Kledzik | 7956ca9 | 2011-04-14 00:45:01 +0000 | [diff] [blame] | 79 | $(SYMROOT)/libcompiler_rt-dyld.a \ |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 80 | $(SYMROOT)/libcompiler_rt.dylib |
| 81 | mkdir -p $(DSTROOT)/usr/local/lib |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 82 | cp $(SYMROOT)/libcompiler_rt-static.a \ |
Nick Kledzik | dc0b559 | 2010-07-04 18:29:23 +0000 | [diff] [blame] | 83 | $(DSTROOT)/usr/local/lib/libcompiler_rt-static.a |
Nick Kledzik | 7956ca9 | 2011-04-14 00:45:01 +0000 | [diff] [blame] | 84 | mkdir -p $(DSTROOT)/usr/local/lib/dyld |
| 85 | cp $(SYMROOT)/libcompiler_rt-dyld.a \ |
| 86 | $(DSTROOT)/usr/local/lib/dyld/libcompiler_rt.a |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 87 | mkdir -p $(DSTROOT)/usr/lib/system |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 88 | $(call GetCNAVar,STRIP,Platform.darwin_bni,Release,) -S $(SYMROOT)/libcompiler_rt.dylib \ |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 89 | -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 90 | |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 91 | |
| 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) |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 95 | $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@ |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 96 | |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 97 | # rule to make each archive slice for dyld (which removes a few archive members) |
Nick Kledzik | 7956ca9 | 2011-04-14 00:45:01 +0000 | [diff] [blame] | 98 | $(OBJROOT)/libcompiler_rt-dyld-%.a : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a |
| 99 | cp $^ $@ |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 100 | DEL_LIST=`$(AR) -t $@ | egrep 'apple_versioning|gcc_personality_v0|eprintf' | xargs echo` ; \ |
| 101 | if [ -n "$${DEL_LIST}" ] ; \ |
| 102 | then \ |
| 103 | $(call GetCNAVar,AR,Platform.darwin_bni,Release,) -d $@ $${DEL_LIST}; \ |
| 104 | $(call GetCNAVar,RANLIB,Platform.darwin_bni,Release,) $@ ; \ |
| 105 | fi |
Nick Kledzik | 7956ca9 | 2011-04-14 00:45:01 +0000 | [diff] [blame] | 106 | |
| 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) |
Nick Kledzik | 9435c40 | 2011-06-21 00:07:55 +0000 | [diff] [blame] | 110 | $(call GetCNAVar,LIPO,Platform.darwin_bni,Release,) -create $^ -o $@ |
Nick Kledzik | 7956ca9 | 2011-04-14 00:45:01 +0000 | [diff] [blame] | 111 | |