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