12 NARCHS != echo $(RC_ARCHS) | wc -w
13 .ifdef ALTUSRLOCALLIBSYSTEM
14 LIBSYS = $(ALTUSRLOCALLIBSYSTEM)
16 LIBSYS = $(NEXT_ROOT)/usr/local/lib/system
18 NJOBS != perl -e '$$n = `/usr/sbin/sysctl -n hw.ncpu`; printf "%d\n", $$n < 2 ? 2 : ($$n * 1.5)'
19 BSDMAKE = bsdmake -f Makefile
20 #BSDMAKEJ = $(BSDMAKE) -j $(NJOBS)
21 BSDMAKEJ = $(BSDMAKE) -j $(NJOBS) -P
23 # This variables are to guarantee that the left-hand side of an expression is
28 # Remove the arch stuff, since we know better here.
29 LOCAL_CFLAGS != echo $(RC_CFLAGS) | sed 's/ *-arch [^ ][^ ]*//g'
31 FORMS := dynamic debug profile static
35 # These are the non B&I defaults
36 .ifndef RC_ProjectName
37 installhdrs: installhdrs-real
38 build: build-static build-profile build-debug build-dynamic
39 install: installhdrs install-all
41 .else # RC_ProjectName
43 # And these are to deal with B&I building libc differently
44 # based on RC_ProjectName.
45 .if $(RC_ProjectName) == Libc
48 install: BI-install-dynamic
50 .if $(RC_ProjectName) == Libc_headers
51 installhdrs: installhdrs-real
53 install: installhdrs-real
55 .if $(RC_ProjectName) == Libc_man
60 .if $(RC_ProjectName) == Libc_static
63 install: BI-install-static
65 .if $(RC_ProjectName) == Libc_debug
68 install: BI-install-debug
70 .if $(RC_ProjectName) == Libc_profile
73 install: BI-install-profile
75 .endif # RC_ProjectName
77 # Because of 3780028, there are random failures on HFS because the
78 # CC_PRINT_OPTIONS_FILE can't be created. So we touch it first.
79 .if !empty $(CC_PRINT_OPTIONS_FILE)
80 $(CC_PRINT_OPTIONS_FILE):
81 touch $(CC_PRINT_OPTIONS_FILE)
82 .endif # CC_PRINT_OPTIONS_FILE
85 .if $(dynamic) == $(F)
90 LIPOARGS$(F) != perl -e 'printf "%s\n", join(" ", map(qq(-arch $$_ \"$(OBJROOT)/obj.$$_/libc$(SUFFIX$(F)).a\"), qw($(RC_ARCHS))))'
92 build-$(F): autopatch $(CC_PRINT_OPTIONS_FILE)
94 build-$(F): build-$(A)-$(F)
98 cp -p "$(OBJROOT)/obj.$(RC_ARCHS)/libc$(SUFFIX$(F)).a" "$(SYMROOT)"
100 lipo -create $(LIPOARGS$(F)) -output $(SYMROOT)/libc$(SUFFIX$(F)).a
103 .for A in $(RC_ARCHS)
105 mkdir -p $(OBJROOT)/obj.$(A) && \
106 MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
107 MAKEFLAGS="" CFLAGS="-arch $(A) $(LOCAL_CFLAGS)" $(BSDMAKEJ) libc$(SUFFIX$(F)).a
111 # We have to separately call bsdmake to patch the FreeBSD files, because of
112 # the way its cache works, it would otherwise pick A file in ${SYMROOT}, even
115 .for A in $(RC_ARCHS)
116 MACHINE_ARCH="$(A)" $(BSDMAKEJ) autopatch
120 pax -rw . "$(SRCROOT)"
122 installhdrs-real: $(CC_PRINT_OPTIONS_FILE)
123 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" MAKEFLAGS="" \
124 $(BSDMAKEJ) installhdrs
125 .for A in $(RC_ARCHS)
126 mkdir -p "$(OBJROOT)/obj.$(A)" && \
127 MAKEOBJDIR="$(OBJROOT)/obj.$(A)" MACHINE_ARCH="$(A)" \
128 MAKEFLAGS="" $(BSDMAKEJ) installhdrs-md
132 BI-install-$(F): build-$(F)
133 mkdir -p $(DSTROOT)/usr/local/lib/system
134 if [ -f "$(SYMROOT)/libc$(SUFFIX$(F)).a" ]; then \
135 echo "Installing libc$(SUFFIX$(F)).a" && \
136 install -c -m 444 "$(SYMROOT)/libc$(SUFFIX$(F)).a" \
137 $(DSTROOT)/usr/local/lib/system && \
138 ranlib "$(DSTROOT)/usr/local/lib/system/libc$(SUFFIX$(F)).a"; \
140 .if !empty $(RC_ppc) && ($(static) != $(F))
141 if [ -f "$(OBJROOT)/obj.ppc/libc-ldbl128$(SUFFIX$(F)).a" ]; then \
142 echo "Installing libldbl128$(SUFFIX$(F)).a" ; \
143 $(SRCROOT)/make_libldbl128 "$(OBJROOT)/obj.ppc/libc-ldbl128$(SUFFIX$(F)).a" \
144 "$(SUFFIX$(F))" "$(DSTROOT)/usr/local/lib/system" $(LIBSYS) ; \
146 .endif # RC_ppc && !static
149 # Don't use -j here; it may try to make links before the files are copied
151 mkdir -p $(DSTROOT)/usr/share/man/man2
152 mkdir -p $(DSTROOT)/usr/share/man/man3
153 mkdir -p $(DSTROOT)/usr/share/man/man4
154 mkdir -p $(DSTROOT)/usr/share/man/man5
155 mkdir -p $(DSTROOT)/usr/share/man/man7
156 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" NOMANCOMPRESS=1 \
157 MACHINE_ARCH="$(ARCH)" MAKEFLAGS="" $(BSDMAKE) autopatchman maninstall
159 install-all: build install-man
161 install-all: BI-install-$(F)
166 rm -f $(OBJROOT)/libc$(SUFFIX$(F)).a
168 .for A in $(RC_ARCHS)
169 rm -rf $(OBJROOT)/obj.$(A)