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 |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 17 | LD_OTHER_FLAGS = |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 18 | else |
Nick Kledzik | dc0b559 | 2010-07-04 18:29:23 +0000 | [diff] [blame] | 19 | INSTALL_TARGET = install-iOS |
Nick Kledzik | 1ea7a40 | 2011-03-16 22:23:24 +0000 | [diff] [blame] | 20 | CFLAGS.Release.armv6 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) |
| 21 | CFLAGS.Release.armv7 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) |
| 22 | CFLAGS.Static.armv6 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) |
| 23 | CFLAGS.Static.armv7 := $(CFLAGS) -Wall -Os -fomit-frame-pointer -g -isysroot $(SDKROOT) |
Nick Kledzik | b1aee72 | 2011-03-08 20:25:22 +0000 | [diff] [blame] | 24 | LD_OTHER_FLAGS = -Wl,-alias_list,$(SRCROOT)/lib/arm/softfloat-alias.list -isysroot $(SDKROOT) |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 25 | endif |
| 26 | |
| 27 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 28 | # Log full compile lines in B&I logs and omit summary lines. |
| 29 | Verb := |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 30 | Summary := @true |
| 31 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 32 | # List of functions needed for each architecture. |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 33 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 34 | # Copies any public headers to DSTROOT. |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 35 | installhdrs: |
| 36 | |
| 37 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 38 | # Copies source code to SRCROOT. |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 39 | installsrc: |
Daniel Dunbar | 3c2a776 | 2010-01-18 06:49:42 +0000 | [diff] [blame] | 40 | cp -r . $(SRCROOT) |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 41 | |
| 42 | |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 43 | install: $(INSTALL_TARGET) |
| 44 | |
Daniel Dunbar | 557a6ea | 2010-01-13 16:13:01 +0000 | [diff] [blame] | 45 | # Copy results to DSTROOT. |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 46 | install-MacOSX : $(SYMROOT)/libcompiler_rt.dylib |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 47 | mkdir -p $(DSTROOT)/usr/lib/system |
| 48 | strip -S $(SYMROOT)/libcompiler_rt.dylib \ |
| 49 | -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib |
| 50 | cd $(DSTROOT)/usr/lib/system; \ |
| 51 | ln -s libcompiler_rt.dylib libcompiler_rt_profile.dylib; \ |
| 52 | ln -s libcompiler_rt.dylib libcompiler_rt_debug.dylib |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 53 | |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 54 | # Rule to make each dylib slice |
| 55 | $(OBJROOT)/libcompiler_rt-%.dylib : $(OBJROOT)/darwin_bni/Release/%/libcompiler_rt.a |
| 56 | echo "const char vers[] = \"@(#) $(RC_ProjectName)-$(RC_ProjectSourceVersion)\"; " > $(OBJROOT)/version.c |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 57 | $(CC.Release) $(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) \ |
| 60 | -nodefaultlibs -lSystem -umbrella System -dead_strip \ |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 61 | $(LD_OTHER_FLAGS) -Wl,-force_load,$^ -o $@ |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 62 | |
Nick Kledzik | 1f7ee1d | 2010-03-31 20:38:57 +0000 | [diff] [blame] | 63 | # Rule to make fat dylib |
| 64 | $(SYMROOT)/libcompiler_rt.dylib: $(foreach arch,$(RC_ARCHS), \ |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 65 | $(OBJROOT)/libcompiler_rt-$(arch).dylib) |
| 66 | lipo -create $^ -o $@ |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | # Copy results to DSTROOT. |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 72 | install-iOS: $(SYMROOT)/libcompiler_rt-static.a \ |
| 73 | $(SYMROOT)/libcompiler_rt.dylib |
| 74 | mkdir -p $(DSTROOT)/usr/local/lib |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 75 | cp $(SYMROOT)/libcompiler_rt-static.a \ |
Nick Kledzik | dc0b559 | 2010-07-04 18:29:23 +0000 | [diff] [blame] | 76 | $(DSTROOT)/usr/local/lib/libcompiler_rt-static.a |
Nick Kledzik | 3d40740 | 2011-03-05 02:15:16 +0000 | [diff] [blame] | 77 | mkdir -p $(DSTROOT)/usr/lib/system |
| 78 | strip -S $(SYMROOT)/libcompiler_rt.dylib \ |
| 79 | -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 80 | |
Nick Kledzik | afb7b6e | 2010-04-21 22:46:53 +0000 | [diff] [blame] | 81 | |
| 82 | # Rule to make fat archive |
| 83 | $(SYMROOT)/libcompiler_rt-static.a : $(foreach arch,$(RC_ARCHS), \ |
| 84 | $(OBJROOT)/darwin_bni/Static/$(arch)/libcompiler_rt.a) |
Daniel Dunbar | 3c2a776 | 2010-01-18 06:49:42 +0000 | [diff] [blame] | 85 | lipo -create $^ -o $@ |
Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 86 | |