]>
Commit | Line | Data |
---|---|---|
5b2abdfb A |
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 | ||
34e8f829 | 22 | MYBSDMAKE = ${BSDMAKE} -f Makefile |
8e029c65 | 23 | |
5b2abdfb A |
24 | .PATH: . |
25 | .MAIN: all | |
26 | all: libc.a libc_static.a libc_debug.a libc_profile.a | |
b5d655f7 | 27 | install: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h installhdrs install_libc.a \ |
224c7076 | 28 | install_libc_profile.a install_libc_debug.a \ |
b5d655f7 | 29 | maninstall |
5b2abdfb A |
30 | |
31 | .SUFFIXES: | |
3d9156a7 A |
32 | .SUFFIXES: .o .po .So .do |
33 | .SUFFIXES: .S .s .c .cc .cpp .cxx .m .C | |
224c7076 | 34 | .SUFFIXES: -fbsd.c -nbsd.c -obsd.c -uuid.c |
59e0d9fe | 35 | .SUFFIXES: .f .y .l .defs .h |
9385eb3d A |
36 | .SUFFIXES: User.c User.o User.po User.So User.do |
37 | .SUFFIXES: Server.c Server.o Server.po Server.So Server.do | |
b5d655f7 | 38 | .SUFFIXES: .3-uuid.in .3 |
5b2abdfb A |
39 | |
40 | OBJS+= ${SRCS:N*.h:R:S/$/.o/g} | |
3d9156a7 | 41 | DOBJS+= ${OBJS:.o=.do} |
5b2abdfb A |
42 | POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} |
43 | SOBJS+= ${OBJS:.o=.So} | |
59e0d9fe | 44 | |
3d9156a7 A |
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 | # | |
34e8f829 A |
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 | |
b5d655f7 A |
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 | |
3d9156a7 A |
77 | # Append the 64-bit long double sources (ppc only) |
78 | .if (${MACHINE_ARCH} == ppc) | |
b5d655f7 | 79 | VARIANTS += LDBL |
3d9156a7 A |
80 | MDSRCS += ldbl64.s |
81 | .endif | |
3d9156a7 | 82 | |
34e8f829 | 83 | CFLAGS_CANCELABLE= -DVARIANT_CANCELABLE |
224c7076 | 84 | CFLAGS_DARWINEXTSN= -DVARIANT_DARWINEXTSN |
34e8f829 | 85 | CFLAGS_DYLD= -DVARIANT_DYLD |
224c7076 | 86 | CFLAGS_INODE32= -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_INODE32 |
34e8f829 A |
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 | |
224c7076 | 89 | CFLAGS_PRE1050= -U__DARWIN_VERS_1050 -D__DARWIN_VERS_1050=0 -DVARIANT_PRE1050 |
3d9156a7 | 90 | |
34e8f829 A |
91 | # to insure a variable expansion of the left-hand side of a comparison |
92 | DYLD = DYLD | |
93 | ||
3d9156a7 A |
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 | |
34e8f829 | 104 | # to do the compiling in, and then call ${MYBSDMAKE} with the new directory, and |
3d9156a7 A |
105 | # setting VARIANTCFLAGS, which are the extra flags to be added to CFLAGS. |
106 | .for _v in ${VARIANTCOMBOCFLAGS} | |
107 | VARIANTCOMBOS+= ${_v:H:S,/,,} | |
34e8f829 A |
108 | .if ${DYLD} != ${_v:H:S,/,,} |
109 | ${_v:H:S,/,,}_BUILDING_VARIANT = -DBUILDING_VARIANT | |
110 | .endif | |
3d9156a7 A |
111 | ${_v:H:S,/,,}: |
112 | .ifdef ${_v:H:S,/,,}SRCS | |
34e8f829 A |
113 | ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \ |
114 | MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,} | |
3d9156a7 A |
115 | .endif |
116 | ${_v:H:S,/,,}_D: | |
117 | .ifdef ${_v:H:S,/,,}SRCS | |
34e8f829 A |
118 | ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \ |
119 | MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_D | |
3d9156a7 A |
120 | .endif |
121 | ${_v:H:S,/,,}_P: | |
122 | .ifdef ${_v:H:S,/,,}SRCS | |
34e8f829 A |
123 | ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \ |
124 | MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_P | |
3d9156a7 A |
125 | .endif |
126 | ${_v:H:S,/,,}_S: | |
127 | .ifdef ${_v:H:S,/,,}SRCS | |
34e8f829 A |
128 | ${MKDIR} ${MAKEOBJDIR}/${_v:H:S,/,,}; \ |
129 | MAKEOBJDIR="${MAKEOBJDIR}/${_v:H:S,/,,}" VARIANTCFLAGS="${${_v:H:S,/,,}_BUILDING_VARIANT} ${_v:T:S/@/ /g}" ${MYBSDMAKE} -C "${.CURDIR}" build_${_v:H:S,/,,}_S | |
3d9156a7 A |
130 | .endif |
131 | .endfor | |
132 | ||
34e8f829 A |
133 | # The non-DYLD variants |
134 | .for _v in ${VARIANTCOMBOS:N*DYLD*} | |
3d9156a7 A |
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: | |
34e8f829 | 139 | ${MV} ${.IMPSRC} ${.TARGET} |
3d9156a7 | 140 | |
34e8f829 | 141 | # These are the build targets of the above ${MYBSDMAKE} calls, which just builds |
3d9156a7 A |
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} | |
34e8f829 A |
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} | |
3d9156a7 A |
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} | |
34e8f829 A |
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 | |
59e0d9fe | 172 | #### FreeBSD Rules ################################################## |
224c7076 A |
173 | PREFBSDFLAGS= -I${.CURDIR}/fbsdcompat |
174 | FBSDFLAGS= -include _fbsd_compat_.h | |
5b2abdfb | 175 | |
9385eb3d | 176 | -fbsd.c.o: |
34e8f829 | 177 | ${MYCC} -static \ |
224c7076 A |
178 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
179 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
180 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 181 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 182 | -fbsd.c.po: |
34e8f829 | 183 | ${MYCC} -pg -DPROFILE \ |
224c7076 A |
184 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
185 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
186 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 187 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 188 | -fbsd.c.So: |
34e8f829 | 189 | ${MYCC} \ |
224c7076 A |
190 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
191 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
192 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 193 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 194 | -fbsd.c.do: |
34e8f829 | 195 | ${MYCC} -DDEBUG \ |
224c7076 A |
196 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
197 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
198 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
59e0d9fe A |
199 | -c ${.IMPSRC} -o ${.TARGET} |
200 | ||
3d9156a7 | 201 | #### NetBSD Rules ################################################## |
224c7076 A |
202 | PRENBSDFLAGS= -I${.CURDIR}/nbsdcompat |
203 | NBSDFLAGS= -include _nbsd_compat_.h | |
3d9156a7 A |
204 | |
205 | -nbsd.c.o: | |
34e8f829 | 206 | ${MYCC} -static \ |
224c7076 A |
207 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
208 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
209 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
210 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
211 | -nbsd.c.po: | |
34e8f829 | 212 | ${MYCC} -pg -DPROFILE \ |
224c7076 A |
213 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
214 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
215 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
216 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
217 | -nbsd.c.So: | |
34e8f829 | 218 | ${MYCC} \ |
224c7076 A |
219 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
220 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
221 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
222 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
223 | -nbsd.c.do: | |
34e8f829 | 224 | ${MYCC} -DDEBUG \ |
224c7076 A |
225 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
226 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
227 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
228 | -c ${.IMPSRC} -o ${.TARGET} |
229 | ||
230 | #### OpenBSD Rules ################################################## | |
224c7076 | 231 | PREOBSDFLAGS= |
3d9156a7 A |
232 | OBSDFLAGS= |
233 | ||
234 | -obsd.c.o: | |
34e8f829 | 235 | ${MYCC} -static \ |
224c7076 A |
236 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
237 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
238 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
239 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
240 | -obsd.c.po: | |
34e8f829 | 241 | ${MYCC} -pg -DPROFILE \ |
224c7076 A |
242 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
243 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
244 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
245 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
246 | -obsd.c.So: | |
34e8f829 | 247 | ${MYCC} \ |
224c7076 A |
248 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
249 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
250 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
251 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
252 | -obsd.c.do: | |
34e8f829 | 253 | ${MYCC} -DDEBUG \ |
224c7076 A |
254 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
255 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
256 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
257 | -c ${.IMPSRC} -o ${.TARGET} |
258 | ||
59e0d9fe | 259 | #### UUID Rules ###################################################### |
224c7076 A |
260 | PREUUIDFLAGS= -I${.CURDIR}/uuid |
261 | UUIDFLAGS= -include uuid-config.h | |
59e0d9fe A |
262 | |
263 | -uuid.c.o: | |
34e8f829 | 264 | ${MYCC} -static \ |
224c7076 A |
265 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
266 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
267 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 268 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 269 | -uuid.c.po: |
34e8f829 | 270 | ${MYCC} -pg -DPROFILE \ |
224c7076 A |
271 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
272 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
273 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 274 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 275 | -uuid.c.So: |
34e8f829 | 276 | ${MYCC} \ |
224c7076 A |
277 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
278 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
279 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 280 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 281 | -uuid.c.do: |
34e8f829 | 282 | ${MYCC} -DDEBUG \ |
224c7076 A |
283 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
284 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
285 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
59e0d9fe | 286 | -c ${.IMPSRC} -o ${.TARGET} |
b5d655f7 | 287 | .3-uuid.in.3: |
34e8f829 | 288 | ${SED} -f ${SRCROOT}/uuid/uuidman.sed ${.IMPSRC} > ${.TARGET} |
59e0d9fe A |
289 | |
290 | #### Standard C Rules ################################################# | |
224c7076 A |
291 | # If you change any of these standard rule, make corresponding changes |
292 | # to the _STANDARD_* macros in Makefile.inc | |
293 | ####################################################################### | |
59e0d9fe | 294 | .c.o User.cUser.o Server.cServer.o: |
34e8f829 | 295 | ${MYCC} -static \ |
224c7076 A |
296 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
297 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
298 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 299 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 300 | .c.po User.cUser.po Server.cServer.po: |
34e8f829 | 301 | ${MYCC} -pg -DPROFILE \ |
224c7076 A |
302 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
303 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
304 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 305 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 306 | .c.So User.cUser.So Server.cServer.So: |
34e8f829 | 307 | ${MYCC} \ |
224c7076 A |
308 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
309 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
310 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 311 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 312 | .c.do User.cUser.do Server.cServer.do: |
34e8f829 | 313 | ${MYCC} -DDEBUG \ |
224c7076 A |
314 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
315 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
316 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
59e0d9fe A |
317 | -c ${.IMPSRC} -o ${.TARGET} |
318 | ||
319 | #### Standard Assembler Rules ######################################### | |
224c7076 | 320 | .s.o .S.o: |
34e8f829 | 321 | ${MYCC} -static -x assembler-with-cpp \ |
224c7076 A |
322 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ |
323 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
3d9156a7 | 324 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
224c7076 | 325 | .s.po .S.po: |
34e8f829 | 326 | ${MYCC} -pg -x assembler-with-cpp -DPROFILE \ |
224c7076 A |
327 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ |
328 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
3d9156a7 | 329 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
224c7076 | 330 | .s.So .S.So: |
34e8f829 | 331 | ${MYCC} -x assembler-with-cpp \ |
224c7076 A |
332 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ |
333 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
3d9156a7 | 334 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
224c7076 | 335 | .s.do .S.do: |
34e8f829 | 336 | ${MYCC} -x assembler-with-cpp -DDEBUG \ |
224c7076 A |
337 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ |
338 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
59e0d9fe A |
339 | -c ${.IMPSRC} -o ${.TARGET} |
340 | ||
341 | #### mig Rules ######################################################## | |
9385eb3d | 342 | .defs.h .defsUser.c .defsServer.c: |
34e8f829 | 343 | ${MIG} -arch ${CCARCH} -cc ${MYCC} -user ${.PREFIX}User.c -server ${.PREFIX}Server.c -header ${.PREFIX}.h ${.IMPSRC} |
5b2abdfb | 344 | |
9385eb3d A |
345 | gen_mig_defs: ${SRVMIGHDRS} ${MIGHDRS} |
346 | gen_md_mig_defs: ${MD_MIGHDRS} | |
347 | ||
3d9156a7 | 348 | #### Library Rules #################################################### |
34e8f829 A |
349 | ${VARIANTCOMBOS:N*DYLD*} ${OBJS} ${STATICOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h |
350 | lib${LIB}_static.a:: ${VARIANTCOMBOS:N*DYLD*} ${OBJS} ${STATICOBJS} | |
5b2abdfb | 351 | @${ECHO} building static ${LIB} library |
34e8f829 A |
352 | @${RM} lib${LIB}_static.a |
353 | @${AR} cq lib${LIB}_static.a `${LORDER} ${OBJS} ${STATICOBJS} ${VARIANTOBJS} | ${TSORT} -q` | |
5b2abdfb A |
354 | ${RANLIB} lib${LIB}_static.a |
355 | ||
34e8f829 A |
356 | ${VARIANTCOMBOS:N*DYLD*:S/$/_P/g} ${POBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h |
357 | lib${LIB}_profile.a:: ${VARIANTCOMBOS:N*DYLD*:S/$/_P/g} ${POBJS} | |
5b2abdfb | 358 | @${ECHO} building profiled ${LIB} library |
34e8f829 A |
359 | @${RM} lib${LIB}_profile.a |
360 | @${AR} cq lib${LIB}_profile.a `${LORDER} ${POBJS} ${VARIANTPOBJS} | ${TSORT} -q` | |
5b2abdfb A |
361 | ${RANLIB} lib${LIB}_profile.a |
362 | ||
34e8f829 A |
363 | ${VARIANTCOMBOS:N*DYLD*:S/$/_D/g} ${DOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h |
364 | lib${LIB}_debug.a:: ${VARIANTCOMBOS:N*DYLD*:S/$/_D/g} ${DOBJS} | |
5b2abdfb | 365 | @${ECHO} building debug ${LIB} library |
34e8f829 A |
366 | @${RM} lib${LIB}_debug.a |
367 | @${AR} cq lib${LIB}_debug.a `${LORDER} ${DOBJS} ${VARIANTDOBJS} | ${TSORT} -q` | |
5b2abdfb A |
368 | ${RANLIB} lib${LIB}_debug.a |
369 | ||
34e8f829 A |
370 | ${VARIANTCOMBOS:S/$/_S/g} ${SOBJS}: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h |
371 | lib${LIB}.a:: ${VARIANTCOMBOS:S/$/_S/g} ${SOBJS} | |
5b2abdfb | 372 | @${ECHO} building standard ${LIB} library |
34e8f829 A |
373 | @${RM} lib${LIB}.a |
374 | @${AR} cq lib${LIB}.a `${LORDER} ${SOBJS} ${VARIANTSOBJS} | ${TSORT} -q` | |
5b2abdfb | 375 | ${RANLIB} lib${LIB}.a |
34e8f829 A |
376 | @${ECHO} building custom ${LIB} library for dyld |
377 | @${RM} lib${LIB}-dyld.a | |
378 | @${AR} cq lib${LIB}-dyld.a `${LORDER} ${DYLDOBJS} | ${TSORT} -q` | |
379 | ${RANLIB} lib${LIB}-dyld.a | |
5b2abdfb A |
380 | |
381 | CLEANFILES += ${DOBJS} libc_static.a libc_profile.a libc_debug.a | |
382 | ||
9385eb3d A |
383 | INCDIR = ${DESTDIR}/usr/include |
384 | LOCINCDIR = ${DESTDIR}/usr/local/include | |
385 | SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework | |
386 | PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders | |
3d9156a7 A |
387 | KERNELFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/Kernel.framework |
388 | PRIVKERNELHDRS = ${KERNELFRAMEWORK}/Versions/A/PrivateHeaders | |
34e8f829 | 389 | INSTALLMODE != ${TEST} `id -u` -eq 0 && ${ECHO} 444 || ${ECHO} 644 |
9385eb3d A |
390 | |
391 | installhdrs-md: gen_md_mig_defs | |
9385eb3d | 392 | |
b5d655f7 A |
393 | installhdrs: modifyhdrs |
394 | ||
395 | copyhdrs: gen_mig_defs | |
34e8f829 A |
396 | ${MKDIR} ${INCDIR}/arpa |
397 | ${MKDIR} ${INCDIR}/libkern | |
398 | ${MKDIR} ${INCDIR}/malloc | |
b5d655f7 | 399 | .ifdef OBJC_INSTHDRS |
34e8f829 | 400 | ${MKDIR} ${INCDIR}/objc |
b5d655f7 | 401 | .endif |
34e8f829 A |
402 | ${MKDIR} ${INCDIR}/protocols |
403 | ${MKDIR} ${INCDIR}/secure | |
404 | ${MKDIR} ${INCDIR}/sys | |
405 | ${MKDIR} ${INCDIR}/xlocale | |
406 | ${INSTALL} -m ${INSTALLMODE} ${INSTHDRS} ${INCDIR} | |
407 | ${INSTALL} -m ${INSTALLMODE} ${ARPA_INSTHDRS} ${INCDIR}/arpa | |
408 | ${INSTALL} -m ${INSTALLMODE} ${LIBKERN_INSTHDRS} ${INCDIR}/libkern | |
409 | ${INSTALL} -m ${INSTALLMODE} ${MALLOC_INSTHDRS} ${INCDIR}/malloc | |
b5d655f7 | 410 | .ifdef OBJC_INSTHDRS |
34e8f829 | 411 | ${INSTALL} -m ${INSTALLMODE} ${OBJC_INSTHDRS} ${INCDIR}/objc |
b5d655f7 | 412 | .endif |
34e8f829 A |
413 | ${INSTALL} -m ${INSTALLMODE} ${PROTO_INSTHDRS} ${INCDIR}/protocols |
414 | ${INSTALL} -m ${INSTALLMODE} ${SECURE_INSTHDRS} ${INCDIR}/secure | |
415 | ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS} ${INCDIR}/sys | |
416 | ${INSTALL} -m ${INSTALLMODE} ${XLOCALE_INSTHDRS} ${INCDIR}/xlocale | |
417 | ${MKDIR} ${LOCINCDIR} | |
418 | ${INSTALL} -m ${INSTALLMODE} ${LOCALHDRS} ${LOCINCDIR} | |
419 | ${MKDIR} ${PRIVHDRS}/btree | |
420 | ${MKDIR} ${PRIVHDRS}/machine | |
421 | ${MKDIR} ${PRIVHDRS}/objc | |
422 | ${MKDIR} ${PRIVHDRS}/uuid | |
423 | ${MKDIR} ${PRIVHDRS}/sys | |
424 | ${MKDIR} ${PRIVKERNELHDRS}/uuid | |
425 | ${INSTALL} -m ${INSTALLMODE} ${PRIV_INSTHDRS} ${PRIVHDRS} | |
426 | ${INSTALL} -m ${INSTALLMODE} ${INSTBTREEPRIVHDRS_AUTOPATCH} ${PRIVHDRS}/btree | |
427 | ${INSTALL} -m ${INSTALLMODE} ${SRCROOT}/internat/NXCType.h ${PRIVHDRS}/objc | |
428 | ${MV} ${DESTDIR}/usr/include/asm.h ${PRIVHDRS}/machine | |
429 | ${INSTALL} -m ${INSTALLMODE} ${SYS_INSTHDRS} ${PRIVHDRS}/sys | |
430 | ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVHDRS}/uuid | |
431 | ${INSTALL} -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVKERNELHDRS}/uuid | |
b5d655f7 A |
432 | |
433 | modifyhdrs: copyhdrs | |
34e8f829 A |
434 | @for i in `${FIND} '${DESTDIR}' -name \*.h -print0 | ${XARGS} -0 ${GREP} -l '^//Begin-Libc'`; do \ |
435 | ${CHMOD} u+w $$i && \ | |
436 | ${ECHO} ${ED} - $$i \< ${.CURDIR}/strip-header.ed && \ | |
437 | ${ED} - $$i < ${.CURDIR}/strip-header.ed && \ | |
438 | ${CHMOD} u-w $$i || exit 1; \ | |
b5d655f7 | 439 | done |
34e8f829 A |
440 | @for i in `${FIND} '${DESTDIR}' -name \*.h -print0 | ${XARGS} -0 ${FGREP} -l UNIFDEF`; do \ |
441 | ${CHMOD} u+w $$i && \ | |
442 | ${CP} $$i $$i.orig && \ | |
443 | ${ECHO} ${UNIFDEF} ${UNIFDEFARGS} $$i.orig \> $$i && \ | |
444 | { ${UNIFDEF} ${UNIFDEFARGS} $$i.orig > $$i || [ $$? -ne 2 ]; } && \ | |
445 | ${RM} $$i.orig && \ | |
446 | ${CHMOD} u-w $$i || exit 1; \ | |
b5d655f7 | 447 | done |
5b2abdfb A |
448 | |
449 | install_lib${LIB}_static.a: | |
34e8f829 | 450 | ${INSTALL} -m ${INSTALLMODE} lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/ |
5b2abdfb | 451 | install_lib${LIB}_profile.a: |
34e8f829 | 452 | ${INSTALL} -m ${INSTALLMODE} lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system |
5b2abdfb | 453 | install_lib${LIB}_debug.a: |
34e8f829 | 454 | ${INSTALL} -m ${INSTALLMODE} lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/ |
5b2abdfb | 455 | install_lib${LIB}.a: |
34e8f829 | 456 | ${INSTALL} -m ${INSTALLMODE} lib${LIB}.a ${DESTDIR}/usr/local/lib/system/ |
5b2abdfb | 457 | |
b5d655f7 | 458 | autopatch: ${AUTOPATCHHDRS} ${AUTOPATCHSRCS} ${AUTOPATCHMAN} |
9385eb3d | 459 | |
224c7076 | 460 | copyfiles: |
34e8f829 A |
461 | .if !empty(COPYFILES) |
462 | ${INSTALL} -m ${INSTALLMODE} ${COPYFILES} ${DESTDIR}/usr/local/lib/system | |
224c7076 | 463 | .endif |
34e8f829 A |
464 | .if !empty(MDCOPYFILES) |
465 | ${INSTALL} -m ${INSTALLMODE} ${MDCOPYFILES} ${DESTDIR}/usr/local/lib/system | |
224c7076 A |
466 | .endif |
467 | ||
5b2abdfb | 468 | clean: |
34e8f829 A |
469 | ${RM} ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES} |
470 | ${RM} lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \ | |
5b2abdfb | 471 | lib${LIB}_debug.a |