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