]> git.saurik.com Git - apple/libc.git/blob - Makefile.xbs
Libc-763.11.tar.gz
[apple/libc.git] / Makefile.xbs
1 # This is a replacement for bsd.lib.mk for the libc project to get it
2 # doing the Right Thing in XBS, which is substantially different than
3 # the BSD build system.
4 #
5 # The main problems arise when libc.a isn't meant to be static, but
6 # libc_static.a is. We also build a debug version of the library
7 # in addition to shared, static, and profile. Also, we build all
8 # versions of libc with debugging enabled, unstripped. The BSD style
9 # is to strip every object file after it is built but here, libc.a
10 # will get merged into the larger libSystem.dylib, which will eventually
11 # be stripped. We also don't build a libc.dylib, since it will be
12 # munged into libSystem.dylib.
13 #
14 # And another difference, B&I wishes to build the 4 incarnations of Libc
15 # in parallel on different machines. To do this, we must look at the
16 # RC_ProjectName variable (which B&I sets) to determine which of the 4
17 # versions of Libc we will be building. Remember that the installhdrs
18 # pass should only be invoked on one of the 4 versions, and man pages
19 # should only be installed once as well. Both of these get done when
20 # we're invoked as "Libc".
21
22 MYBSDMAKE = ${BSDMAKE} -f Makefile
23
24 .PATH: .
25 .MAIN: all
26 all: libc.a libc_static.a libc_debug.a libc_profile.a
27 install: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h installhdrs install_libc.a \
28 install_libc_profile.a install_libc_debug.a \
29 maninstall
30
31 .SUFFIXES:
32 .SUFFIXES: .o .po .So .do
33 .SUFFIXES: .S .s .c .cc .cpp .cxx .m .C
34 .SUFFIXES: -fbsd.c -nbsd.c -obsd.c -uuid.c
35 .SUFFIXES: .f .y .l .defs .h
36 .SUFFIXES: User.c User.o User.po User.So User.do
37 .SUFFIXES: Server.c Server.o Server.po Server.So Server.do
38 .SUFFIXES: .3-uuid.in .3
39
40 OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
41 DOBJS+= ${OBJS:.o=.do}
42 POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
43 SOBJS+= ${OBJS:.o=.So}
44
45 #### Variant Rules ####################################################
46 # The following magic is used for variants to avoid the exponental explosion
47 # of suffix rules. To add a variant, select a name (typically all-caps).
48 # Add that name to the VARIANTS variable. Create a CFLAGS_XXX variable
49 # (XXX is the variant name) that contains the extra flags to pass to the
50 # compiler (currently, no slashes are permitted in the flags). Then, just
51 # define a XXXSRCS variable with the names of the files to recompile with the
52 # additional flags. For auto-patched files, don't use the auto-patched file
53 # name. Just use the original file name.
54 #
55 # Note that this magic also deals with combinations of variants; e.g.,
56 # for two variants XXX and YYY, there are three variant combinations,
57 # XXX, XXX-YYY and YYY. In this example, you can use XXX-YYYSRCS to
58 # specify sources that will build with both the CFLAGS_XXX and CFLAGS_YYY
59 # flags set. The variants are always in alphabetic order.
60 #
61 # The DYLD variant is special; it builds a separate archive for use by dyld,
62 # and contains customized binaries that are used to override the behavior of
63 # the corresponding binaries in libc.a. The DYLD variant by itself does not
64 # cause BUILDING_VARIANT to be defined, and object files are in DYLDOBJS.
65 #
66 VARIANTS = CANCELABLE DARWINEXTSN DYLD
67
68 .ifndef FEATURE_ONLY_64_BIT_INO_T
69 VARIANTS += INODE32
70 .endif
71 .ifndef FEATURE_ONLY_1050_VARIANTS
72 VARIANTS += PRE1050
73 .endif
74 .ifndef FEATURE_ONLY_UNIX_CONFORMANCE
75 VARIANTS+= LEGACY
76 .endif
77 # Append the 64-bit long double sources (ppc only)
78 .if (${MACHINE_ARCH} == ppc)
79 VARIANTS += LDBL
80 MDSRCS += ldbl64.s
81 .endif
82
83 CFLAGS_CANCELABLE= -DVARIANT_CANCELABLE
84 CFLAGS_DARWINEXTSN= -DVARIANT_DARWINEXTSN
85 CFLAGS_DYLD= -DVARIANT_DYLD -DVARIANT_CANCELABLE -DVARIANT_DARWINEXTSN -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0
86 CFLAGS_INODE32= -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_INODE32
87 CFLAGS_LDBL= -mlong-double-64 -DLDBL_COMPAT
88 CFLAGS_LEGACY= -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0 -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_LEGACY
89 CFLAGS_PRE1050= -U__DARWIN_VERS_1050 -D__DARWIN_VERS_1050=0 -DVARIANT_PRE1050
90
91 # to insure a variable expansion of the left-hand side of a comparison
92 DYLD = DYLD
93
94 .for _v in ${VARIANTS}
95 COMBOARGS+= ${_v}/${CFLAGS_${_v}}
96 .endfor
97 .ifdef COMBOARGS
98 # makeCombos is a perl script that creates all the variant combinations
99 # and all the combinations of flags
100 VARIANTCOMBOCFLAGS != ${.CURDIR}/makeCombos ${COMBOARGS}
101 .endif
102 # For each of the variant combinations as target (and possibly suffixed with
103 # _D, _P, and _S for the four kinds on compile styles, we create a subdirectory
104 # to do the compiling in, and then call ${MYBSDMAKE} with the new directory, and
105 # setting VARIANTCFLAGS, which are the extra flags to be added to CFLAGS.
106 .for _v in ${VARIANTCOMBOCFLAGS}
107 VARIANTCOMBOS+= ${_v:H:S,/,,}
108 .if ${DYLD} != ${_v:H:S,/,,}
109 ${_v:H:S,/,,}_BUILDING_VARIANT = -DBUILDING_VARIANT
110 .endif
111 ${_v:H:S,/,,}:
112 .ifdef ${_v:H:S,/,,}SRCS
113 ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
114 MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}
115 .endif
116 ${_v:H:S,/,,}_D:
117 .ifdef ${_v:H:S,/,,}SRCS
118 ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
119 MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_D
120 .endif
121 ${_v:H:S,/,,}_P:
122 .ifdef ${_v:H:S,/,,}SRCS
123 ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
124 MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_P
125 .endif
126 ${_v:H:S,/,,}_S:
127 .ifdef ${_v:H:S,/,,}SRCS
128 ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \
129 MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="${${_v:H:S,/,,}_BUILDING_VARIANT} ${_v:T:S/@/ /g}" VARIANTINC="-I${MAKEOBJDIR}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_S
130 .endif
131 .endfor
132
133 # The non-DYLD variants
134 .for _v in ${VARIANTCOMBOS:N*DYLD*}
135 # Variant suffix rules so the filenames are unique and Libsystem won't complain
136 # because of ambiguities with -sectorder
137 .SUFFIXES: -${_v}.o -${_v}.do -${_v}.po -${_v}.So
138 .o-${_v}.o .do-${_v}.do .po-${_v}.po .So-${_v}.So:
139 ${MV} ${.IMPSRC} ${.TARGET}
140
141 # These are the build targets of the above ${MYBSDMAKE} calls, which just builds
142 # using the standard rules, but with the additional flags.
143 VARIANTOBJS+= ${${_v}SRCS:N*.h:R:S/$/-${_v}.o/g:S,^,${_v}/,g}
144 build_${_v}: ${${_v}SRCS:N*.h:R:S/$/-${_v}.o/g}
145 build_${_v}_D: ${${_v}SRCS:N*.h:R:S/$/-${_v}.do/g}
146 build_${_v}_P: ${${_v}SRCS:N*.h:R:S/$/-${_v}.po/g}
147 build_${_v}_S: ${${_v}SRCS:N*.h:R:S/$/-${_v}.So/g}
148 .endfor
149 # These variables, plus VARIANTOBJS above, are the extra binaries that get
150 # added to the .a files. Note that these objects are in subdirectories
151 # of the main build directory.
152 VARIANTDOBJS+= ${VARIANTOBJS:.o=.do}
153 VARIANTPOBJS+= ${VARIANTOBJS:.o=.po}
154 VARIANTSOBJS+= ${VARIANTOBJS:.o=.So}
155
156 # Now for the DYLD variants
157 .for _v in ${VARIANTCOMBOS:M*DYLD*}
158 # Variant suffix rules so the filenames are unique and Libsystem won't complain
159 # because of ambiguities with -sectorder
160 .SUFFIXES: -${_v}.o -${_v}.do -${_v}.po -${_v}.So
161 .o-${_v}.o .do-${_v}.do .po-${_v}.po .So-${_v}.So:
162 ${MV} ${.IMPSRC} ${.TARGET}
163
164 # These are the build targets of the above ${MYBSDMAKE} calls, which just builds
165 # using the standard rules, but with the additional flags.
166 DYLDOBJS+= ${${_v}SRCS:N*.h:R:S/$/-${_v}.So/g:S,^,${_v}/,g}
167 build_${_v}:
168 build_${_v}_D:
169 build_${_v}_P:
170 build_${_v}_S: ${${_v}SRCS:N*.h:R:S/$/-${_v}.So/g}
171 .endfor
172 #### FreeBSD Rules ##################################################
173 PREFBSDFLAGS= -I${.CURDIR}/fbsdcompat
174 FBSDFLAGS= -include _fbsd_compat_.h
175
176 -fbsd.c.o:
177 ${MYCC} -static \
178 ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
179 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
180 ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
181 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
182 -fbsd.c.po:
183 ${MYCC} -pg -DPROFILE \
184 ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
185 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
186 ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
187 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
188 -fbsd.c.So:
189 ${MYCC} \
190 ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
191 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
192 ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
193 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
194 -fbsd.c.do:
195 ${MYCC} -DDEBUG \
196 ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
197 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
198 ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \
199 -c ${.IMPSRC} -o ${.TARGET}
200
201 #### NetBSD Rules ##################################################
202 PRENBSDFLAGS= -I${.CURDIR}/nbsdcompat
203 NBSDFLAGS= -include _nbsd_compat_.h
204
205 -nbsd.c.o:
206 ${MYCC} -static \
207 ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
208 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
209 ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
210 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
211 -nbsd.c.po:
212 ${MYCC} -pg -DPROFILE \
213 ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
214 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
215 ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
216 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
217 -nbsd.c.So:
218 ${MYCC} \
219 ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
220 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
221 ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
222 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
223 -nbsd.c.do:
224 ${MYCC} -DDEBUG \
225 ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
226 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
227 ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \
228 -c ${.IMPSRC} -o ${.TARGET}
229
230 #### OpenBSD Rules ##################################################
231 PREOBSDFLAGS=
232 OBSDFLAGS=
233
234 -obsd.c.o:
235 ${MYCC} -static \
236 ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
237 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
238 ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
239 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
240 -obsd.c.po:
241 ${MYCC} -pg -DPROFILE \
242 ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
243 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
244 ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
245 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
246 -obsd.c.So:
247 ${MYCC} \
248 ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
249 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
250 ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
251 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
252 -obsd.c.do:
253 ${MYCC} -DDEBUG \
254 ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
255 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
256 ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \
257 -c ${.IMPSRC} -o ${.TARGET}
258
259 #### UUID Rules ######################################################
260 PREUUIDFLAGS= -I${.CURDIR}/uuid
261 UUIDFLAGS= -include uuid-config.h
262
263 -uuid.c.o:
264 ${MYCC} -static \
265 ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
266 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
267 ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
268 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
269 -uuid.c.po:
270 ${MYCC} -pg -DPROFILE \
271 ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
272 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
273 ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
274 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
275 -uuid.c.So:
276 ${MYCC} \
277 ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
278 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
279 ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
280 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
281 -uuid.c.do:
282 ${MYCC} -DDEBUG \
283 ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
284 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
285 ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \
286 -c ${.IMPSRC} -o ${.TARGET}
287 .3-uuid.in.3:
288 ${SED} -f ${SRCROOT}/uuid/uuidman.sed ${.IMPSRC} > ${.TARGET}
289
290 #### Standard C Rules #################################################
291 # If you change any of these standard rule, make corresponding changes
292 # to the _STANDARD_* macros in Makefile.inc
293 #######################################################################
294 .c.o User.cUser.o Server.cServer.o:
295 ${MYCC} -static \
296 ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
297 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
298 ${VARIANTCFLAGS} ${LIBCFLAGS} \
299 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
300 .c.po User.cUser.po Server.cServer.po:
301 ${MYCC} -pg -DPROFILE \
302 ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
303 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
304 ${VARIANTCFLAGS} ${LIBCFLAGS} \
305 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
306 .c.So User.cUser.So Server.cServer.So:
307 ${MYCC} \
308 ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
309 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
310 ${VARIANTCFLAGS} ${LIBCFLAGS} \
311 -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET}
312 .c.do User.cUser.do Server.cServer.do:
313 ${MYCC} -DDEBUG \
314 ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \
315 ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \
316 ${VARIANTCFLAGS} ${LIBCFLAGS} \
317 -c ${.IMPSRC} -o ${.TARGET}
318
319 #### Standard Assembler Rules #########################################
320 .s.o .S.o:
321 ${MYCC} -static -x assembler-with-cpp \
322 ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
323 ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
324 ${VARIANTCFLAGS:M-[BIDFU]*} -Os ${OPTIMIZE-${.IMPSRC:T}} \
325 -c ${.IMPSRC} -o ${.TARGET}
326 .s.po .S.po:
327 ${MYCC} -pg -x assembler-with-cpp -DPROFILE \
328 ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
329 ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
330 ${VARIANTCFLAGS:M-[BIDFU]*} -Os ${OPTIMIZE-${.IMPSRC:T}} \
331 -c ${.IMPSRC} -o ${.TARGET}
332 .s.So .S.So:
333 ${MYCC} -x assembler-with-cpp \
334 ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
335 ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
336 ${VARIANTCFLAGS:M-[BIDFU]*} -Os ${OPTIMIZE-${.IMPSRC:T}} \
337 -c ${.IMPSRC} -o ${.TARGET}
338 .s.do .S.do:
339 ${MYCC} -x assembler-with-cpp -DDEBUG \
340 ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \
341 ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \
342 ${VARIANTCFLAGS:M-[BIDFU]*} -c ${.IMPSRC} -o ${.TARGET}
343
344 #### mig Rules ########################################################
345 .defs.h .defsUser.c .defsServer.c:
346 ${MIG} -arch ${CCARCH} -cc ${MYCC} -user ${.PREFIX}User.c -server ${.PREFIX}Server.c -header ${.PREFIX}.h ${.IMPSRC}
347
348 gen_mig_defs: ${SRVMIGHDRS} ${MIGHDRS}
349 gen_md_mig_defs: ${MD_MIGHDRS}
350
351 #### CrashReporterClient Rules ########################################
352 .ifdef FEATURE_NO_LIBCRASHREPORTERCLIENT
353 CRASHREPORTERCLIENTOBJ =
354 .else # !FEATURE_NO_LIBCRASHREPORTERCLIENT
355 CRASHREPORTERCLIENT = CrashReporterClient
356 CRASHREPORTERCLIENTOBJ = ${CRASHREPORTERCLIENT}.${OBJSUFFIX}
357 LIBCRASHREPORTERCLIENT = lib${CRASHREPORTERCLIENT}.a
358 ${CRASHREPORTERCLIENTOBJ}: ${SDKROOT}/usr/local/lib/${LIBCRASHREPORTERCLIENT}
359 ditto -arch ${MACHINE_ARCH} $> ${LIBCRASHREPORTERCLIENT}
360 ar x ${LIBCRASHREPORTERCLIENT}
361 mv ${CRASHREPORTERCLIENT}.o $@
362 .endif # !FEATURE_NO_LIBCRASHREPORTERCLIENT
363
364 #### Library Rules ####################################################
365 ${VARIANTCOMBOS:N*DYLD*} ${OBJS} ${STATICOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
366 lib${LIB}_static.a:: ${BUILDFIRST} ${VARIANTCOMBOS:N*DYLD*} ${OBJS} ${STATICOBJS} ${CRASHREPORTERCLIENTOBJ}
367 @${ECHO} building static ${LIB} library
368 @${RM} lib${LIB}_static.a
369 @${AR} cq lib${LIB}_static.a `${LORDER} ${OBJS} ${STATICOBJS} ${VARIANTOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
370 ${RANLIB} lib${LIB}_static.a
371
372 ${VARIANTCOMBOS:N*DYLD*:S/$/_P/g} ${POBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
373 lib${LIB}_profile.a:: ${BUILDFIRST} ${VARIANTCOMBOS:N*DYLD*:S/$/_P/g} ${POBJS} ${CRASHREPORTERCLIENTOBJ}
374 @${ECHO} building profiled ${LIB} library
375 @${RM} lib${LIB}_profile.a
376 @${AR} cq lib${LIB}_profile.a `${LORDER} ${POBJS} ${VARIANTPOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
377 ${RANLIB} lib${LIB}_profile.a
378
379 ${VARIANTCOMBOS:N*DYLD*:S/$/_D/g} ${DOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
380 lib${LIB}_debug.a:: ${BUILDFIRST} ${VARIANTCOMBOS:N*DYLD*:S/$/_D/g} ${DOBJS} ${CRASHREPORTERCLIENTOBJ}
381 @${ECHO} building debug ${LIB} library
382 @${RM} lib${LIB}_debug.a
383 @${AR} cq lib${LIB}_debug.a `${LORDER} ${DOBJS} ${VARIANTDOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
384 ${RANLIB} lib${LIB}_debug.a
385
386 ${VARIANTCOMBOS:S/$/_S/g} ${SOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h
387 lib${LIB}.a:: ${BUILDFIRST} ${VARIANTCOMBOS:S/$/_S/g} ${SOBJS} ${CRASHREPORTERCLIENTOBJ}
388 @${ECHO} building standard ${LIB} library
389 @${RM} lib${LIB}.a
390 @${AR} cq lib${LIB}.a `${LORDER} ${SOBJS} ${VARIANTSOBJS} ${CRASHREPORTERCLIENTOBJ} | ${TSORT} -q`
391 ${RANLIB} lib${LIB}.a
392 @${ECHO} building custom ${LIB} library for dyld
393 @${RM} lib${LIB}-dyld.a
394 @${AR} cq lib${LIB}-dyld.a `${LORDER} ${DYLDOBJS} | ${TSORT} -q`
395 ${RANLIB} lib${LIB}-dyld.a
396
397 CLEANFILES += ${DOBJS} libc_static.a libc_profile.a libc_debug.a
398
399 INCDIR = ${DESTDIR}/usr/include
400 LOCINCDIR = ${DESTDIR}/usr/local/include
401 SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework
402 PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders
403 KERNELFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/Kernel.framework
404 PRIVKERNELHDRS = ${KERNELFRAMEWORK}/Versions/A/PrivateHeaders
405 INSTALLMODE != ${TEST} `id -u` -eq 0 && ${ECHO} 444 || ${ECHO} 644
406
407 installhdrs-md: gen_md_mig_defs
408
409 installhdrs: modifyhdrs
410
411 copyhdrs: gen_mig_defs
412 ${MKDIR} ${INCDIR}/arpa
413 ${MKDIR} ${INCDIR}/libkern
414 ${MKDIR} ${INCDIR}/malloc
415 .ifdef OBJC_INSTHDRS
416 ${MKDIR} ${INCDIR}/objc
417 .endif
418 ${MKDIR} ${INCDIR}/protocols
419 ${MKDIR} ${INCDIR}/secure
420 ${MKDIR} ${INCDIR}/sys
421 ${MKDIR} ${INCDIR}/xlocale
422 ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS} ${INCDIR}
423 ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS} ${INCDIR}/arpa
424 ${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS} ${INCDIR}/libkern
425 ${INSTALL} -m ${INSTALLMODE} ${MALLOC_INSTHDRS} ${INCDIR}/malloc
426 .ifdef OBJC_INSTHDRS
427 ${INSTALL} -m ${INSTALLMODE} ${OBJC_INSTHDRS} ${INCDIR}/objc
428 .endif
429 ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS} ${INCDIR}/protocols
430 ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS} ${INCDIR}/secure
431 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS} ${INCDIR}/sys
432 ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS} ${INCDIR}/xlocale
433 ${MKDIR} ${LOCINCDIR}
434 ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS} ${LOCINCDIR}
435 ${MKDIR} ${PRIVHDRS}/btree
436 ${MKDIR} ${PRIVHDRS}/machine
437 ${MKDIR} ${PRIVHDRS}/objc
438 ${MKDIR} ${PRIVHDRS}/uuid
439 ${MKDIR} ${PRIVHDRS}/sys
440 ${MKDIR} ${PRIVKERNELHDRS}/uuid
441 ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS} ${PRIVHDRS}
442 ${INSTALL} -m ${INSTALLMODE} ${INSTBTREEPRIVHDRS_AUTOPATCH} ${PRIVHDRS}/btree
443 ${INSTALL} -m ${INSTALLMODE} ${SRCROOT}/internat/NXCType.h ${PRIVHDRS}/objc
444 ${MV} ${DESTDIR}/usr/include/asm.h ${PRIVHDRS}/machine
445 ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS} ${PRIVHDRS}/sys
446 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVHDRS}/uuid
447 ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVKERNELHDRS}/uuid
448
449 modifyhdrs: copyhdrs
450 @for i in `${FIND} '${DESTDIR}' -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do \
451 ${CHMOD} u+w $$i && \
452 ${ECHO} ${ED} - $$i \< ${.CURDIR}/strip-header.ed && \
453 ${ED} - $$i < ${.CURDIR}/strip-header.ed && \
454 ${CHMOD} u-w $$i || exit 1; \
455 done
456 @for i in `${FIND} '${DESTDIR}' -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l UNIFDEF`; do \
457 ${CHMOD} u+w $$i && \
458 ${CP} $$i $$i.orig && \
459 ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $$i.orig \> $$i && \
460 { ${UNIFDEF} ${UNIFDEFARGS} $$i.orig > $$i || [ $$? -ne 2 ]; } && \
461 ${RM} $$i.orig && \
462 ${CHMOD} u-w $$i || exit 1; \
463 done
464
465 install_lib${LIB}_static.a:
466 ${INSTALL} -m ${INSTALLMODE} lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/
467 install_lib${LIB}_profile.a:
468 ${INSTALL} -m ${INSTALLMODE} lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system
469 install_lib${LIB}_debug.a:
470 ${INSTALL} -m ${INSTALLMODE} lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/
471 install_lib${LIB}.a:
472 ${INSTALL} -m ${INSTALLMODE} lib${LIB}.a ${DESTDIR}/usr/local/lib/system/
473
474 autopatch: ${AUTOPATCHHDRS} ${AUTOPATCHSRCS} ${AUTOPATCHMAN}
475
476 copyfiles:
477 .if !empty(COPYFILES)
478 ${INSTALL} -m ${INSTALLMODE} ${COPYFILES} ${DESTDIR}/usr/local/lib/system
479 .endif
480 .if !empty(MDCOPYFILES)
481 ${INSTALL} -m ${INSTALLMODE} ${MDCOPYFILES} ${DESTDIR}/usr/local/lib/system
482 .endif
483
484 clean:
485 ${RM} ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES}
486 ${RM} lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \
487 lib${LIB}_debug.a