3 .include <CoreOS/Standard/Commands.mk>
4 .include <CoreOS/Standard/Variables.mk>
6 NARCHS != $(ECHO) $(RC_ARCHS) | $(WC) -w
7 .ifdef ALTUSRLOCALLIBSYSTEM
8 LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
10 LIBSYS = $(SDKROOT)/usr/local/lib/system
12 NJOBS != $(PERL) -e '$$n = `$(SYSCTL) -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
13 BSDMAKEJ = $(BSDMAKE) -f Makefile -j $(NJOBS)
15 # These variables are to guarantee that the left-hand side of an expression is
21 .if !empty(FEATURE_DEBUG_DYLIB)
25 .if !empty(FEATURE_PROFILE_DYLIB)
31 build: build-debug build-dynamic build-profile
33 # These are the non B&I defaults
34 .ifndef RC_ProjectName
35 install: installhdrs install-all
37 .else # RC_ProjectName
40 install: BI-install-$(F)
42 .endif # RC_ProjectName
45 .if $(dynamic) == $(F)
50 LIPOARGS$(F) != $(PERL) -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/$$_/$(F)/$(NAME)$(SUFFIX$(F)).a\"), qw($(RC_ARCHS))))'
53 build-$(F): build-$(A)-$(F)
57 $(CP) "$(OBJROOT)/$(RC_ARCHS)/$(F)/$(NAME)$(SUFFIX$(F)).a" "$(SYMROOT)"
59 $(LIPO) -create $(LIPOARGS$(F)) -output "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a"
61 $(RANLIB) "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a"
64 build-$(A)-$(F): $(OBJROOT)/$(A)/libsystem.o
65 $(MKDIR) '$(OBJROOT)/$(A)/$(F)'
67 cd '$(OBJROOT)/$(A)/$(F)' && \
68 if $(LIPO) -info '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' | $(GREP) -q '^Non-'; then \
69 $(CP) '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' .; \
71 arch=`$(LIPO) -detailed_info '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' | $(SED) -E -n 's/.*architecture:? //p' | $(SORT) | $(GREP) '^$(A)' | $(HEAD) -n 1` && \
72 $(LIPO) -thin $$arch '$(LIBSYS)/$(NAME)-partial$(SUFFIX$(F)).a' -output '$(NAME)-partial$(SUFFIX$(F)).a'; \
74 $(AR) x '$(NAME)-partial$(SUFFIX$(F)).a' && \
75 if $(LIPO) -info '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' | $(GREP) -q '^Non-'; then \
76 $(CP) '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' .; \
78 arch=`$(LIPO) -detailed_info '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' | $(SED) -E -n 's/.*architecture:? //p' | $(SORT) | $(GREP) '^$(A)' | $(HEAD) -n 1` && \
79 $(LIPO) -thin $$arch '$(LIBSYS)/libsyscall$(SUFFIX$(F)).a' -output 'libsyscall$(SUFFIX$(F)).a'; \
81 $(AR) x 'libsyscall$(SUFFIX$(F)).a' && \
82 NM=$(NM) '$(SRCROOT)/libsys/build-libc.pl' '$(LIBSYS)' '$(OBJROOT)/$(A)/$(F)' && \
83 $(LN) -s ../libsystem.o && \
89 $(OBJROOT)/$(A)/libsystem.o: $(OBJROOT)/libsystem.c
90 $(MKDIR) '$(OBJROOT)/$(A)'
91 $(CC) -c -o '$(.TARGET)' -arch $(A) '$(.ALLSRC)'
94 $(OBJROOT)/libsystem.c:
95 $(SDKROOT)/Developer/Makefiles/bin/version.pl Libsystem > $(.TARGET)
100 BI-install-$(F): build-$(F)
101 $(MKDIR) "$(DSTROOT)/usr/local/lib/system"
102 @$(ECHO) "===== Installing $(NAME)$(SUFFIX$(F)).a ====="
103 $(INSTALL) "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a" "$(DSTROOT)/usr/local/lib/system"
104 $(RANLIB) "$(DSTROOT)/usr/local/lib/system/$(NAME)$(SUFFIX$(F)).a"
105 $(CHMOD) 0444 "$(DSTROOT)/usr/local/lib/system/$(NAME)$(SUFFIX$(F)).a"
110 install-all: BI-install-$(F)
114 .for A in $(RC_ARCHS)
115 $(RMDIR) $(OBJROOT)/$(A)