]> git.saurik.com Git - apple/libsystem.git/blame_incremental - libsys/Makefile
Libsystem-124.1.1.tar.gz
[apple/libsystem.git] / libsys / Makefile
... / ...
CommitLineData
1NAME = libc
2
3.include <CoreOS/Standard/Commands.mk>
4.include <CoreOS/Standard/Variables.mk>
5
6NARCHS != $(ECHO) $(RC_ARCHS) | $(WC) -w
7.ifdef ALTUSRLOCALLIBSYSTEM
8LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
9.else
10LIBSYS = $(SDKROOT)/usr/local/lib/system
11.endif
12NJOBS != $(PERL) -e '$$n = `$(SYSCTL) -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
13BSDMAKEJ = $(BSDMAKE) -f Makefile -j $(NJOBS)
14
15# These variables are to guarantee that the left-hand side of an expression is
16# always a variable
17dynamic = dynamic
18
19FORMS := dynamic
20
21.if !empty(FEATURE_DEBUG_DYLIB)
22FORMS += debug
23.endif
24
25.if !empty(FEATURE_PROFILE_DYLIB)
26FORMS += profile
27.endif
28
29all: build
30
31build: build-debug build-dynamic build-profile
32
33# These are the non B&I defaults
34.ifndef RC_ProjectName
35install: installhdrs install-all
36
37.else # RC_ProjectName
38
39.for F in $(FORMS)
40install: BI-install-$(F)
41.endfor # FORMS
42.endif # RC_ProjectName
43
44.for F in $(FORMS)
45.if $(dynamic) == $(F)
46SUFFIX$(F) =
47.else
48SUFFIX$(F) = _$(F)
49.endif
50LIPOARGS$(F) != $(PERL) -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/$$_/$(F)/$(NAME)$(SUFFIX$(F)).a\"), qw($(RC_ARCHS))))'
51
52.for A in $(RC_ARCHS)
53build-$(F): build-$(A)-$(F)
54.endfor # RC_ARCHS
55build-$(F):
56.if $(NARCHS) == 1
57 $(CP) "$(OBJROOT)/$(RC_ARCHS)/$(F)/$(NAME)$(SUFFIX$(F)).a" "$(SYMROOT)"
58.else
59 $(LIPO) -create $(LIPOARGS$(F)) -output "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a"
60.endif
61 $(RANLIB) "$(SYMROOT)/$(NAME)$(SUFFIX$(F)).a"
62
63.for A in $(RC_ARCHS)
64build-$(A)-$(F): $(OBJROOT)/$(A)/libsystem.o
65 $(MKDIR) '$(OBJROOT)/$(A)/$(F)'
66 @set -x && \
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' .; \
70 else \
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'; \
73 fi && \
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' .; \
77 else \
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'; \
80 fi && \
81 $(AR) x 'libsyscall$(SUFFIX$(F)).a' && \
82 NM=$(NM) '$(SRCROOT)/libsys/build-libc.pl' '$(LIBSYS)' '$(OBJROOT)/$(A)/$(F)' && \
83 $(LN) -s ../libsystem.o && \
84 $(BSDMAKEJ)
85.endfor # RC_ARCHS
86.endfor # FORMS
87
88.for A in $(RC_ARCHS)
89$(OBJROOT)/$(A)/libsystem.o: $(OBJROOT)/libsystem.c
90 $(MKDIR) '$(OBJROOT)/$(A)'
91 $(CC) -c -o '$(.TARGET)' -arch $(A) '$(.ALLSRC)'
92.endfor # RC_ARCHS
93
94$(OBJROOT)/libsystem.c:
95 $(SDKROOT)/Developer/Makefiles/bin/version.pl Libsystem > $(.TARGET)
96
97installhdrs:
98
99.for F in $(FORMS)
100BI-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"
106.endfor # FORMS
107
108install-all: build
109.for F in $(FORMS)
110install-all: BI-install-$(F)
111.endfor # FORMS
112
113clean:
114.for A in $(RC_ARCHS)
115 $(RMDIR) $(OBJROOT)/$(A)
116.endfor # RC_ARCHS