13 BSDMAKE = bsdmake -j 2
15 # Remove the arch stuff, since we know better here.
16 LOCAL_CFLAGS = $(filter-out -arch ppc -arch i386,$(RC_CFLAGS))
19 # These are the non B&I defaults
21 installhdrs: installhdrs-real
22 build: build-static build-profile build-debug build-dynamic
23 install: installhdrs install-all
26 # And these are to deal with B&I building libc differently
27 # based on RC_ProjectName.
28 ifeq ($(RC_ProjectName),Libc)
29 installhdrs: installhdrs-real
30 build: build-man build-dynamic
31 install: installhdrs-real BI-install-dynamic install-man
33 ifeq ($(RC_ProjectName),Libc_static)
36 install: BI-install-static
38 ifeq ($(RC_ProjectName),Libc_debug)
41 install: BI-install-debug
43 ifeq ($(RC_ProjectName),Libc_profile)
46 install: BI-install-profile
50 MAKEOBJDIR="$(OBJROOT)" MACHINE_ARCH="$(shell arch)" \
51 MAKEFLAGS="" $(BSDMAKE) buildman
52 build-static: build-ppc-static build-i386-static
53 @echo "Checking for libc_static.a"
54 @if [ -f "$(OBJROOT)/obj.ppc/libc_static.a" -a -f "$(OBJROOT)/obj.i386/libc_static.a" ]; then\
55 lipo -create -arch ppc "$(OBJROOT)/obj.ppc/libc_static.a" \
56 -arch i386 "$(OBJROOT)/obj.i386/libc_static.a" \
57 -output $(SYMROOT)/libc_static.a;\
58 elif [ -f "$(OBJROOT)/obj.ppc/libc_static.a" ]; then \
59 cp -p "$(OBJROOT)/obj.ppc/libc_static.a" "$(SYMROOT)"; \
60 elif [ -f "$(OBJROOT)/obj.i386/libc_static.a" ]; then \
61 cp -p "$(OBJROOT)/obj.i386/libc_static.a" "$(SYMROOT)"; \
63 build-profile: build-ppc-profile build-i386-profile
64 @echo "Checking for libc_profile.a"
65 @if [ -f "$(OBJROOT)/obj.ppc/libc_profile.a" -a -f "$(OBJROOT)/obj.i386/libc_profile.a" ]; then\
66 lipo -create -arch ppc "$(OBJROOT)/obj.ppc/libc_profile.a" \
67 -arch i386 "$(OBJROOT)/obj.i386/libc_profile.a" \
68 -output $(SYMROOT)/libc_profile.a;\
69 elif [ -f "$(OBJROOT)/obj.ppc/libc_profile.a" ]; then \
70 cp -p "$(OBJROOT)/obj.ppc/libc_profile.a" "$(SYMROOT)"; \
71 elif [ -f "$(OBJROOT)/obj.i386/libc_profile.a" ]; then \
72 cp -p "$(OBJROOT)/obj.i386/libc_profile.a" "$(SYMROOT)"; \
74 build-debug: build-ppc-debug build-i386-debug
75 @echo "Checking for libc_debug.a"
76 @if [ -f "$(OBJROOT)/obj.ppc/libc_debug.a" -a -f "$(OBJROOT)/obj.i386/libc_debug.a" ]; then\
77 lipo -create -arch ppc "$(OBJROOT)/obj.ppc/libc_debug.a" \
78 -arch i386 "$(OBJROOT)/obj.i386/libc_debug.a" \
79 -output $(SYMROOT)/libc_debug.a;\
80 elif [ -f "$(OBJROOT)/obj.ppc/libc_debug.a" ]; then \
81 cp -p "$(OBJROOT)/obj.ppc/libc_debug.a" "$(SYMROOT)"; \
82 elif [ -f "$(OBJROOT)/obj.i386/libc_debug.a" ]; then \
83 cp -p "$(OBJROOT)/obj.i386/libc_debug.a" "$(SYMROOT)"; \
85 build-dynamic: build-ppc-dynamic build-i386-dynamic
86 @echo "Checking for libc.a"
87 @if [ -f "$(OBJROOT)/obj.ppc/libc.a" -a -f "$(OBJROOT)/obj.i386/libc.a" ]; then\
88 echo "Creating FAT libc.a"; \
89 lipo -create -arch ppc "$(OBJROOT)/obj.ppc/libc.a" -arch i386 \
90 "$(OBJROOT)/obj.i386/libc.a" -output $(SYMROOT)/libc.a;\
91 elif [ -f "$(OBJROOT)/obj.ppc/libc.a" ]; then \
92 echo "Using thin PPC libc.a" ;\
93 cp -p "$(OBJROOT)/obj.ppc/libc.a" "$(SYMROOT)"; \
94 elif [ -f "$(OBJROOT)/obj.i386/libc.a" ]; then \
95 echo "Using thin i386 libc.a" ;\
96 cp -p "$(OBJROOT)/obj.i386/libc.a" "$(SYMROOT)"; \
99 @if [ ! -z "$(RC_ppc)" ]; then \
100 mkdir -p $(OBJROOT)/obj.ppc ; \
101 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
102 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a;\
105 @if [ ! -z "$(RC_i386)" ]; then \
106 mkdir -p $(OBJROOT)/obj.i386 ; \
107 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
108 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_static.a;\
111 @if [ ! -z "$(RC_ppc)" ]; then \
112 mkdir -p $(OBJROOT)/obj.ppc ; \
113 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
114 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a;\
117 @if [ ! -z "$(RC_i386)" ]; then \
118 mkdir -p $(OBJROOT)/obj.i386 ; \
119 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
120 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_profile.a;\
123 @if [ ! -z "$(RC_ppc)" ]; then \
124 mkdir -p $(OBJROOT)/obj.ppc ; \
125 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
126 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a;\
129 @if [ ! -z "$(RC_i386)" ]; then \
130 mkdir -p $(OBJROOT)/obj.i386 ; \
131 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
132 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc_debug.a;\
135 @if [ ! -z "$(RC_ppc)" ]; then \
136 mkdir -p $(OBJROOT)/obj.ppc ; \
137 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
138 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a;\
141 @if [ ! -z "$(RC_i386)" ]; then \
142 mkdir -p $(OBJROOT)/obj.i386 ; \
143 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
144 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) libc.a;\
148 @if [ ! -z "$(RC_ppc)" ]; then \
149 mkdir -p $(OBJROOT)/obj.ppc ; \
150 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
151 MAKEFLAGS="" CFLAGS="-arch ppc $(LOCAL_CFLAGS)" $(BSDMAKE) build;\
154 @if [ ! -z "$(RC_i386)" ]; then \
155 mkdir -p $(OBJROOT)/obj.i386 ; \
156 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
157 MAKEFLAGS="" CFLAGS="-arch i386 $(LOCAL_CFLAGS)" $(BSDMAKE) build;\
160 $(_v) pax -rw . "$(SRCROOT)"
163 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" MAKEFLAGS="" \
164 $(BSDMAKE) installhdrs
165 @if [ ! -z "$(RC_i386)" ]; then \
166 mkdir -p "$(OBJROOT)/obj.i386" ; \
167 MAKEOBJDIR="$(OBJROOT)/obj.i386" MACHINE_ARCH="i386" \
168 MAKEFLAGS="" $(BSDMAKE) installhdrs-md ; \
170 @if [ ! -z "$(RC_ppc)" ]; then \
171 mkdir -p "$(OBJROOT)/obj.ppc" ; \
172 MAKEOBJDIR="$(OBJROOT)/obj.ppc" MACHINE_ARCH="ppc" \
173 MAKEFLAGS="" $(BSDMAKE) installhdrs-md ; \
176 BI-install-static: build-static
177 mkdir -p $(DSTROOT)/usr/local/lib/system
178 if [ -f "$(SYMROOT)/libc_static.a" ]; then \
179 echo "Installing libc_static.a" ; \
180 install -c -m 444 "$(SYMROOT)/libc_static.a" \
181 $(DSTROOT)/usr/local/lib/system; \
182 ranlib "$(DSTROOT)/usr/local/lib/system/libc_static.a"; \
184 BI-install-profile: build-profile
185 mkdir -p $(DSTROOT)/usr/local/lib/system
186 if [ -f "$(SYMROOT)/libc_profile.a" ]; then \
187 echo "Installing libc_profile.a" ; \
188 install -c -m 444 "$(SYMROOT)/libc_profile.a" \
189 $(DSTROOT)/usr/local/lib/system; \
190 ranlib "$(DSTROOT)/usr/local/lib/system/libc_profile.a"; \
192 BI-install-debug: build-debug
193 mkdir -p $(DSTROOT)/usr/local/lib/system
194 if [ -f "$(SYMROOT)/libc_debug.a" ]; then \
195 echo "Installing libc_debug.a" ; \
196 install -c -m 444 "$(SYMROOT)/libc_debug.a" \
197 $(DSTROOT)/usr/local/lib/system; \
198 ranlib "$(DSTROOT)/usr/local/lib/system/libc_debug.a"; \
200 BI-install-dynamic: build-dynamic
201 mkdir -p $(DSTROOT)/usr/local/lib/system
202 if [ -f "$(SYMROOT)/libc.a" ]; then \
203 echo "Installing libc.a" ; \
204 install -c -m 444 "$(SYMROOT)/libc.a" \
205 $(DSTROOT)/usr/local/lib/system; \
206 ranlib "$(DSTROOT)/usr/local/lib/system/libc.a"; \
209 # Don't use -j here; it may try to make links before the files are copied
211 mkdir -p $(DSTROOT)/usr/share/man/man2
212 mkdir -p $(DSTROOT)/usr/share/man/man3
213 mkdir -p $(DSTROOT)/usr/share/man/man4
214 mkdir -p $(DSTROOT)/usr/share/man/man5
215 mkdir -p $(DSTROOT)/usr/share/man/man7
216 MAKEOBJDIR="$(OBJROOT)" DESTDIR="$(DSTROOT)" NOMANCOMPRESS=1 \
217 MACHINE_ARCH="$(shell arch)" MAKEFLAGS="" bsdmake fbsdman maninstall
219 install-all: build install-man BI-install-dynamic BI-install-static BI-install-profile
222 rm -rf $(OBJROOT)/obj.ppc $(OBJROOT)/obj.i386 $(OBJROOT)/libc.a \
223 $(OBJROOT)/libc_static.a $(OBJROOT)/libc_debug.a \
224 $(OBJROOT)/libc_profile.a