bsd.lib.mk revision 1.379.2.2 1 1.379.2.2 martin # $NetBSD: bsd.lib.mk,v 1.379.2.2 2024/03/01 11:43:31 martin Exp $
2 1.92 mikel # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
3 1.1 cgd
4 1.188 tv .include <bsd.init.mk>
5 1.207 thorpej .include <bsd.shlib.mk>
6 1.219 thorpej .include <bsd.gcc.mk>
7 1.379.2.1 martin .include <bsd.sanitizer.mk>
8 1.376 kamil
9 1.227 lukem # Pull in <bsd.sys.mk> here so we can override its .c.o rule
10 1.227 lukem .include <bsd.sys.mk>
11 1.97 mycroft
12 1.282 lukem LIBISMODULE?= no
13 1.281 lukem LIBISPRIVATE?= no
14 1.291 mrg LIBISCXX?= no
15 1.281 lukem
16 1.282 lukem .if ${LIBISMODULE} != "no"
17 1.330 christos _LIB_PREFIX?= # empty
18 1.282 lukem MKDEBUGLIB:= no
19 1.282 lukem MKLINT:= no
20 1.282 lukem MKPICINSTALL:= no
21 1.282 lukem MKPROFILE:= no
22 1.282 lukem MKSTATICLIB:= no
23 1.330 christos .else
24 1.330 christos _LIB_PREFIX?= lib
25 1.282 lukem .endif
26 1.282 lukem
27 1.281 lukem .if ${LIBISPRIVATE} != "no"
28 1.280 lukem MKDEBUGLIB:= no
29 1.280 lukem MKLINT:= no
30 1.290 cube MKPICINSTALL:= no
31 1.290 cube . if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
32 1.290 cube MKSTATICLIB:= no
33 1.379.2.2 martin . elif ${LIBISPRIVATE} != "pic"
34 1.280 lukem MKPIC:= no
35 1.290 cube . endif
36 1.280 lukem MKPROFILE:= no
37 1.280 lukem .endif
38 1.280 lukem
39 1.188 tv ##### Basic targets
40 1.246 lukem .PHONY: checkver libinstall
41 1.143 erh realinstall: checkver libinstall
42 1.232 erh
43 1.232 erh ##### LIB specific flags.
44 1.287 christos # XXX: This is needed for programs that link with .a libraries
45 1.287 christos # Perhaps a more correct solution is to always generate _pic.a
46 1.287 christos # files or always have a shared library.
47 1.371 christos # Another fix is to provide rcrt0.o like OpenBSD does and
48 1.371 christos # do relocations for static PIE.
49 1.366 christos .if defined(MKPIE) && (${MKPIE} != "no") && !defined(NOPIE)
50 1.366 christos CFLAGS+= ${PIE_CFLAGS}
51 1.366 christos AFLAGS+= ${PIE_AFLAGS}
52 1.366 christos .endif
53 1.1 cgd
54 1.378 christos PGFLAGS+= -pg
55 1.378 christos .if ${MKPIC} != "no"
56 1.378 christos PGFLAGS+= -fPIC
57 1.378 christos .endif
58 1.378 christos
59 1.256 lukem ##### Libraries that this may depend upon.
60 1.256 lukem .if defined(LIBDPLIBS) && ${MKPIC} != "no" # {
61 1.256 lukem .for _lib _dir in ${LIBDPLIBS}
62 1.256 lukem .if !defined(LIBDO.${_lib})
63 1.303 christos LIBDO.${_lib}!= cd "${_dir}" && ${PRINTOBJDIR}
64 1.256 lukem .MAKEOVERRIDES+=LIBDO.${_lib}
65 1.256 lukem .endif
66 1.325 pooka .if ${LIBDO.${_lib}} == "_external"
67 1.325 pooka LDADD+= -l${_lib}
68 1.325 pooka .else
69 1.256 lukem LDADD+= -L${LIBDO.${_lib}} -l${_lib}
70 1.379.2.2 martin .if exists(${LIBDO.${_lib}}/lib${_lib}_pic.a)
71 1.379.2.2 martin DPADD+= ${LIBDO.${_lib}}/lib${_lib}_pic.a
72 1.379.2.2 martin .elif exists(${LIBDO.${_lib}}/lib${_lib}.so)
73 1.379.2.2 martin DPADD+= ${LIBDO.${_lib}}/lib${_lib}.so
74 1.379.2.2 martin .else
75 1.379.2.2 martin DPADD+= ${LIBDO.${_lib}}/lib${_lib}.a
76 1.379.2.2 martin .endif
77 1.325 pooka .endif
78 1.256 lukem .endfor
79 1.256 lukem .endif # }
80 1.256 lukem
81 1.188 tv ##### Build and install rules
82 1.356 erh MKDEP_SUFFIXES?= .o .po .pico .go .ln .d
83 1.292 pooka
84 1.252 lukem .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE}) # {
85 1.154 simonb SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
86 1.154 simonb SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
87 1.171 christos SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
88 1.143 erh
89 1.295 he DPADD+= ${SHLIB_VERSION_FILE}
90 1.295 he
91 1.143 erh # Check for higher installed library versions.
92 1.145 erh .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
93 1.201 lukem exists(${NETBSDSRCDIR}/lib/checkver)
94 1.143 erh checkver:
95 1.303 christos @(cd "${.CURDIR}" && \
96 1.289 apb HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
97 1.239 lukem ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
98 1.327 christos -d ${_DEST.OBJ} ${LIB})
99 1.173 christos .endif
100 1.252 lukem .endif # }
101 1.173 christos
102 1.173 christos .if !target(checkver)
103 1.143 erh checkver:
104 1.143 erh .endif
105 1.173 christos
106 1.169 thorpej print-shlib-major:
107 1.185 tv .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
108 1.169 thorpej @echo ${SHLIB_MAJOR}
109 1.173 christos .else
110 1.173 christos @false
111 1.173 christos .endif
112 1.169 thorpej
113 1.169 thorpej print-shlib-minor:
114 1.185 tv .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
115 1.169 thorpej @echo ${SHLIB_MINOR}
116 1.173 christos .else
117 1.173 christos @false
118 1.173 christos .endif
119 1.171 christos
120 1.171 christos print-shlib-teeny:
121 1.185 tv .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
122 1.171 christos @echo ${SHLIB_TEENY}
123 1.143 erh .else
124 1.169 thorpej @false
125 1.173 christos .endif
126 1.169 thorpej
127 1.379.2.2 martin .if ${LIBISPRIVATE} == "no"
128 1.252 lukem .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR) # {
129 1.173 christos .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
130 1.173 christos .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
131 1.173 christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
132 1.173 christos .else
133 1.173 christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
134 1.173 christos .endif
135 1.173 christos .else
136 1.173 christos SHLIB_FULLVERSION=${SHLIB_MAJOR}
137 1.173 christos .endif
138 1.252 lukem .endif # }
139 1.379.2.2 martin .endif
140 1.1 cgd
141 1.101 mycroft # add additional suffixes not exported.
142 1.101 mycroft # .po is used for profiling object files.
143 1.304 njoly # .pico is used for PIC object files.
144 1.304 njoly .SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .C .m .F .f .r .y .l .cl .p .h
145 1.118 lukem .SUFFIXES: .sh .m4 .m
146 1.82 mikel
147 1.86 jonathan
148 1.86 jonathan # Set PICFLAGS to cc flags for producing position-independent code,
149 1.338 joerg # if not already set.
150 1.86 jonathan
151 1.164 simonb # Data-driven table using make variables to control how shared libraries
152 1.86 jonathan # are built for different platforms and object formats.
153 1.302 abs # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
154 1.302 abs # numbers of shared library
155 1.164 simonb # SHLIB_SOVERSION: version number to be compiled into a shared library
156 1.164 simonb # via -soname. Usualy ${SHLIB_MAJOR} on ELF.
157 1.173 christos # NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
158 1.173 christos # [.${SHLIB_TEENY}]]
159 1.164 simonb # SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
160 1.123 jonathan # with ELF, also set shared-lib version for ld.so.
161 1.123 jonathan # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
162 1.123 jonathan # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
163 1.86 jonathan
164 1.338 joerg PICFLAGS ?= -fPIC
165 1.160 simonb
166 1.205 yamt .if ${MKPICLIB} != "no"
167 1.377 kamil CSHLIBFLAGS+= ${PICFLAGS} ${SANITIZERFLAGS} ${LIBCSANITIZERFLAGS}
168 1.205 yamt .endif
169 1.205 yamt
170 1.205 yamt .if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
171 1.205 yamt MKSHLIBOBJS= yes
172 1.205 yamt .else
173 1.205 yamt MKSHLIBOBJS= no
174 1.205 yamt .endif
175 1.205 yamt
176 1.364 christos .if (${MKDEBUG:Uno} != "no" && !defined(NODEBUG)) || \
177 1.335 riastrad (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
178 1.335 riastrad # We only add -g to the shared library objects
179 1.335 riastrad # because we don't currently split .a archives.
180 1.335 riastrad CSHLIBFLAGS+= -g
181 1.335 riastrad .if ${LIBISPRIVATE} == "yes"
182 1.335 riastrad CFLAGS+= -g
183 1.335 riastrad .endif
184 1.335 riastrad .endif
185 1.335 riastrad
186 1.123 jonathan # Platform-independent linker flags for ELF shared libraries
187 1.182 mrg SHLIB_SOVERSION= ${SHLIB_MAJOR}
188 1.327 christos SHLIB_SHFLAGS= -Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION}
189 1.375 kamil SHLIB_SHFLAGS+= ${SANITIZERFLAGS}
190 1.354 pooka .if !defined(SHLIB_WARNTEXTREL) || ${SHLIB_WARNTEXTREL} != "no"
191 1.272 christos SHLIB_SHFLAGS+= -Wl,--warn-shared-textrel
192 1.354 pooka .endif
193 1.337 pooka .if !defined(SHLIB_MKMAP) || ${SHLIB_MKMAP} != "no"
194 1.336 matt SHLIB_SHFLAGS+= -Wl,-Map=${_LIB}.so.${SHLIB_SOVERSION}.map
195 1.337 pooka .endif
196 1.336 matt CLEANFILES+= ${_LIB}.so.${SHLIB_SOVERSION}.map
197 1.322 christos SHLIB_LDSTARTFILE?= ${_GCC_CRTI} ${_GCC_CRTBEGINS}
198 1.322 christos SHLIB_LDENDFILE?= ${_GCC_CRTENDS} ${_GCC_CRTN}
199 1.86 jonathan
200 1.82 mikel CFLAGS+= ${COPTS}
201 1.267 mrg OBJCFLAGS+= ${OBJCOPTS}
202 1.257 simonb AFLAGS+= ${COPTS}
203 1.179 dmcmahil FFLAGS+= ${FOPTS}
204 1.1 cgd
205 1.305 darran .if defined(CTFCONVERT)
206 1.305 darran .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
207 1.305 darran CTFFLAGS+= -g
208 1.367 mrg .if defined(HAVE_GCC)
209 1.348 christos #CFLAGS+= -gdwarf-2
210 1.347 christos .endif
211 1.305 darran .endif
212 1.305 darran .endif
213 1.305 darran
214 1.333 christos LIBSTRIPAOBJS= yes
215 1.333 christos .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
216 1.333 christos LIBSTRIPCOBJS= yes
217 1.333 christos .endif
218 1.333 christos .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
219 1.333 christos LIBSTRIPOBJCOBJS= yes
220 1.333 christos .endif
221 1.333 christos .if !defined(FFLAGS) || empty(FFLAGS:M*-g*)
222 1.333 christos LIBSTRIPFOBJS= yes
223 1.333 christos .endif
224 1.333 christos .if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*)
225 1.333 christos LIBSTRIPSHLIBOBJS= yes
226 1.333 christos .endif
227 1.333 christos
228 1.1 cgd .c.o:
229 1.238 lukem ${_MKTARGET_COMPILE}
230 1.263 dsl ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
231 1.305 darran .if defined(CTFCONVERT)
232 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
233 1.305 darran .endif
234 1.333 christos .if defined(LIBSTRIPCOBJS)
235 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
236 1.153 christos .endif
237 1.1 cgd
238 1.1 cgd .c.po:
239 1.238 lukem ${_MKTARGET_COMPILE}
240 1.378 christos ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${PGFLAGS} ${.IMPSRC} -o ${.TARGET}
241 1.305 darran .if defined(CTFCONVERT)
242 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
243 1.305 darran .endif
244 1.333 christos .if defined(LIBSTRIPCOBJS)
245 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
246 1.153 christos .endif
247 1.17 mycroft
248 1.266 christos .c.go:
249 1.266 christos ${_MKTARGET_COMPILE}
250 1.266 christos ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
251 1.266 christos
252 1.304 njoly .c.pico:
253 1.238 lukem ${_MKTARGET_COMPILE}
254 1.263 dsl ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
255 1.333 christos .if defined(LIBSTRIPSHLIBOBJS)
256 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
257 1.153 christos .endif
258 1.27 pk
259 1.223 lukem .cc.o .cpp.o .cxx.o .C.o:
260 1.238 lukem ${_MKTARGET_COMPILE}
261 1.263 dsl ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
262 1.333 christos .if defined(LIBSTRIPCOBJS)
263 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
264 1.153 christos .endif
265 1.17 mycroft
266 1.266 christos .cc.po .cpp.po .cxx.po .C.po:
267 1.238 lukem ${_MKTARGET_COMPILE}
268 1.378 christos ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${PGFLAGS} ${.IMPSRC} -o ${.TARGET}
269 1.333 christos .if defined(LIBSTRIPCOBJS)
270 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
271 1.153 christos .endif
272 1.28 cgd
273 1.266 christos .cc.go .cpp.go .cxx.go .C.go:
274 1.266 christos ${_MKTARGET_COMPILE}
275 1.266 christos ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
276 1.266 christos
277 1.304 njoly .cc.pico .cpp.pico .cxx.pico .C.pico:
278 1.238 lukem ${_MKTARGET_COMPILE}
279 1.263 dsl ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
280 1.333 christos .if defined(LIBSTRIPSHLIBOBJS)
281 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
282 1.153 christos .endif
283 1.118 lukem
284 1.179 dmcmahil .f.o:
285 1.238 lukem ${_MKTARGET_COMPILE}
286 1.263 dsl ${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
287 1.305 darran .if defined(CTFCONVERT)
288 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
289 1.305 darran .endif
290 1.333 christos .if defined(LIBSTRIPFOBJS)
291 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
292 1.179 dmcmahil .endif
293 1.179 dmcmahil
294 1.179 dmcmahil .f.po:
295 1.238 lukem ${_MKTARGET_COMPILE}
296 1.378 christos ${COMPILE.f} ${PROFFLAGS} ${PGFLAGS} ${.IMPSRC} -o ${.TARGET}
297 1.305 darran .if defined(CTFCONVERT)
298 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
299 1.305 darran .endif
300 1.333 christos .if defined(LIBSTRIPFOBJS)
301 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
302 1.179 dmcmahil .endif
303 1.179 dmcmahil
304 1.266 christos .f.go:
305 1.266 christos ${_MKTARGET_COMPILE}
306 1.266 christos ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
307 1.266 christos
308 1.304 njoly .f.pico:
309 1.238 lukem ${_MKTARGET_COMPILE}
310 1.338 joerg ${COMPILE.f} ${PICFLAGS} ${.IMPSRC} -o ${.TARGET}
311 1.333 christos .if defined(LIBSTRIPFOBJS)
312 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
313 1.179 dmcmahil .endif
314 1.179 dmcmahil
315 1.179 dmcmahil .f.ln:
316 1.238 lukem ${_MKTARGET_COMPILE}
317 1.217 wiz @echo Skipping lint for Fortran libraries.
318 1.179 dmcmahil
319 1.118 lukem .m.o:
320 1.238 lukem ${_MKTARGET_COMPILE}
321 1.267 mrg ${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
322 1.305 darran .if defined(CTFCONVERT)
323 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
324 1.305 darran .endif
325 1.333 christos .if defined(LIBSTRIPOBJCOBJS)
326 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
327 1.153 christos .endif
328 1.118 lukem
329 1.118 lukem .m.po:
330 1.238 lukem ${_MKTARGET_COMPILE}
331 1.378 christos ${COMPILE.m} ${PROFFLAGS} ${PGFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
332 1.305 darran .if defined(CTFCONVERT)
333 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
334 1.305 darran .endif
335 1.333 christos .if defined(LIBSTRIPOBJCOBJS)
336 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
337 1.153 christos .endif
338 1.118 lukem
339 1.266 christos .m.go:
340 1.266 christos ${_MKTARGET_COMPILE}
341 1.267 mrg ${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
342 1.333 christos .if defined(LIBSTRIPOBJCOBJS)
343 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
344 1.266 christos .endif
345 1.266 christos
346 1.304 njoly .m.pico:
347 1.238 lukem ${_MKTARGET_COMPILE}
348 1.267 mrg ${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
349 1.333 christos .if defined(LIBSTRIPOBJCOBJS)
350 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
351 1.153 christos .endif
352 1.1 cgd
353 1.251 lukem .s.o:
354 1.238 lukem ${_MKTARGET_COMPILE}
355 1.263 dsl ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
356 1.305 darran .if defined(CTFCONVERT)
357 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
358 1.305 darran .endif
359 1.333 christos .if defined(LIBSTRIPAOBJS)
360 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
361 1.333 christos .endif
362 1.1 cgd
363 1.251 lukem .S.o:
364 1.251 lukem ${_MKTARGET_COMPILE}
365 1.263 dsl ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
366 1.305 darran .if defined(CTFCONVERT)
367 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
368 1.305 darran .endif
369 1.333 christos .if defined(LIBSTRIPAOBJS)
370 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
371 1.333 christos .endif
372 1.251 lukem
373 1.251 lukem .s.po:
374 1.251 lukem ${_MKTARGET_COMPILE}
375 1.263 dsl ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
376 1.305 darran .if defined(CTFCONVERT)
377 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
378 1.305 darran .endif
379 1.333 christos .if defined(LIBSTRIPAOBJS)
380 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
381 1.333 christos .endif
382 1.251 lukem
383 1.251 lukem .S.po:
384 1.238 lukem ${_MKTARGET_COMPILE}
385 1.263 dsl ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
386 1.305 darran .if defined(CTFCONVERT)
387 1.305 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
388 1.305 darran .endif
389 1.333 christos .if defined(LIBSTRIPAOBJS)
390 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
391 1.333 christos .endif
392 1.1 cgd
393 1.266 christos .s.go:
394 1.266 christos ${_MKTARGET_COMPILE}
395 1.266 christos ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
396 1.266 christos
397 1.266 christos .S.go:
398 1.266 christos ${_MKTARGET_COMPILE}
399 1.266 christos ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
400 1.266 christos
401 1.304 njoly .s.pico:
402 1.251 lukem ${_MKTARGET_COMPILE}
403 1.338 joerg ${COMPILE.s} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
404 1.333 christos .if defined(LIBSTRIPAOBJS)
405 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
406 1.333 christos .endif
407 1.251 lukem
408 1.304 njoly .S.pico:
409 1.238 lukem ${_MKTARGET_COMPILE}
410 1.338 joerg ${COMPILE.S} ${PICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
411 1.333 christos .if defined(LIBSTRIPAOBJS)
412 1.320 christos ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
413 1.333 christos .endif
414 1.27 pk
415 1.327 christos # Declare a few variables to make our life easier later.
416 1.327 christos _LIB:=${_LIB_PREFIX}${LIB}
417 1.327 christos _LIB.a:=${_LIB}.a
418 1.327 christos _LIB_p.a:=${_LIB}_p.a
419 1.327 christos _LIB_g.a:=${_LIB}_g.a
420 1.327 christos _LIB_pic.a:=${_LIB}_pic.a
421 1.327 christos _LIB.ln:=llib-l${LIB}.ln
422 1.327 christos
423 1.327 christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
424 1.327 christos _LIB.so:=${_LIB}.so
425 1.327 christos _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR}
426 1.327 christos _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION}
427 1.358 mrg _LIB.so.link:=${_LIB}.so.${SHLIB_FULLVERSION}.link
428 1.364 christos .if ${MKDEBUG:Uno} != "no" && !defined(NODEBUG)
429 1.327 christos _LIB.so.debug:=${_LIB.so.full}.debug
430 1.327 christos .endif
431 1.327 christos .endif
432 1.327 christos
433 1.327 christos _DEST.LIB:=${DESTDIR}${LIBDIR}
434 1.327 christos _DEST.OBJ:=${DESTDIR}${_LIBSODIR}
435 1.327 christos _DEST.LINT:=${DESTDIR}${LINTLIBDIR}
436 1.327 christos _DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR}
437 1.334 christos _DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR}
438 1.327 christos
439 1.252 lukem .if defined(LIB) # {
440 1.234 lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
441 1.234 lukem || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
442 1.327 christos _LIBS=${_LIB.a}
443 1.130 tv .else
444 1.130 tv _LIBS=
445 1.130 tv .endif
446 1.58 cgd
447 1.321 matt .if ${LIBISPRIVATE} != "no" \
448 1.321 matt && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \
449 1.321 matt && !defined(NOCOMBINE)) # {
450 1.321 matt .for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g}
451 1.321 matt COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
452 1.321 matt .if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f)
453 1.321 matt COMBINESRCS+= ${f}
454 1.321 matt NODPSRCS+= ${f}
455 1.321 matt .else
456 1.321 matt OBJS+= ${f:R:S/$/.o/}
457 1.321 matt .endif
458 1.321 matt .endfor
459 1.321 matt
460 1.321 matt .if !empty(COMBINESRCS)
461 1.327 christos OBJS+= ${_LIB}_combine.o
462 1.327 christos ${_LIB}_combine.o: ${COMBINESRCS}
463 1.321 matt ${_MKTARGET_COMPILE}
464 1.321 matt ${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET}
465 1.333 christos .if defined(LIBSTRIPOBJS)
466 1.349 matt ${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
467 1.321 matt .endif
468 1.321 matt
469 1.327 christos CLEANFILES+= ${_LIB}_combine.d
470 1.321 matt
471 1.327 christos .if exists("${_LIB}_combine.d")
472 1.327 christos .include "${_LIB}_combine.d"
473 1.321 matt .endif
474 1.321 matt .endif # empty(XSRCS.${LIB})
475 1.321 matt .else # } {
476 1.167 matt OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
477 1.321 matt .endif # }
478 1.158 christos
479 1.255 thorpej STOBJS+=${OBJS}
480 1.255 thorpej
481 1.280 lukem LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
482 1.280 lukem
483 1.281 lukem .if ${LIBISPRIVATE} != "no"
484 1.252 lukem # No installation is required
485 1.252 lukem libinstall::
486 1.306 lukem .endif
487 1.252 lukem
488 1.268 lukem .if ${MKDEBUGLIB} != "no"
489 1.327 christos _LIBS+=${_LIB_g.a}
490 1.266 christos GOBJS+=${OBJS:.o=.go}
491 1.266 christos DEBUGFLAGS?=-DDEBUG
492 1.266 christos .endif
493 1.266 christos
494 1.149 lukem .if ${MKPROFILE} != "no"
495 1.327 christos _LIBS+=${_LIB_p.a}
496 1.167 matt POBJS+=${OBJS:.o=.po}
497 1.262 christos PROFFLAGS?=-DGPROF -DPROF
498 1.1 cgd .endif
499 1.1 cgd
500 1.252 lukem .if ${MKPIC} != "no" # {
501 1.160 simonb .if ${MKPICLIB} == "no"
502 1.205 yamt .if ${MKSHLIBOBJS} != "no"
503 1.205 yamt # make _pic.a, which isn't really pic,
504 1.205 yamt # since it's needed for making shared lib.
505 1.205 yamt # but don't install it.
506 1.327 christos SOLIB=${_LIB_pic.a}
507 1.304 njoly SOBJS+=${OBJS:.o=.pico}
508 1.205 yamt .else
509 1.327 christos SOLIB=${_LIB.a}
510 1.205 yamt .endif
511 1.160 simonb .else
512 1.327 christos SOLIB=${_LIB_pic.a}
513 1.160 simonb _LIBS+=${SOLIB}
514 1.304 njoly SOBJS+=${OBJS:.o=.pico}
515 1.160 simonb .endif
516 1.171 christos .if defined(SHLIB_FULLVERSION)
517 1.327 christos _LIBS+=${_LIB.so.full}
518 1.27 pk .endif
519 1.252 lukem .endif # }
520 1.27 pk
521 1.279 lukem .if ${MKLINT} != "no" && !empty(LOBJS)
522 1.327 christos _LIBS+=${_LIB.ln}
523 1.215 christos .endif
524 1.27 pk
525 1.234 lukem ALLOBJS=
526 1.234 lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
527 1.234 lukem || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
528 1.255 thorpej ALLOBJS+=${STOBJS}
529 1.179 dmcmahil .endif
530 1.234 lukem ALLOBJS+=${POBJS} ${SOBJS}
531 1.279 lukem .if ${MKLINT} != "no" && !empty(LOBJS)
532 1.179 dmcmahil ALLOBJS+=${LOBJS}
533 1.216 christos .endif
534 1.252 lukem .else # !defined(LIB) # } {
535 1.216 christos LOBJS=
536 1.216 christos SOBJS=
537 1.252 lukem .endif # !defined(LIB) # }
538 1.186 tv
539 1.254 lukem _YLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
540 1.253 christos
541 1.253 christos .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
542 1.158 christos
543 1.327 christos realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug}
544 1.1 cgd
545 1.296 perry .if ${MKARZERO} == "yes"
546 1.296 perry _ARFL=crsD
547 1.297 perry _ARRANFL=sD
548 1.296 perry _INSTRANLIB=
549 1.296 perry .else
550 1.296 perry _ARFL=crs
551 1.297 perry _ARRANFL=s
552 1.296 perry _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
553 1.296 perry .endif
554 1.296 perry
555 1.293 pooka # If you change this, please consider reflecting the change in
556 1.293 pooka # the override in sys/rump/Makefile.rump.
557 1.243 rtr .if !target(__archivebuild)
558 1.90 christos __archivebuild: .USE
559 1.238 lukem ${_MKTARGET_BUILD}
560 1.373 christos @rm -f ${.TARGET}
561 1.360 tsutsui ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
562 1.243 rtr .endif
563 1.89 christos
564 1.243 rtr .if !target(__archiveinstall)
565 1.89 christos __archiveinstall: .USE
566 1.238 lukem ${_MKTARGET_INSTALL}
567 1.198 lukem ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
568 1.296 perry ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
569 1.243 rtr .endif
570 1.89 christos
571 1.197 mycroft __archivesymlinkpic: .USE
572 1.238 lukem ${_MKTARGET_INSTALL}
573 1.264 jwise ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
574 1.197 mycroft
575 1.373 christos .if !target(__buildstdlib)
576 1.373 christos __buildstdlib: .USE
577 1.373 christos @echo building standard ${.TARGET:T:S/.o//:S/lib//} library
578 1.373 christos @rm -f ${.TARGET}
579 1.374 christos @${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
580 1.373 christos .endif
581 1.373 christos
582 1.373 christos .if !target(__buildproflib)
583 1.373 christos __buildproflib: .USE
584 1.373 christos @echo building profiled ${.TARGET:T:S/.o//:S/lib//} library
585 1.373 christos ${_MKTARGET_BUILD}
586 1.373 christos @rm -f ${.TARGET}
587 1.374 christos @${LINK.c:S/-nostdinc//} -nostdlib ${LDFLAGS} -r -o ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*po} | ${TSORT}`
588 1.373 christos .endif
589 1.373 christos
590 1.253 christos DPSRCS+= ${_YLSRCS}
591 1.253 christos CLEANFILES+= ${_YLSRCS}
592 1.230 lukem
593 1.362 uebayasi ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
594 1.103 mycroft
595 1.362 uebayasi ${_LIB.a}:: ${STOBJS} __archivebuild
596 1.1 cgd
597 1.362 uebayasi ${_LIB_p.a}:: ${POBJS} __archivebuild
598 1.1 cgd
599 1.362 uebayasi ${_LIB_pic.a}:: ${SOBJS} __archivebuild
600 1.27 pk
601 1.362 uebayasi ${_LIB_g.a}:: ${GOBJS} __archivebuild
602 1.266 christos
603 1.235 lukem
604 1.235 lukem _LIBLDOPTS=
605 1.235 lukem .if ${SHLIBDIR} != "/usr/lib"
606 1.324 joerg _LIBLDOPTS+= -Wl,-rpath,${SHLIBDIR} \
607 1.324 joerg -L=${SHLIBDIR}
608 1.324 joerg .elif ${SHLIBINSTALLDIR} != "/usr/lib"
609 1.324 joerg _LIBLDOPTS+= -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
610 1.324 joerg -L=${SHLIBINSTALLDIR}
611 1.235 lukem .endif
612 1.369 ozaki .if ${MKSTRIPSYM:Uyes} == "yes"
613 1.369 ozaki _LIBLDOPTS+= -Wl,-x
614 1.369 ozaki .else
615 1.369 ozaki _LIBLDOPTS+= -Wl,-X
616 1.369 ozaki .endif
617 1.235 lukem
618 1.277 christos # gcc -shared now adds -lc automatically. For libraries other than libc and
619 1.277 christos # libgcc* we add as a dependency the installed shared libc. For libc and
620 1.277 christos # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
621 1.277 christos # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
622 1.277 christos # to add standard libraries, not the linker.
623 1.276 christos .if !defined(LIB)
624 1.312 matt .if !empty(LIBC_SO)
625 1.274 christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
626 1.312 matt .endif
627 1.276 christos .else
628 1.278 simonb .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
629 1.312 matt .if !empty(LIBC_SO)
630 1.276 christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
631 1.312 matt .endif
632 1.277 christos .else
633 1.278 simonb LDLIBC ?= -nodefaultlibs
634 1.341 joerg .if ${HAVE_LIBGCC} == "yes" && ${LIB} == "c"
635 1.318 mrg LDADD+= -lgcc
636 1.278 simonb .endif
637 1.276 christos .endif
638 1.274 christos .endif
639 1.274 christos
640 1.291 mrg .if ${LIBISCXX} != "no"
641 1.291 mrg LIBCC:= ${CXX}
642 1.339 joerg . if ${MKLIBCXX} == "yes"
643 1.339 joerg LIBDPLIBS+= c++ ${.CURDIR}/../../../../../external/bsd/libc++/lib
644 1.339 joerg . else
645 1.346 mrg LIBDPLIBS+= stdc++ ${.CURDIR}/../../../../../external/gpl3/${EXTERNAL_GCC_SUBDIR}/lib/libstdc++-v3
646 1.339 joerg . endif
647 1.291 mrg .else
648 1.291 mrg LIBCC:= ${CC}
649 1.291 mrg .endif
650 1.291 mrg
651 1.327 christos _LDADD.${_LIB}= ${LDADD} ${LDADD.${_LIB}}
652 1.327 christos _LDFLAGS.${_LIB}= ${LDFLAGS} ${LDFLAGS.${_LIB}}
653 1.300 uebayasi
654 1.358 mrg _MAINLIBDEPS= ${SOLIB} ${DPADD} ${DPLIBC} \
655 1.358 mrg ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
656 1.358 mrg
657 1.358 mrg .if defined(_LIB.so.debug)
658 1.358 mrg ${_LIB.so.debug}: ${_LIB.so.link}
659 1.358 mrg ${_MKTARGET_CREATE}
660 1.358 mrg ( ${OBJCOPY} --only-keep-debug \
661 1.358 mrg ${_LIB.so.link} ${_LIB.so.debug} \
662 1.358 mrg ) || (rm -f ${.TARGET}; false)
663 1.358 mrg ${_LIB.so.full}: ${_LIB.so.link} ${_LIB.so.debug}
664 1.358 mrg ${_MKTARGET_CREATE}
665 1.358 mrg ( ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
666 1.358 mrg --add-gnu-debuglink=${_LIB.so.debug} \
667 1.370 chs ${_LIB.so.link} ${_LIB.so.full}.tmp && \
668 1.379 christos ${MV} ${_LIB.so.full}.tmp ${_LIB.so.full} \
669 1.358 mrg ) || (rm -f ${.TARGET}; false)
670 1.358 mrg ${_LIB.so.link}: ${_MAINLIBDEPS}
671 1.358 mrg .else # aka no MKDEBUG
672 1.358 mrg ${_LIB.so.full}: ${_MAINLIBDEPS}
673 1.358 mrg .endif
674 1.238 lukem ${_MKTARGET_BUILD}
675 1.327 christos rm -f ${.TARGET}
676 1.369 ozaki ${LIBCC} ${LDLIBC} -shared ${SHLIB_SHFLAGS} \
677 1.370 chs ${_LDFLAGS.${_LIB}} -o ${.TARGET}.tmp ${_LIBLDOPTS} \
678 1.327 christos -Wl,--whole-archive ${SOLIB} \
679 1.328 matt -Wl,--no-whole-archive ${_LDADD.${_LIB}}
680 1.370 chs .if ${MKSTRIPIDENT} != "no"
681 1.370 chs ${OBJCOPY} -R .ident ${.TARGET}.tmp
682 1.370 chs .endif
683 1.379 christos ${MV} ${.TARGET}.tmp ${.TARGET}
684 1.196 lukem # We don't use INSTALL_SYMLINK here because this is just
685 1.196 lukem # happening inside the build directory/objdir. XXX Why does
686 1.196 lukem # this spend so much effort on libraries that aren't live??? XXX
687 1.358 mrg # XXX Also creates dead symlinks until the .full rule runs
688 1.358 mrg # above and creates the main link
689 1.284 lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
690 1.284 lukem "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
691 1.327 christos ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
692 1.379 christos ${MV} ${_LIB.so.major}.tmp ${_LIB.so.major}
693 1.283 lukem .endif
694 1.327 christos ${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
695 1.379 christos ${MV} ${_LIB.so}.tmp ${_LIB.so}
696 1.35 pk
697 1.252 lukem .if !empty(LOBJS) # {
698 1.103 mycroft LLIBS?= -lc
699 1.327 christos ${_LIB.ln}: ${LOBJS}
700 1.238 lukem ${_MKTARGET_COMPILE}
701 1.327 christos rm -f ${.TARGET}
702 1.206 thorpej .if defined(DESTDIR)
703 1.228 lukem ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
704 1.206 thorpej .else
705 1.228 lukem ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
706 1.206 thorpej .endif
707 1.252 lukem .endif # }
708 1.1 cgd
709 1.280 lukem lint: ${LOBJS}
710 1.280 lukem .if defined(LOBJS) && !empty(LOBJS)
711 1.280 lukem ${LINT} ${LINTFLAGS} ${LOBJS}
712 1.280 lukem .endif
713 1.280 lukem
714 1.327 christos
715 1.317 apb # If the number of entries in CLEANFILES is too large, then the
716 1.317 apb # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
717 1.317 apb # failed (Argument list too long)". Avoid that by splitting the
718 1.317 apb # files to clean into several lists using different variable names.
719 1.317 apb # __cleanuse is an internal target in bsd.clean.mk; the way we
720 1.317 apb # use it here mimics the way it's used by the clean target in
721 1.317 apb # bsd.clean.mk.
722 1.317 apb #
723 1.317 apb clean: libclean1 libclean2 libclean3 libclean4 libclean5
724 1.317 apb libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
725 1.317 apb libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
726 1.317 apb libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
727 1.317 apb libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
728 1.317 apb libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
729 1.316 apb CLEANFILES+= a.out [Ee]rrs mklog core *.core
730 1.327 christos LIBCLEANFILES1+= ${_LIB.a} ${STOBJS} ${STOBJS:=.tmp}
731 1.327 christos LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS} ${POBJS:=.tmp}
732 1.327 christos LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS} ${GOBJS:=.tmp}
733 1.327 christos LIBCLEANFILES4+= ${_LIB_pic.a}
734 1.327 christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
735 1.327 christos LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug}
736 1.327 christos .endif
737 1.317 apb LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
738 1.327 christos LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS}
739 1.252 lukem
740 1.252 lukem .if !target(libinstall) # {
741 1.148 lukem # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
742 1.139 tv libinstall::
743 1.139 tv
744 1.234 lukem .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
745 1.327 christos libinstall:: ${_DEST.LIB}/${_LIB.a}
746 1.327 christos .PRECIOUS: ${_DEST.LIB}/${_LIB.a}
747 1.197 mycroft
748 1.269 dbj .if ${MKUPDATE} == "no"
749 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
750 1.327 christos ${_DEST.LIB}/${_LIB.a}! .MADE
751 1.89 christos .endif
752 1.327 christos ${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall
753 1.197 mycroft .else
754 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
755 1.327 christos ${_DEST.LIB}/${_LIB.a}: .MADE
756 1.89 christos .endif
757 1.327 christos ${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall
758 1.130 tv .endif
759 1.197 mycroft .endif
760 1.89 christos
761 1.149 lukem .if ${MKPROFILE} != "no"
762 1.327 christos libinstall:: ${_DEST.LIB}/${_LIB_p.a}
763 1.327 christos .PRECIOUS: ${_DEST.LIB}/${_LIB_p.a}
764 1.197 mycroft
765 1.269 dbj .if ${MKUPDATE} == "no"
766 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
767 1.327 christos ${_DEST.LIB}/${_LIB_p.a}! .MADE
768 1.32 pk .endif
769 1.327 christos ${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall
770 1.197 mycroft .else
771 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
772 1.327 christos ${_DEST.LIB}/${_LIB_p.a}: .MADE
773 1.89 christos .endif
774 1.327 christos ${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall
775 1.89 christos .endif
776 1.197 mycroft .endif
777 1.89 christos
778 1.268 lukem .if ${MKDEBUGLIB} != "no"
779 1.327 christos libinstall:: ${_DEST.LIB}/${_LIB_g.a}
780 1.327 christos .PRECIOUS: ${_DEST.LIB}/${_LIB_g.a}
781 1.266 christos
782 1.269 dbj .if ${MKUPDATE} == "no"
783 1.329 spz .if !defined(BUILD) && !make(all) && !make(${_LIB_g.a})
784 1.327 christos ${_DEST.LIB}/${_LIB_g.a}! .MADE
785 1.266 christos .endif
786 1.327 christos ${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall
787 1.266 christos .else
788 1.327 christos .if !defined(BUILD) && !make(all) && !make(${LIB_g.a})
789 1.327 christos ${_DEST.LIB}/${_LIB_g.a}: .MADE
790 1.266 christos .endif
791 1.327 christos ${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall
792 1.266 christos .endif
793 1.266 christos .endif
794 1.266 christos
795 1.149 lukem .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
796 1.327 christos libinstall:: ${_DEST.LIB}/${_LIB_pic.a}
797 1.327 christos .PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a}
798 1.197 mycroft
799 1.269 dbj .if ${MKUPDATE} == "no"
800 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
801 1.327 christos ${_DEST.LIB}/${_LIB_pic.a}! .MADE
802 1.89 christos .endif
803 1.197 mycroft .if ${MKPICLIB} == "no"
804 1.331 nakayama ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic
805 1.197 mycroft .else
806 1.327 christos ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall
807 1.197 mycroft .endif
808 1.197 mycroft .else
809 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
810 1.327 christos ${_DEST.LIB}/${_LIB_pic.a}: .MADE
811 1.33 pk .endif
812 1.160 simonb .if ${MKPICLIB} == "no"
813 1.331 nakayama ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic
814 1.160 simonb .else
815 1.327 christos ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall
816 1.160 simonb .endif
817 1.89 christos .endif
818 1.197 mycroft .endif
819 1.89 christos
820 1.171 christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
821 1.282 lukem
822 1.327 christos libinstall:: ${_DEST.OBJ}/${_LIB.so.full}
823 1.327 christos .PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full}
824 1.197 mycroft
825 1.269 dbj .if ${MKUPDATE} == "no"
826 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
827 1.327 christos ${_DEST.OBJ}/${_LIB.so.full}! .MADE
828 1.89 christos .endif
829 1.327 christos ${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full}
830 1.197 mycroft .else
831 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
832 1.327 christos ${_DEST.OBJ}/${_LIB.so.full}: .MADE
833 1.89 christos .endif
834 1.327 christos ${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full}
835 1.197 mycroft .endif
836 1.238 lukem ${_MKTARGET_INSTALL}
837 1.188 tv ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
838 1.327 christos ${.ALLSRC} ${.TARGET}
839 1.195 lukem .if ${_LIBSODIR} != ${LIBDIR}
840 1.327 christos ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
841 1.327 christos ${_DEST.LIB}/${_LIB.so.full}
842 1.195 lukem .endif
843 1.284 lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
844 1.284 lukem "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
845 1.327 christos ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major}
846 1.195 lukem .if ${_LIBSODIR} != ${LIBDIR}
847 1.327 christos ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
848 1.327 christos ${_DEST.LIB}/${_LIB.so.major}
849 1.195 lukem .endif
850 1.284 lukem .endif
851 1.148 lukem .if ${MKLINKLIB} != "no"
852 1.327 christos ${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so}
853 1.195 lukem .if ${_LIBSODIR} != ${LIBDIR}
854 1.327 christos ${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
855 1.327 christos ${_DEST.LIB}/${_LIB.so}
856 1.195 lukem .endif
857 1.83 cgd .endif
858 1.12 cgd .endif
859 1.89 christos
860 1.327 christos .if defined(_LIB.so.debug)
861 1.327 christos libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug}
862 1.327 christos .PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug}
863 1.307 lukem
864 1.327 christos ${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug}
865 1.307 lukem ${_MKTARGET_INSTALL}
866 1.307 lukem ${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
867 1.327 christos ${.ALLSRC} ${.TARGET}
868 1.334 christos .if ${_LIBSODIR} != ${LIBDIR}
869 1.334 christos ${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \
870 1.334 christos ${_DEST.ODEBUG}/${_LIB.so.debug}
871 1.334 christos .endif
872 1.307 lukem .endif
873 1.307 lukem
874 1.279 lukem .if ${MKLINT} != "no" && !empty(LOBJS)
875 1.327 christos libinstall:: ${_DEST.LINT}/${_LIB.ln}
876 1.327 christos .PRECIOUS: ${_DEST.LINT}/${_LIB.ln}
877 1.197 mycroft
878 1.269 dbj .if ${MKUPDATE} == "no"
879 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
880 1.327 christos ${_DEST.LINT}/${_LIB.ln}! .MADE
881 1.89 christos .endif
882 1.327 christos ${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln}
883 1.197 mycroft .else
884 1.327 christos .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
885 1.327 christos ${_DEST.LINT}/${_LIB.ln}: .MADE
886 1.89 christos .endif
887 1.327 christos ${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln}
888 1.197 mycroft .endif
889 1.238 lukem ${_MKTARGET_INSTALL}
890 1.188 tv ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
891 1.327 christos ${.ALLSRC} ${_DEST.LINT}
892 1.58 cgd .endif
893 1.252 lukem .endif # !target(libinstall) # }
894 1.1 cgd
895 1.188 tv ##### Pull in related .mk logic
896 1.298 apb LINKSOWN?= ${LIBOWN}
897 1.298 apb LINKSGRP?= ${LIBGRP}
898 1.298 apb LINKSMODE?= ${LIBMODE}
899 1.1 cgd .include <bsd.man.mk>
900 1.57 jtc .include <bsd.nls.mk>
901 1.91 christos .include <bsd.files.mk>
902 1.89 christos .include <bsd.inc.mk>
903 1.109 cjs .include <bsd.links.mk>
904 1.24 mycroft .include <bsd.dep.mk>
905 1.315 joerg .include <bsd.clang-analyze.mk>
906 1.316 apb .include <bsd.clean.mk>
907 1.117 mycroft
908 1.188 tv ${TARGETS}: # ensure existence
909