12 # temporary disable multi-threaded builds, which are failing; see 3683272
13 #BSDMAKE = bsdmake -j 2
16 # Remove the arch stuff, since we know better here.
17 LOCAL_CFLAGS = $(filter-out -arch ppc -arch ppc64 -arch i386,$(RC_CFLAGS))
21 # These are the non B&I defaults
23 installhdrs: installhdrs-real
24 build: build-static build-profile build-debug build-dynamic
25 install: installhdrs install-all
28 # And these are to deal with B&I building libc differently
29 # based on RC_ProjectName.
30 ifeq ($(RC_ProjectName),Libc)
33 install: BI-install-dynamic
35 ifeq ($(RC_ProjectName),Libc_headers)
36 installhdrs: installhdrs-real
38 install: installhdrs-real
40 ifeq ($(RC_ProjectName),Libc_man)
45 ifeq ($(RC_ProjectName),Libc_static)
48 install: BI-install-static
50 ifeq ($(RC_ProjectName),Libc_debug)
53 install: BI-install-debug
55 ifeq ($(RC_ProjectName),Libc_profile)
58 install: BI-install-profile
61 build-static: autopatch build-ppc-static build-ppc64-static build-i386-static
62 @echo "Creating final libc_static.a"
63 ifeq ($(words $(RC_ARCHS)),1)
64 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc_static.a" "$(SYMROOT)"
67 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc_static.a") \
68 -output $(SYMROOT)/libc_static.a
70 build-profile: autopatch build-ppc-profile build-ppc64-profile build-i386-profile
71 @echo "Creating final libc_profile.a"
72 ifeq ($(words $(RC_ARCHS)),1)
73 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc_profile.a" "$(SYMROOT)"
76 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc_profile.a") \
77 -output $(SYMROOT)/libc_profile.a
79 build-debug: autopatch build-ppc-debug build-ppc64-debug build-i386-debug
80 @echo "Creating final libc_debug.a"
81 ifeq ($(words $(RC_ARCHS)),1)
82 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc_debug.a" "$(SYMROOT)"
85 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc_debug.a") \
86 -output $(SYMROOT)/libc_debug.a
88 build-dynamic: autopatch build-ppc-dynamic build-ppc64-dynamic build-i386-dynamic
89 @echo "Creating final libc.a"
90 ifeq ($(words $(RC_ARCHS)),1)
91 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc.a" "$(SYMROOT)"
94 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc.a") \
95 -output $(SYMROOT)/libc.a
98 @if [ ! -z "$(RC_ppc)" ]; then \
99 mkdir -p $(OBJROOT)/obj.ppc ; \
100 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
101 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a;\
104 @if [ ! -z "$(RC_ppc64)" ]; then \
105 mkdir -p $(OBJROOT)/obj.ppc64 ; \
106 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
107 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a;\
110 @if [ ! -z "$(RC_i386)" ]; then \
111 mkdir -p $(OBJROOT)/obj.i386 ; \
112 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
113 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a;\
116 @if [ ! -z "$(RC_ppc)" ]; then \
117 mkdir -p $(OBJROOT)/obj.ppc ; \
118 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
119 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a;\
122 @if [ ! -z "$(RC_ppc64)" ]; then \
123 mkdir -p $(OBJROOT)/obj.ppc64 ; \
124 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
125 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a;\
128 @if [ ! -z "$(RC_i386)" ]; then \
129 mkdir -p $(OBJROOT)/obj.i386 ; \
130 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
131 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a;\
134 @if [ ! -z "$(RC_ppc)" ]; then \
135 mkdir -p $(OBJROOT)/obj.ppc ; \
136 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
137 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a;\
140 @if [ ! -z "$(RC_ppc64)" ]; then \
141 mkdir -p $(OBJROOT)/obj.ppc64 ; \
142 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
143 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a;\
146 @if [ ! -z "$(RC_i386)" ]; then \
147 mkdir -p $(OBJROOT)/obj.i386 ; \
148 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
149 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a;\
152 @if [ ! -z "$(RC_ppc)" ]; then \
153 mkdir -p $(OBJROOT)/obj.ppc ; \
154 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
155 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a;\
158 @if [ ! -z "$(RC_ppc64)" ]; then \
159 mkdir -p $(OBJROOT)/obj.ppc64 ; \
160 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
161 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a;\
164 @if [ ! -z "$(RC_i386)" ]; then \
165 mkdir -p $(OBJROOT)/obj.i386 ; \
166 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
167 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a;\
171 @if [ ! -z "$(RC_ppc)" ]; then \
172 mkdir -p $(OBJROOT)/obj.ppc ; \
173 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
174 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) build;\
177 @if [ ! -z "$(RC_ppc64)" ]; then \
178 mkdir -p $(OBJROOT)/obj.ppc64 ; \
179 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
180 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) build;\
183 @if [ ! -z "$(RC_i386)" ]; then \
184 mkdir -p $(OBJROOT)/obj.i386 ; \
185 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
186 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) build;\
189 # We have to separately call bsdmake to patch the FreeBSD files, because of
190 # the way its cache works, it would otherwise pick a file in ${SYMROOT}, even
193 @if [ ! -z "$(RC_i386)" ]; then \
194 MACHINE_ARCH="i386" $(BSDMAKE) autopatch; \
196 @if [ ! -z "$(RC_ppc)" ]; then \
197 MACHINE_ARCH="ppc" $(BSDMAKE) autopatch; \
199 @if [ ! -z "$(RC_ppc64)" ]; then \
200 MACHINE_ARCH="ppc64" $(BSDMAKE) autopatch; \
204 $(_v) pax -rw . "$(SRCROOT)"
207 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" MAKEFLAGS="" \
208 $(BSDMAKE) installhdrs
209 @if [ ! -z "$(RC_i386)" ]; then \
210 mkdir -p "$(OBJROOT)/obj.i386" ; \
211 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
212 MAKEFLAGS="" $(BSDMAKE) installhdrs-md ; \
214 @if [ ! -z "$(RC_ppc)" ]; then \
215 mkdir -p "$(OBJROOT)/obj.ppc" ; \
216 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
217 MAKEFLAGS="" $(BSDMAKE) installhdrs-md ; \
219 @if [ ! -z "$(RC_ppc64)" ]; then \
220 mkdir -p "$(OBJROOT)/obj.ppc64" ; \
221 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
222 MAKEFLAGS="" $(BSDMAKE) installhdrs-md ; \
225 BI-install-static: build-static
226 mkdir -p $(DSTROOT)/usr/local/lib/system
227 if [ -f "$(SYMROOT)/libc_static.a" ]; then \
228 echo "Installing libc_static.a" ; \
229 install -c -m 444 "$(SYMROOT)/libc_static.a" \
230 $(DSTROOT)/usr/local/lib/system; \
231 ranlib "$(DSTROOT)/usr/local/lib/system/libc_static.a"; \
233 BI-install-profile: build-profile
234 mkdir -p $(DSTROOT)/usr/local/lib/system
235 if [ -f "$(SYMROOT)/libc_profile.a" ]; then \
236 echo "Installing libc_profile.a" ; \
237 install -c -m 444 "$(SYMROOT)/libc_profile.a" \
238 $(DSTROOT)/usr/local/lib/system; \
239 ranlib "$(DSTROOT)/usr/local/lib/system/libc_profile.a"; \
241 BI-install-debug: build-debug
242 mkdir -p $(DSTROOT)/usr/local/lib/system
243 if [ -f "$(SYMROOT)/libc_debug.a" ]; then \
244 echo "Installing libc_debug.a" ; \
245 install -c -m 444 "$(SYMROOT)/libc_debug.a" \
246 $(DSTROOT)/usr/local/lib/system; \
247 ranlib "$(DSTROOT)/usr/local/lib/system/libc_debug.a"; \
249 BI-install-dynamic: build-dynamic
250 mkdir -p $(DSTROOT)/usr/local/lib/system
251 if [ -f "$(SYMROOT)/libc.a" ]; then \
252 echo "Installing libc.a" ; \
253 install -c -m 444 "$(SYMROOT)/libc.a" \
254 $(DSTROOT)/usr/local/lib/system; \
255 ranlib "$(DSTROOT)/usr/local/lib/system/libc.a"; \
258 # Don't use -j here; it may try to make links before the files are copied
260 mkdir -p $(DSTROOT)/usr/share/man/man2
261 mkdir -p $(DSTROOT)/usr/share/man/man3
262 mkdir -p $(DSTROOT)/usr/share/man/man4
263 mkdir -p $(DSTROOT)/usr/share/man/man5
264 mkdir -p $(DSTROOT)/usr/share/man/man7
265 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" NOMANCOMPRESS=1 \
266 MACHINE_ARCH="$(shell arch)" MAKEFLAGS="" bsdmake autopatchman maninstall
268 install-all: build install-man BI-install-dynamic BI-install-static BI-install-profile BI-install-debug
271 rm -rf $(OBJROOT)/obj.ppc $(OBJROOT)/obj.i386 $(OBJROOT)/libc.a \
272 $(OBJROOT)/libc_static.a $(OBJROOT)/libc_debug.a \
273 $(OBJROOT)/libc_profile.a