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