12 ifdef ALTUSRLOCALLIBSYSTEM
13 LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
15 LIBSYS = $(NEXT_ROOT)/usr/local/lib/system
17 NJOBS = $(shell perl -e '$$n = `/usr/sbin/sysctl -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)')
18 BSDMAKE = bsdmake -j $(NJOBS)
20 # Remove the arch stuff, since we know better here.
21 LOCAL_CFLAGS = $(filter-out -arch ppc -arch ppc64 -arch i386,$(RC_CFLAGS))
25 # These are the non B&I defaults
27 installhdrs: installhdrs-real
28 build: build-static build-profile build-debug build-dynamic
29 install: installhdrs install-all
32 # And these are to deal with B&I building libc differently
33 # based on RC_ProjectName.
34 ifeq ($(RC_ProjectName),Libc)
37 install: BI-install-dynamic
39 ifeq ($(RC_ProjectName),Libc_headers)
40 installhdrs: installhdrs-real
42 install: installhdrs-real
44 ifeq ($(RC_ProjectName),Libc_man)
49 ifeq ($(RC_ProjectName),Libc_static)
52 install: BI-install-static
54 ifeq ($(RC_ProjectName),Libc_debug)
57 install: BI-install-debug
59 ifeq ($(RC_ProjectName),Libc_profile)
62 install: BI-install-profile
65 # Because of 3780028, there are random failures on HFS because the
66 # CC_PRINT_OPTIONS_FILE can't be created. So we touch it first.
67 ifneq ($(CC_PRINT_OPTIONS_FILE),)
68 $(CC_PRINT_OPTIONS_FILE):
69 touch $(CC_PRINT_OPTIONS_FILE)
72 build-static: autopatch $(CC_PRINT_OPTIONS_FILE) build-ppc-static build-ppc64-static build-i386-static
73 @echo "Creating final libc_static.a"
74 ifeq ($(words $(RC_ARCHS)),1)
75 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc_static.a" "$(SYMROOT)"
78 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc_static.a") \
79 -output $(SYMROOT)/libc_static.a
81 build-profile: autopatch $(CC_PRINT_OPTIONS_FILE) build-ppc-profile build-ppc64-profile build-i386-profile
82 @echo "Creating final libc_profile.a"
83 ifeq ($(words $(RC_ARCHS)),1)
84 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc_profile.a" "$(SYMROOT)"
87 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc_profile.a") \
88 -output $(SYMROOT)/libc_profile.a
90 build-debug: autopatch $(CC_PRINT_OPTIONS_FILE) build-ppc-debug build-ppc64-debug build-i386-debug
91 @echo "Creating final libc_debug.a"
92 ifeq ($(words $(RC_ARCHS)),1)
93 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc_debug.a" "$(SYMROOT)"
96 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc_debug.a") \
97 -output $(SYMROOT)/libc_debug.a
99 build-dynamic: autopatch $(CC_PRINT_OPTIONS_FILE) build-ppc-dynamic build-ppc64-dynamic build-i386-dynamic
100 @echo "Creating final libc.a"
101 ifeq ($(words $(RC_ARCHS)),1)
102 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc.a" "$(SYMROOT)"
105 $(foreach A,$(RC_ARCHS),-arch $(A) "$(OBJROOT)/obj.$(A)/libc.a") \
106 -output $(SYMROOT)/libc.a
110 mkdir -p $(OBJROOT)/obj.ppc ; \
111 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
112 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a
116 mkdir -p $(OBJROOT)/obj.ppc64 ; \
117 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
118 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a
122 mkdir -p $(OBJROOT)/obj.i386 ; \
123 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
124 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a
128 mkdir -p $(OBJROOT)/obj.ppc ; \
129 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
130 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a
134 mkdir -p $(OBJROOT)/obj.ppc64 ; \
135 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
136 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a
140 mkdir -p $(OBJROOT)/obj.i386 ; \
141 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
142 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a
146 mkdir -p $(OBJROOT)/obj.ppc ; \
147 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
148 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a
152 mkdir -p $(OBJROOT)/obj.ppc64 ; \
153 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
154 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a
158 mkdir -p $(OBJROOT)/obj.i386 ; \
159 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
160 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a
164 mkdir -p $(OBJROOT)/obj.ppc ; \
165 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
166 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a
170 mkdir -p $(OBJROOT)/obj.ppc64 ; \
171 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
172 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a
176 mkdir -p $(OBJROOT)/obj.i386 ; \
177 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
178 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a
182 mkdir -p $(OBJROOT)/obj.ppc ; \
183 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
184 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) build
188 mkdir -p $(OBJROOT)/obj.ppc64 ; \
189 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
190 MAKEFLAGS="" CFLAGS="-arch ppc64 $(LOCAL_CFLAGS)" $(BSDMAKE) build
194 mkdir -p $(OBJROOT)/obj.i386 ; \
195 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
196 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) build
199 # We have to separately call bsdmake to patch the FreeBSD files, because of
200 # the way its cache works, it would otherwise pick a file in ${SYMROOT}, even
204 MACHINE_ARCH="i386" $(BSDMAKE) autopatch
207 MACHINE_ARCH="ppc" $(BSDMAKE) autopatch
210 MACHINE_ARCH="ppc64" $(BSDMAKE) autopatch
214 $(_v) pax -rw . "$(SRCROOT)"
216 installhdrs-real: $(CC_PRINT_OPTIONS_FILE)
217 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" MAKEFLAGS="" \
218 $(BSDMAKE) installhdrs
220 mkdir -p "$(OBJROOT)/obj.i386" ; \
221 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
222 MAKEFLAGS="" $(BSDMAKE) installhdrs-md
225 mkdir -p "$(OBJROOT)/obj.ppc" ; \
226 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
227 MAKEFLAGS="" $(BSDMAKE) installhdrs-md
230 mkdir -p "$(OBJROOT)/obj.ppc64" ; \
231 MAKEOBJDIR="$(OBJROOT)/obj.ppc64" MACHINE_ARCH="ppc64" \
232 MAKEFLAGS="" $(BSDMAKE) installhdrs-md
235 BI-install-static: build-static
236 mkdir -p $(DSTROOT)/usr/local/lib/system
237 if [ -f "$(SYMROOT)/libc_static.a" ]; then \
238 echo "Installing libc_static.a" ; \
239 install -c -m 444 "$(SYMROOT)/libc_static.a" \
240 $(DSTROOT)/usr/local/lib/system; \
241 ranlib "$(DSTROOT)/usr/local/lib/system/libc_static.a"; \
243 BI-install-profile: build-profile
244 mkdir -p $(DSTROOT)/usr/local/lib/system
245 if [ -f "$(SYMROOT)/libc_profile.a" ]; then \
246 echo "Installing libc_profile.a" ; \
247 install -c -m 444 "$(SYMROOT)/libc_profile.a" \
248 $(DSTROOT)/usr/local/lib/system; \
249 ranlib "$(DSTROOT)/usr/local/lib/system/libc_profile.a"; \
252 if [ -f "$(OBJROOT)/obj.ppc/libc-ldbl128_profile.a" ]; then \
253 echo "Installing libldbl128_profile.a" ; \
254 $(SRCROOT)/make_libldbl128 "$(OBJROOT)/obj.ppc/libc-ldbl128_profile.a" \
255 "_profile" "$(DSTROOT)/usr/local/lib/system" $(LIBSYS) ; \
258 BI-install-debug: build-debug
259 mkdir -p $(DSTROOT)/usr/local/lib/system
260 if [ -f "$(SYMROOT)/libc_debug.a" ]; then \
261 echo "Installing libc_debug.a" ; \
262 install -c -m 444 "$(SYMROOT)/libc_debug.a" \
263 $(DSTROOT)/usr/local/lib/system; \
264 ranlib "$(DSTROOT)/usr/local/lib/system/libc_debug.a"; \
267 if [ -f "$(OBJROOT)/obj.ppc/libc-ldbl128_debug.a" ]; then \
268 echo "Installing libldbl128_debug.a" ; \
269 $(SRCROOT)/make_libldbl128 "$(OBJROOT)/obj.ppc/libc-ldbl128_debug.a" \
270 "_debug" "$(DSTROOT)/usr/local/lib/system" $(LIBSYS) ; \
273 BI-install-dynamic: build-dynamic
274 mkdir -p $(DSTROOT)/usr/local/lib/system
275 if [ -f "$(SYMROOT)/libc.a" ]; then \
276 echo "Installing libc.a" ; \
277 install -c -m 444 "$(SYMROOT)/libc.a" \
278 $(DSTROOT)/usr/local/lib/system; \
279 ranlib "$(DSTROOT)/usr/local/lib/system/libc.a"; \
282 if [ -f "$(OBJROOT)/obj.ppc/libc-ldbl128.a" ]; then \
283 echo "Installing libldbl128.a" ; \
284 $(SRCROOT)/make_libldbl128 "$(OBJROOT)/obj.ppc/libc-ldbl128.a" \
285 "" "$(DSTROOT)/usr/local/lib/system" $(LIBSYS) ; \
289 # Don't use -j here; it may try to make links before the files are copied
291 mkdir -p $(DSTROOT)/usr/share/man/man2
292 mkdir -p $(DSTROOT)/usr/share/man/man3
293 mkdir -p $(DSTROOT)/usr/share/man/man4
294 mkdir -p $(DSTROOT)/usr/share/man/man5
295 mkdir -p $(DSTROOT)/usr/share/man/man7
296 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" NOMANCOMPRESS=1 \
297 MACHINE_ARCH="$(shell arch)" MAKEFLAGS="" bsdmake autopatchman maninstall
299 install-all: build install-man BI-install-dynamic BI-install-static BI-install-profile BI-install-debug
302 rm -rf $(OBJROOT)/obj.ppc $(OBJROOT)/obj.i386 $(OBJROOT)/libc.a \
303 $(OBJROOT)/libc_static.a $(OBJROOT)/libc_debug.a \
304 $(OBJROOT)/libc_profile.a