blob: 184c16ad84e907d7cd0f1fa9b6977b32b2f0c672 [file] [log] [blame]
Daniel Dunbarb3a69012009-06-26 16:47:03 +00001
2#
3# Make rules to build compiler_rt in Apple B&I infrastructure
4#
5
6# set ProjSrcRoot appropriately
7ProjSrcRoot := $(SRCROOT)
8# set ProjObjRoot appropriately
9ifdef OBJROOT
10 ProjObjRoot := $(OBJROOT)
11else
12 ProjObjRoot := $(ProjSrcRoot)
13endif
14
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000015ifeq (,$(SDKROOT))
16 INSTALL_TARGET = install-MacOSX
Nick Kledzik3d407402011-03-05 02:15:16 +000017 LD_OTHER_FLAGS =
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000018else
Nick Kledzikdc0b5592010-07-04 18:29:23 +000019 INSTALL_TARGET = install-iOS
Nick Kledzik1ea7a402011-03-16 22:23:24 +000020 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 Kledzikb1aee722011-03-08 20:25:22 +000024 LD_OTHER_FLAGS = -Wl,-alias_list,$(SRCROOT)/lib/arm/softfloat-alias.list -isysroot $(SDKROOT)
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000025endif
26
27
Daniel Dunbar557a6ea2010-01-13 16:13:01 +000028# Log full compile lines in B&I logs and omit summary lines.
29Verb :=
Daniel Dunbarb3a69012009-06-26 16:47:03 +000030Summary := @true
31
Daniel Dunbar557a6ea2010-01-13 16:13:01 +000032# List of functions needed for each architecture.
Daniel Dunbarb3a69012009-06-26 16:47:03 +000033
Daniel Dunbar557a6ea2010-01-13 16:13:01 +000034# Copies any public headers to DSTROOT.
Daniel Dunbarb3a69012009-06-26 16:47:03 +000035installhdrs:
36
37
Daniel Dunbar557a6ea2010-01-13 16:13:01 +000038# Copies source code to SRCROOT.
Daniel Dunbarb3a69012009-06-26 16:47:03 +000039installsrc:
Daniel Dunbar3c2a7762010-01-18 06:49:42 +000040 cp -r . $(SRCROOT)
Daniel Dunbarb3a69012009-06-26 16:47:03 +000041
42
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000043install: $(INSTALL_TARGET)
44
Daniel Dunbar557a6ea2010-01-13 16:13:01 +000045# Copy results to DSTROOT.
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000046install-MacOSX : $(SYMROOT)/libcompiler_rt.dylib
Nick Kledzik1f7ee1d2010-03-31 20:38:57 +000047 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 Dunbarb3a69012009-06-26 16:47:03 +000053
Nick Kledzik1f7ee1d2010-03-31 20:38:57 +000054# 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 Kledzik3d407402011-03-05 02:15:16 +000057 $(CC.Release) $(OBJROOT)/version.c -arch $* -dynamiclib \
Nick Kledzik1f7ee1d2010-03-31 20:38:57 +000058 -install_name /usr/lib/system/libcompiler_rt.dylib \
59 -compatibility_version 1 -current_version $(RC_ProjectSourceVersion) \
60 -nodefaultlibs -lSystem -umbrella System -dead_strip \
Nick Kledzik3d407402011-03-05 02:15:16 +000061 $(LD_OTHER_FLAGS) -Wl,-force_load,$^ -o $@
Daniel Dunbarb3a69012009-06-26 16:47:03 +000062
Nick Kledzik1f7ee1d2010-03-31 20:38:57 +000063# Rule to make fat dylib
64$(SYMROOT)/libcompiler_rt.dylib: $(foreach arch,$(RC_ARCHS), \
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000065 $(OBJROOT)/libcompiler_rt-$(arch).dylib)
66 lipo -create $^ -o $@
67
68
69
70
71# Copy results to DSTROOT.
Nick Kledzik3d407402011-03-05 02:15:16 +000072install-iOS: $(SYMROOT)/libcompiler_rt-static.a \
73 $(SYMROOT)/libcompiler_rt.dylib
74 mkdir -p $(DSTROOT)/usr/local/lib
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000075 cp $(SYMROOT)/libcompiler_rt-static.a \
Nick Kledzikdc0b5592010-07-04 18:29:23 +000076 $(DSTROOT)/usr/local/lib/libcompiler_rt-static.a
Nick Kledzik3d407402011-03-05 02:15:16 +000077 mkdir -p $(DSTROOT)/usr/lib/system
78 strip -S $(SYMROOT)/libcompiler_rt.dylib \
79 -o $(DSTROOT)/usr/lib/system/libcompiler_rt.dylib
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000080
Nick Kledzikafb7b6e2010-04-21 22:46:53 +000081
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 Dunbar3c2a7762010-01-18 06:49:42 +000085 lipo -create $^ -o $@
Daniel Dunbarb3a69012009-06-26 16:47:03 +000086