2 NAME = $(NAME0).$(VersionLetter)
4 # for now, use the default compiler
6 GCCLIBS = -lgcc -lgcc_eh
7 NARCHS != echo $(RC_ARCHS) | wc -w
8 .ifdef ALTUSRLOCALLIBSYSTEM
9 LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
11 LIBSYS = $(SDKROOT)/usr/local/lib/system
13 SLFS_F_PH = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
15 SDKROOTCFLAGS = -isysroot '$(SDKROOT)'
16 SDKROOTLDFLAGS = -syslibroot '$(SDKROOT)'
18 .if !empty(FEATURE_ORDER_FILE)
19 ORDERFILES = -Wl,-order_file,$(SRCROOT)/SystemInit.order -Wl,-order_file,$(SRCROOT)/System.order
21 LIBS = -lc -lcommonCrypto -ldyldapis\
22 -linfo -ldns_sd -lm -lmacho\
23 -lnotify -lkeymgr -llaunch \
24 -lcopyfile -lsandbox -lremovefile
25 CONDITIONALLIBS = unc quarantine
26 .for L in $(CONDITIONALLIBS)
27 # the following should be replaced with tconf when 5784037 is complete
28 .if exists($(LIBSYS)/lib$(L).a)
31 .endfor # CONDITIONALLIBS
33 # These variables are to guarantee that the left-hand side of an expression is
39 build: build-debug build-dynamic build-profile
41 # These are the non B&I defaults
42 .ifndef RC_ProjectName
43 install: installhdrs install-all
45 .else # RC_ProjectName
48 install: BI-install-$(F)
50 .endif # RC_ProjectName
53 OBJS-$(A) = $(OBJROOT)/$(A)/SystemMath.o $(OBJROOT)/$(A)/System_vers.o
57 .if $(dynamic) == $(F)
62 .if !empty(FEATURE_LIBMATHCOMMON)
63 LIBMATHCOMMON$(F) = -L/usr/lib/system -sub_library libmathCommon$(SUFFIX$(F)) -lmathCommon$(SUFFIX$(F))
65 LIPOARGS$(F) != perl -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/$$_/$(F)/$(NAME)$(SUFFIX$(F)).dylib\"), qw($(RC_ARCHS))))'
68 build-$(F): build-$(A)-$(F)
72 cp -p "$(OBJROOT)/$(RC_ARCHS)/$(F)/$(NAME)$(SUFFIX$(F)).dylib" "$(SYMROOT)"
74 lipo -create $(LIPOARGS$(F)) -output "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).dylib"
76 dsymutil "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).dylib"
79 build-$(A)-$(F): $(OBJROOT)/$(A)/$(F) $(OBJROOT)/$(A)/CommPageSymbols.o $(OBJS-$(A))
80 $(GCC) -dynamiclib -arch $(A) -pipe \
81 -o '$(OBJROOT)/$(A)/$(F)/$(NAME)$(SUFFIX$(F)).dylib' \
82 -compatibility_version 1 -current_version $(Version) \
83 -install_name /usr/lib/$(NAME)$(SUFFIX$(F)).dylib \
84 -nodefaultlibs -all_load -multi_module -Wl,-search_paths_first \
85 -segcreate __DATA __commpage $(OBJROOT)/$(A)/CommPageSymbols.o \
86 $(ORDERFILES) $(SKDROOTLDFLAGS) $(OBJS-$(A)) \
87 -L$(DSTROOT)/usr/local/lib/system -L$(LIBSYS) $(LIBMATHCOMMON$(F)) \
88 $(LIBS:C/$/$(SUFFIX$(F))/) $(GCCLIBS)
96 SEG1ADDR_i386 = 0xffff0000
97 SEG1ADDR_ppc = 0xffff8000
98 SEG1ADDR_ppc64 = 0xffffffffffff8000
99 SEG1ADDR_x86_64 = 0x00007fffffe00000
100 SEG1ADDR_arm = 0xffff8000
102 CFLAGS = -g -Os -Wall -Werror -I'$(SLFS_F_PH)' -fno-common $(SDKROOTCFLAGS)
104 $(OBJROOT)/System_vers.c:
105 vers_string -c System | \
106 sed -e 's/SGS_VERS/SYSTEM_VERS_STRING/' -e 's/VERS_NUM/SYSTEM_VERS_NUM/' > $(.TARGET)
108 .for A in $(RC_ARCHS)
109 $(OBJROOT)/$(A)/CommPageSymbols.o: $(SRCROOT)/CommPageSymbols.st
110 $(GCC) -c -o '$(.TARGET:R)_intermediate.$(.TARGET:E)' -arch $(A) -x assembler-with-cpp $(CFLAGS) '$(.ALLSRC)'
111 ld -arch $(A) -r -seg1addr $(SEG1ADDR_$(A:C/^armv.*$/arm/)) '$(.TARGET:R)_intermediate.$(.TARGET:E)' -o '$(.TARGET)'
113 $(OBJROOT)/$(A)/SystemMath.o: $(SRCROOT)/SystemMath.s
114 $(GCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
116 $(OBJROOT)/$(A)/System_vers.o: $(OBJROOT)/System_vers.c
117 $(GCC) -c -o '$(.TARGET)' -arch $(A) $(CFLAGS) '$(.ALLSRC)'
124 BI-install-$(F): build-$(F)
125 mkdir -p "$(DSTROOT)/usr/lib"
126 @echo "===== Installing $(NAME)$(SUFFIX$(F)).dylib ====="
127 install "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).dylib" "$(DSTROOT)/usr/lib"
128 strip -S "$(DSTROOT)/usr/lib/$(NAME)$(SUFFIX$(F)).dylib"
129 chmod a-w "$(DSTROOT)/usr/lib/$(NAME)$(SUFFIX$(F)).dylib"
130 ln -sf "$(NAME)$(SUFFIX$(F)).dylib" "$(DSTROOT)/usr/lib/$(NAME0)$(SUFFIX$(F)).dylib"
135 install-all: BI-install-$(F)
139 .for A in $(RC_ARCHS)
140 rm -rf $(OBJROOT)/$(A)