]>
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 | ||
8e029c65 A |
22 | BSDMAKE = bsdmake -f Makefile |
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 | # | |
b5d655f7 A |
61 | VARIANTS = DARWINEXTSN CANCELABLE |
62 | ||
63 | .ifndef FEATURE_ONLY_64_BIT_INO_T | |
64 | VARIANTS += INODE32 | |
65 | .endif | |
66 | .ifndef FEATURE_ONLY_1050_VARIANTS | |
67 | VARIANTS += PRE1050 | |
68 | .endif | |
69 | .ifndef FEATURE_ONLY_UNIX_CONFORMANCE | |
70 | VARIANTS+= LEGACY | |
71 | .endif | |
3d9156a7 A |
72 | # Append the 64-bit long double sources (ppc only) |
73 | .if (${MACHINE_ARCH} == ppc) | |
b5d655f7 | 74 | VARIANTS += LDBL |
3d9156a7 A |
75 | MDSRCS += ldbl64.s |
76 | .endif | |
3d9156a7 | 77 | |
224c7076 | 78 | CFLAGS_LEGACY= -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0 -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_LEGACY |
3d9156a7 | 79 | CFLAGS_LDBL= -mlong-double-64 -DLDBL_COMPAT |
224c7076 A |
80 | CFLAGS_DARWINEXTSN= -DVARIANT_DARWINEXTSN |
81 | CFLAGS_INODE32= -U__DARWIN_64_BIT_INO_T -D__DARWIN_64_BIT_INO_T=0 -DVARIANT_INODE32 | |
82 | CFLAGS_CANCELABLE= -DVARIANT_CANCELABLE | |
83 | CFLAGS_PRE1050= -U__DARWIN_VERS_1050 -D__DARWIN_VERS_1050=0 -DVARIANT_PRE1050 | |
3d9156a7 A |
84 | |
85 | .for _v in ${VARIANTS} | |
86 | COMBOARGS+= ${_v}/${CFLAGS_${_v}} | |
87 | .endfor | |
88 | .ifdef COMBOARGS | |
89 | # makeCombos is a perl script that creates all the variant combinations | |
90 | # and all the combinations of flags | |
91 | VARIANTCOMBOCFLAGS != ${.CURDIR}/makeCombos ${COMBOARGS} | |
92 | .endif | |
93 | # For each of the variant combinations as target (and possibly suffixed with | |
94 | # _D, _P, and _S for the four kinds on compile styles, we create a subdirectory | |
8e029c65 | 95 | # to do the compiling in, and then call $(BSDMAKE) with the new directory, and |
3d9156a7 A |
96 | # setting VARIANTCFLAGS, which are the extra flags to be added to CFLAGS. |
97 | .for _v in ${VARIANTCOMBOCFLAGS} | |
98 | VARIANTCOMBOS+= ${_v:H:S,/,,} | |
99 | ${_v:H:S,/,,}: | |
100 | .ifdef ${_v:H:S,/,,}SRCS | |
101 | mkdir -p ${MAKEOBJDIR}/${_v:H:S,/,,}; \ | |
8e029c65 | 102 | MAKEOBJDIR="$(MAKEOBJDIR)/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" $(BSDMAKE) -C "${.CURDIR}" build_${_v:H:S,/,,} |
3d9156a7 A |
103 | .endif |
104 | ${_v:H:S,/,,}_D: | |
105 | .ifdef ${_v:H:S,/,,}SRCS | |
106 | mkdir -p ${MAKEOBJDIR}/${_v:H:S,/,,}; \ | |
8e029c65 | 107 | MAKEOBJDIR="$(MAKEOBJDIR)/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" $(BSDMAKE) -C "${.CURDIR}" build_${_v:H:S,/,,}_D |
3d9156a7 A |
108 | .endif |
109 | ${_v:H:S,/,,}_P: | |
110 | .ifdef ${_v:H:S,/,,}SRCS | |
111 | mkdir -p ${MAKEOBJDIR}/${_v:H:S,/,,}; \ | |
8e029c65 | 112 | MAKEOBJDIR="$(MAKEOBJDIR)/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" $(BSDMAKE) -C "${.CURDIR}" build_${_v:H:S,/,,}_P |
3d9156a7 A |
113 | .endif |
114 | ${_v:H:S,/,,}_S: | |
115 | .ifdef ${_v:H:S,/,,}SRCS | |
116 | mkdir -p ${MAKEOBJDIR}/${_v:H:S,/,,}; \ | |
8e029c65 | 117 | MAKEOBJDIR="$(MAKEOBJDIR)/${_v:H:S,/,,}" VARIANTCFLAGS="-DBUILDING_VARIANT ${_v:T:S/@/ /g}" $(BSDMAKE) -C "${.CURDIR}" build_${_v:H:S,/,,}_S |
3d9156a7 A |
118 | .endif |
119 | .endfor | |
120 | ||
121 | .for _v in ${VARIANTCOMBOS} | |
122 | # Variant suffix rules so the filenames are unique and Libsystem won't complain | |
123 | # because of ambiguities with -sectorder | |
124 | .SUFFIXES: -${_v}.o -${_v}.do -${_v}.po -${_v}.So | |
125 | .o-${_v}.o .do-${_v}.do .po-${_v}.po .So-${_v}.So: | |
126 | mv ${.IMPSRC} ${.TARGET} | |
127 | ||
8e029c65 | 128 | # These are the build targets of the above $(BSDMAKE) calls, which just builds |
3d9156a7 A |
129 | # using the standard rules, but with the additional flags. |
130 | VARIANTOBJS+= ${${_v}SRCS:N*.h:R:S/$/-${_v}.o/g:S,^,${_v}/,g} | |
131 | build_${_v}: ${${_v}SRCS:N*.h:R:S/$/-${_v}.o/g} | |
132 | build_${_v}_D: ${${_v}SRCS:N*.h:R:S/$/-${_v}.do/g} ${${_v}SRCS2:N*.h:R:S/$/-${_v}.do/g} | |
133 | build_${_v}_P: ${${_v}SRCS:N*.h:R:S/$/-${_v}.po/g} ${${_v}SRCS2:N*.h:R:S/$/-${_v}.po/g} | |
134 | build_${_v}_S: ${${_v}SRCS:N*.h:R:S/$/-${_v}.So/g} ${${_v}SRCS2:N*.h:R:S/$/-${_v}.So/g} | |
135 | .endfor | |
136 | # These variables, plus VARIANTOBJS above, are the extra binaries that get | |
137 | # added to the .a files. Note that these objects are in subdirectories | |
138 | # of the main build directory. | |
139 | VARIANTDOBJS+= ${VARIANTOBJS:.o=.do} | |
140 | VARIANTPOBJS+= ${VARIANTOBJS:.o=.po} | |
141 | VARIANTSOBJS+= ${VARIANTOBJS:.o=.So} | |
59e0d9fe | 142 | #### FreeBSD Rules ################################################## |
224c7076 A |
143 | PREFBSDFLAGS= -I${.CURDIR}/fbsdcompat |
144 | FBSDFLAGS= -include _fbsd_compat_.h | |
5b2abdfb | 145 | |
9385eb3d | 146 | -fbsd.c.o: |
224c7076 A |
147 | ${CC} -static \ |
148 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
149 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
150 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 151 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 152 | -fbsd.c.po: |
224c7076 A |
153 | ${CC} -pg -DPROFILE \ |
154 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
155 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
156 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 157 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 158 | -fbsd.c.So: |
224c7076 A |
159 | ${CC} \ |
160 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
161 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
162 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 163 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 164 | -fbsd.c.do: |
b5d655f7 | 165 | ${CC} -DDEBUG \ |
224c7076 A |
166 | ${PREFBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
167 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
168 | ${VARIANTCFLAGS} ${FBSDFLAGS} ${LIBCFLAGS} \ | |
59e0d9fe A |
169 | -c ${.IMPSRC} -o ${.TARGET} |
170 | ||
3d9156a7 | 171 | #### NetBSD Rules ################################################## |
224c7076 A |
172 | PRENBSDFLAGS= -I${.CURDIR}/nbsdcompat |
173 | NBSDFLAGS= -include _nbsd_compat_.h | |
3d9156a7 A |
174 | |
175 | -nbsd.c.o: | |
224c7076 A |
176 | ${CC} -static \ |
177 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
178 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
179 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
180 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
181 | -nbsd.c.po: | |
224c7076 A |
182 | ${CC} -pg -DPROFILE \ |
183 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
184 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
185 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
186 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
187 | -nbsd.c.So: | |
224c7076 A |
188 | ${CC} \ |
189 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
190 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
191 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
192 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
193 | -nbsd.c.do: | |
b5d655f7 | 194 | ${CC} -DDEBUG \ |
224c7076 A |
195 | ${PRENBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
196 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
197 | ${VARIANTCFLAGS} ${NBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
198 | -c ${.IMPSRC} -o ${.TARGET} |
199 | ||
200 | #### OpenBSD Rules ################################################## | |
224c7076 | 201 | PREOBSDFLAGS= |
3d9156a7 A |
202 | OBSDFLAGS= |
203 | ||
204 | -obsd.c.o: | |
224c7076 A |
205 | ${CC} -static \ |
206 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
207 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
208 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
209 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
210 | -obsd.c.po: | |
224c7076 A |
211 | ${CC} -pg -DPROFILE \ |
212 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
213 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
214 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
215 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
216 | -obsd.c.So: | |
224c7076 A |
217 | ${CC} \ |
218 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
219 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
220 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
221 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
222 | -obsd.c.do: | |
b5d655f7 | 223 | ${CC} -DDEBUG \ |
224c7076 A |
224 | ${PREOBSDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
225 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
226 | ${VARIANTCFLAGS} ${OBSDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 A |
227 | -c ${.IMPSRC} -o ${.TARGET} |
228 | ||
59e0d9fe | 229 | #### UUID Rules ###################################################### |
224c7076 A |
230 | PREUUIDFLAGS= -I${.CURDIR}/uuid |
231 | UUIDFLAGS= -include uuid-config.h | |
59e0d9fe A |
232 | |
233 | -uuid.c.o: | |
224c7076 A |
234 | ${CC} -static \ |
235 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
236 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
237 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 238 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 239 | -uuid.c.po: |
224c7076 A |
240 | ${CC} -pg -DPROFILE \ |
241 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
242 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
243 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 244 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 245 | -uuid.c.So: |
224c7076 A |
246 | ${CC} \ |
247 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
248 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
249 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 250 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 251 | -uuid.c.do: |
b5d655f7 | 252 | ${CC} -DDEBUG \ |
224c7076 A |
253 | ${PREUUIDFLAGS} ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
254 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
255 | ${VARIANTCFLAGS} ${UUIDFLAGS} ${LIBCFLAGS} \ | |
59e0d9fe | 256 | -c ${.IMPSRC} -o ${.TARGET} |
b5d655f7 A |
257 | .3-uuid.in.3: |
258 | sed -f ${SRCROOT}/uuid/uuidman.sed ${.IMPSRC} > ${.TARGET} | |
59e0d9fe A |
259 | |
260 | #### Standard C Rules ################################################# | |
224c7076 A |
261 | # If you change any of these standard rule, make corresponding changes |
262 | # to the _STANDARD_* macros in Makefile.inc | |
263 | ####################################################################### | |
59e0d9fe | 264 | .c.o User.cUser.o Server.cServer.o: |
224c7076 A |
265 | ${CC} -static \ |
266 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
267 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
268 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 269 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 270 | .c.po User.cUser.po Server.cServer.po: |
224c7076 A |
271 | ${CC} -pg -DPROFILE \ |
272 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
273 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
274 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 275 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
59e0d9fe | 276 | .c.So User.cUser.So Server.cServer.So: |
224c7076 A |
277 | ${CC} \ |
278 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ | |
279 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
280 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
3d9156a7 | 281 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
9385eb3d | 282 | .c.do User.cUser.do Server.cServer.do: |
b5d655f7 | 283 | ${CC} -DDEBUG \ |
224c7076 A |
284 | ${PRECFLAGS} ${PRECFLAGS-${.IMPSRC:T}} \ |
285 | ${CFLAGS} ${CFLAGS-${.IMPSRC:T}} \ | |
286 | ${VARIANTCFLAGS} ${LIBCFLAGS} \ | |
59e0d9fe A |
287 | -c ${.IMPSRC} -o ${.TARGET} |
288 | ||
289 | #### Standard Assembler Rules ######################################### | |
224c7076 A |
290 | .s.o .S.o: |
291 | ${CC} -static -x assembler-with-cpp \ | |
292 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ | |
293 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
3d9156a7 | 294 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
224c7076 A |
295 | .s.po .S.po: |
296 | ${CC} -pg -x assembler-with-cpp -DPROFILE \ | |
297 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ | |
298 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
3d9156a7 | 299 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
224c7076 A |
300 | .s.So .S.So: |
301 | ${CC} -x assembler-with-cpp \ | |
302 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ | |
303 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
3d9156a7 | 304 | -Os ${OPTIMIZE-${.IMPSRC:T}} -c ${.IMPSRC} -o ${.TARGET} |
224c7076 | 305 | .s.do .S.do: |
b5d655f7 | 306 | ${CC} -x assembler-with-cpp -DDEBUG \ |
224c7076 A |
307 | ${PRECFLAGS:M-[BIDFU]*} ${PRECFLAGS-${.IMPSRC:T}:M-[BIDFU]*} \ |
308 | ${CFLAGS:M-[BIDFU]*} ${CFLAGS-${.IMPSRC:T}:M-[BIDFU]*} ${AINC} \ | |
59e0d9fe A |
309 | -c ${.IMPSRC} -o ${.TARGET} |
310 | ||
311 | #### mig Rules ######################################################## | |
9385eb3d | 312 | .defs.h .defsUser.c .defsServer.c: |
b5d655f7 | 313 | mig -arch ${CCARCH} -cc ${CC} -user ${.PREFIX}User.c -server ${.PREFIX}Server.c -header ${.PREFIX}.h ${.IMPSRC} |
5b2abdfb | 314 | |
9385eb3d A |
315 | gen_mig_defs: ${SRVMIGHDRS} ${MIGHDRS} |
316 | gen_md_mig_defs: ${MD_MIGHDRS} | |
317 | ||
3d9156a7 | 318 | #### Library Rules #################################################### |
b5d655f7 | 319 | lib${LIB}_static.a:: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h ${VARIANTCOMBOS} ${OBJS} ${STATICOBJS} |
5b2abdfb A |
320 | @${ECHO} building static ${LIB} library |
321 | @rm -f lib${LIB}_static.a | |
3d9156a7 | 322 | @${AR} cq lib${LIB}_static.a `lorder ${OBJS} ${STATICOBJS} ${VARIANTOBJS} | tsort -q` ${ARADD} |
5b2abdfb A |
323 | ${RANLIB} lib${LIB}_static.a |
324 | ||
b5d655f7 | 325 | lib${LIB}_profile.a:: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h ${VARIANTCOMBOS:S/$/_P/g} ${POBJS} ${POBJS2} |
5b2abdfb A |
326 | @${ECHO} building profiled ${LIB} library |
327 | @rm -f lib${LIB}_profile.a | |
3d9156a7 | 328 | @${AR} cq lib${LIB}_profile.a `lorder ${POBJS} ${VARIANTPOBJS} | tsort -q` ${ARADD} |
5b2abdfb A |
329 | ${RANLIB} lib${LIB}_profile.a |
330 | ||
b5d655f7 | 331 | lib${LIB}_debug.a:: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h ${VARIANTCOMBOS:S/$/_D/g} ${DOBJS} ${DOBJS2} |
5b2abdfb A |
332 | @${ECHO} building debug ${LIB} library |
333 | @rm -f lib${LIB}_debug.a | |
3d9156a7 | 334 | @${AR} cq lib${LIB}_debug.a `lorder ${DOBJS} ${VARIANTDOBJS} | tsort -q` ${ARADD} |
5b2abdfb A |
335 | ${RANLIB} lib${LIB}_debug.a |
336 | ||
b5d655f7 | 337 | lib${LIB}.a:: ${SYMROOTINC}/${MACHINE_ARCH}/libc-features.h ${VARIANTCOMBOS:S/$/_S/g} ${SOBJS} ${SOBJS2} |
5b2abdfb A |
338 | @${ECHO} building standard ${LIB} library |
339 | @rm -f lib${LIB}.a | |
3d9156a7 | 340 | @${AR} cq lib${LIB}.a `lorder ${SOBJS} ${VARIANTSOBJS} | tsort -q` ${ARADD} |
5b2abdfb A |
341 | ${RANLIB} lib${LIB}.a |
342 | ||
343 | CLEANFILES += ${DOBJS} libc_static.a libc_profile.a libc_debug.a | |
344 | ||
9385eb3d A |
345 | INCDIR = ${DESTDIR}/usr/include |
346 | LOCINCDIR = ${DESTDIR}/usr/local/include | |
347 | SYSTEMFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/System.framework | |
348 | PRIVHDRS = ${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders | |
3d9156a7 A |
349 | KERNELFRAMEWORK = ${DESTDIR}/System/Library/Frameworks/Kernel.framework |
350 | PRIVKERNELHDRS = ${KERNELFRAMEWORK}/Versions/A/PrivateHeaders | |
224c7076 | 351 | INSTALLMODE != test `id -u` -eq 0 && echo 444 || echo 644 |
9385eb3d A |
352 | |
353 | installhdrs-md: gen_md_mig_defs | |
9385eb3d | 354 | |
b5d655f7 A |
355 | installhdrs: modifyhdrs |
356 | ||
357 | copyhdrs: gen_mig_defs | |
9385eb3d | 358 | mkdir -p ${INCDIR}/arpa |
59e0d9fe | 359 | mkdir -p ${INCDIR}/libkern |
3d9156a7 | 360 | mkdir -p ${INCDIR}/machine |
9385eb3d | 361 | mkdir -p ${INCDIR}/malloc |
b5d655f7 | 362 | .ifdef OBJC_INSTHDRS |
9385eb3d | 363 | mkdir -p ${INCDIR}/objc |
b5d655f7 | 364 | .endif |
9385eb3d | 365 | mkdir -p ${INCDIR}/protocols |
224c7076 | 366 | mkdir -p ${INCDIR}/secure |
59e0d9fe | 367 | mkdir -p ${INCDIR}/sys |
3d9156a7 | 368 | mkdir -p ${INCDIR}/xlocale |
224c7076 A |
369 | ${INSTALL} -c -m ${INSTALLMODE} ${INSTHDRS} ${INCDIR} |
370 | ${INSTALL} -c -m ${INSTALLMODE} ${ARPA_INSTHDRS} ${INCDIR}/arpa | |
371 | ${INSTALL} -c -m ${INSTALLMODE} ${LIBKERN_INSTHDRS} ${INCDIR}/libkern | |
372 | ${INSTALL} -c -m ${INSTALLMODE} ${MACHINE_INSTHDRS} ${INCDIR}/machine | |
373 | ${INSTALL} -c -m ${INSTALLMODE} ${MALLOC_INSTHDRS} ${INCDIR}/malloc | |
b5d655f7 | 374 | .ifdef OBJC_INSTHDRS |
224c7076 | 375 | ${INSTALL} -c -m ${INSTALLMODE} ${OBJC_INSTHDRS} ${INCDIR}/objc |
b5d655f7 | 376 | .endif |
224c7076 A |
377 | ${INSTALL} -c -m ${INSTALLMODE} ${PROTO_INSTHDRS} ${INCDIR}/protocols |
378 | ${INSTALL} -c -m ${INSTALLMODE} ${SECURE_INSTHDRS} ${INCDIR}/secure | |
379 | ${INSTALL} -c -m ${INSTALLMODE} ${SYS_INSTHDRS} ${INCDIR}/sys | |
380 | ${INSTALL} -c -m ${INSTALLMODE} ${XLOCALE_INSTHDRS} ${INCDIR}/xlocale | |
9385eb3d | 381 | mkdir -p ${LOCINCDIR} |
224c7076 | 382 | ${INSTALL} -c -m ${INSTALLMODE} ${LOCALHDRS} ${LOCINCDIR} |
9385eb3d A |
383 | mkdir -p ${PRIVHDRS}/btree |
384 | mkdir -p ${PRIVHDRS}/machine | |
385 | mkdir -p ${PRIVHDRS}/objc | |
3d9156a7 | 386 | mkdir -p ${PRIVHDRS}/uuid |
59e0d9fe | 387 | mkdir -p ${PRIVHDRS}/sys |
3d9156a7 | 388 | mkdir -p ${PRIVKERNELHDRS}/uuid |
224c7076 A |
389 | ${INSTALL} -c -m ${INSTALLMODE} ${PRIV_INSTHDRS} ${PRIVHDRS} |
390 | ${INSTALL} -c -m ${INSTALLMODE} ${INSTBTREEPRIVHDRS_AUTOPATCH} ${PRIVHDRS}/btree | |
391 | ${INSTALL} -c -m ${INSTALLMODE} ${SRCROOT}/internat/NXCType.h ${PRIVHDRS}/objc | |
9385eb3d | 392 | mv ${DESTDIR}/usr/include/asm.h ${PRIVHDRS}/machine |
224c7076 A |
393 | ${INSTALL} -c -m ${INSTALLMODE} ${SYS_INSTHDRS} ${PRIVHDRS}/sys |
394 | ${INSTALL} -c -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVHDRS}/uuid | |
395 | ${INSTALL} -c -m ${INSTALLMODE} ${PRIVUUID_INSTHDRS} ${PRIVKERNELHDRS}/uuid | |
b5d655f7 A |
396 | |
397 | modifyhdrs: copyhdrs | |
398 | @for i in `find '${DESTDIR}' -name \*.h -print0 | xargs -0 grep -l '^//Begin-Libc'`; do \ | |
399 | chmod u+w $$i && \ | |
400 | echo ed - $$i \< ${.CURDIR}/strip-header.ed && \ | |
401 | ed - $$i < ${.CURDIR}/strip-header.ed && \ | |
402 | chmod u-w $$i || exit 1; \ | |
403 | done | |
404 | @for i in `find '${DESTDIR}' -name \*.h -print0 | xargs -0 fgrep -l UNIFDEF`; do \ | |
405 | chmod u+w $$i && \ | |
406 | cp $$i $$i.orig && \ | |
407 | echo unifdef ${UNIFDEFARGS} $$i.orig \> $$i && \ | |
408 | { unifdef ${UNIFDEFARGS} $$i.orig > $$i || [ $$? -ne 2 ]; } && \ | |
409 | rm -f $$i.orig && \ | |
410 | chmod u-w $$i || exit 1; \ | |
411 | done | |
5b2abdfb A |
412 | |
413 | install_lib${LIB}_static.a: | |
224c7076 | 414 | ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}_static.a ${DESTDIR}/usr/local/lib/system/ |
5b2abdfb | 415 | install_lib${LIB}_profile.a: |
224c7076 | 416 | ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}_profile.a ${DESTDIR}/usr/local/lib/system |
5b2abdfb | 417 | install_lib${LIB}_debug.a: |
224c7076 | 418 | ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}_debug.a ${DESTDIR}/usr/local/lib/system/ |
5b2abdfb | 419 | install_lib${LIB}.a: |
224c7076 | 420 | ${INSTALL} -c -m ${INSTALLMODE} lib${LIB}.a ${DESTDIR}/usr/local/lib/system/ |
5b2abdfb | 421 | |
b5d655f7 | 422 | autopatch: ${AUTOPATCHHDRS} ${AUTOPATCHSRCS} ${AUTOPATCHMAN} |
9385eb3d | 423 | |
224c7076 A |
424 | copyfiles: |
425 | .if !empty $(COPYFILES) | |
426 | $(INSTALL) -c -m 444 ${COPYFILES} ${DESTDIR}/usr/local/lib/system | |
427 | .endif | |
428 | .if !empty $(MDCOPYFILES) | |
429 | $(INSTALL) -c -m 444 ${MDCOPYFILES} ${DESTDIR}/usr/local/lib/system | |
430 | .endif | |
431 | ||
5b2abdfb A |
432 | clean: |
433 | rm -f ${OBJS} ${POBJS} ${DOBJS} ${SOBJS} ${CLEANFILES} | |
434 | rm -f lib${LIB}.a lib${LIB}_static.a lib${LIB}_profile.a \ | |
435 | lib${LIB}_debug.a |