bsd.lib.mk revision 1.186 1 1.186 tv # $NetBSD: bsd.lib.mk,v 1.186 2001/10/19 15:55:52 tv Exp $
2 1.92 mikel # @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
3 1.1 cgd
4 1.117 mycroft .if !target(__initialized__)
5 1.117 mycroft __initialized__:
6 1.1 cgd .if exists(${.CURDIR}/../Makefile.inc)
7 1.1 cgd .include "${.CURDIR}/../Makefile.inc"
8 1.1 cgd .endif
9 1.97 mycroft .include <bsd.own.mk>
10 1.117 mycroft .include <bsd.obj.mk>
11 1.159 perry .include <bsd.depall.mk>
12 1.117 mycroft .MAIN: all
13 1.117 mycroft .endif
14 1.97 mycroft
15 1.143 erh .PHONY: checkver cleanlib libinstall
16 1.143 erh realinstall: checkver libinstall
17 1.183 tv clean: cleanlib
18 1.1 cgd
19 1.184 tv .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})
20 1.154 simonb SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
21 1.154 simonb SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
22 1.171 christos SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
23 1.143 erh
24 1.143 erh # Check for higher installed library versions.
25 1.145 erh .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
26 1.145 erh exists(${BSDSRCDIR}/lib/checkver)
27 1.143 erh checkver:
28 1.144 erh @(cd ${.CURDIR} && \
29 1.176 gmcgarry sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
30 1.154 simonb -d ${DESTDIR}${LIBDIR} ${LIB})
31 1.173 christos .endif
32 1.173 christos .endif
33 1.173 christos
34 1.173 christos .if !target(checkver)
35 1.143 erh checkver:
36 1.143 erh .endif
37 1.173 christos
38 1.169 thorpej print-shlib-major:
39 1.185 tv .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
40 1.169 thorpej @echo ${SHLIB_MAJOR}
41 1.173 christos .else
42 1.173 christos @false
43 1.173 christos .endif
44 1.169 thorpej
45 1.169 thorpej print-shlib-minor:
46 1.185 tv .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
47 1.169 thorpej @echo ${SHLIB_MINOR}
48 1.173 christos .else
49 1.173 christos @false
50 1.173 christos .endif
51 1.171 christos
52 1.171 christos print-shlib-teeny:
53 1.185 tv .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
54 1.171 christos @echo ${SHLIB_TEENY}
55 1.143 erh .else
56 1.169 thorpej @false
57 1.173 christos .endif
58 1.169 thorpej
59 1.173 christos .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
60 1.173 christos .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
61 1.173 christos .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
62 1.173 christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
63 1.173 christos .else
64 1.173 christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
65 1.173 christos .endif
66 1.173 christos .else
67 1.173 christos SHLIB_FULLVERSION=${SHLIB_MAJOR}
68 1.173 christos .endif
69 1.35 pk .endif
70 1.1 cgd
71 1.101 mycroft # add additional suffixes not exported.
72 1.101 mycroft # .po is used for profiling object files.
73 1.101 mycroft # .so is used for PIC object files.
74 1.118 lukem .SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
75 1.118 lukem .SUFFIXES: .sh .m4 .m
76 1.82 mikel
77 1.86 jonathan
78 1.86 jonathan # Set PICFLAGS to cc flags for producing position-independent code,
79 1.86 jonathan # if not already set. Includes -DPIC, if required.
80 1.86 jonathan
81 1.164 simonb # Data-driven table using make variables to control how shared libraries
82 1.86 jonathan # are built for different platforms and object formats.
83 1.125 jonathan # OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
84 1.164 simonb # SHLIB_SOVERSION: version number to be compiled into a shared library
85 1.164 simonb # via -soname. Usualy ${SHLIB_MAJOR} on ELF.
86 1.173 christos # NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
87 1.173 christos # [.${SHLIB_TEENY}]]
88 1.164 simonb # SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
89 1.123 jonathan # with ELF, also set shared-lib version for ld.so.
90 1.123 jonathan # SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
91 1.123 jonathan # SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
92 1.179 dmcmahil # FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
93 1.164 simonb # CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
94 1.164 simonb # CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
95 1.164 simonb # CAPICFLAGS flags for {$CC} to compiling .[Ss] files
96 1.107 jonathan # (usually just ${CPPPICFLAGS} ${CPICFLAGS})
97 1.164 simonb # APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
98 1.86 jonathan
99 1.148 lukem .if ${MACHINE_ARCH} == "alpha"
100 1.123 jonathan # Alpha-specific shared library flags
101 1.179 dmcmahil FPICFLAGS ?= -fPIC
102 1.165 dmcmahil CPICFLAGS ?= -fPIC -DPIC
103 1.107 jonathan CPPPICFLAGS?= -DPIC
104 1.107 jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
105 1.107 jonathan APICFLAGS ?=
106 1.151 drochner .elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
107 1.123 jonathan # mips-specific shared library flags
108 1.86 jonathan
109 1.160 simonb # On mips, all libs are compiled with ABIcalls, not just sharedlibs.
110 1.160 simonb MKPICLIB= no
111 1.160 simonb
112 1.160 simonb # so turn shlib PIC flags on for ${AS}.
113 1.160 simonb AINC+=-DABICALLS
114 1.86 jonathan AFLAGS+= -fPIC
115 1.86 jonathan AS+= -KPIC
116 1.172 matt
117 1.172 matt .elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
118 1.172 matt # On the VAX, all object are PIC by default, not just sharedlibs.
119 1.172 matt MKPICLIB= no
120 1.150 christos
121 1.175 mrg .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
122 1.175 mrg ${OBJECT_FMT} == "ELF"
123 1.150 christos
124 1.179 dmcmahil FPICFLAGS ?= -fPIC
125 1.165 dmcmahil CPICFLAGS ?= -fPIC -DPIC
126 1.150 christos CPPPICFLAGS?= -DPIC
127 1.150 christos CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
128 1.150 christos APICFLAGS ?= -KPIC
129 1.86 jonathan
130 1.86 jonathan .else
131 1.86 jonathan
132 1.125 jonathan # Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
133 1.88 cgd SHLIB_LDSTARTFILE=
134 1.88 cgd SHLIB_LDENDFILE=
135 1.171 christos SHLIB_SOVERSION=${SHLIB_FULLVERSION}
136 1.125 jonathan SHLIB_SHFLAGS=
137 1.179 dmcmahil FPICFLAGS ?= -fPIC
138 1.165 dmcmahil CPICFLAGS?= -fPIC -DPIC
139 1.107 jonathan CPPPICFLAGS?= -DPIC
140 1.107 jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
141 1.107 jonathan APICFLAGS?= -k
142 1.86 jonathan
143 1.86 jonathan .endif
144 1.86 jonathan
145 1.160 simonb MKPICLIB?= yes
146 1.160 simonb
147 1.123 jonathan # Platform-independent linker flags for ELF shared libraries
148 1.148 lukem .if ${OBJECT_FMT} == "ELF"
149 1.182 mrg SHLIB_SOVERSION= ${SHLIB_MAJOR}
150 1.182 mrg SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
151 1.182 mrg SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
152 1.182 mrg SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
153 1.123 jonathan .endif
154 1.86 jonathan
155 1.82 mikel CFLAGS+= ${COPTS}
156 1.179 dmcmahil FFLAGS+= ${FOPTS}
157 1.1 cgd
158 1.1 cgd .c.o:
159 1.153 christos .if defined(COPTS) && !empty(COPTS:M*-g*)
160 1.153 christos ${COMPILE.c} ${.IMPSRC}
161 1.153 christos .else
162 1.80 christos @echo ${COMPILE.c:Q} ${.IMPSRC}
163 1.122 cgd @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
164 1.62 christos @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
165 1.62 christos @rm -f ${.TARGET}.o
166 1.153 christos .endif
167 1.1 cgd
168 1.1 cgd .c.po:
169 1.153 christos .if defined(COPTS) && !empty(COPTS:M*-g*)
170 1.153 christos ${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
171 1.153 christos .else
172 1.80 christos @echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
173 1.68 cgd @${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
174 1.62 christos @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
175 1.62 christos @rm -f ${.TARGET}.o
176 1.153 christos .endif
177 1.17 mycroft
178 1.27 pk .c.so:
179 1.153 christos .if defined(COPTS) && !empty(COPTS:M*-g*)
180 1.153 christos ${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
181 1.153 christos .else
182 1.86 jonathan @echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
183 1.86 jonathan @${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
184 1.62 christos @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
185 1.62 christos @rm -f ${.TARGET}.o
186 1.153 christos .endif
187 1.27 pk
188 1.58 cgd .c.ln:
189 1.121 thorpej ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
190 1.58 cgd
191 1.18 mycroft .cc.o .C.o:
192 1.153 christos .if defined(COPTS) && !empty(COPTS:M*-g*)
193 1.153 christos ${COMPILE.cc} ${.IMPSRC}
194 1.153 christos .else
195 1.80 christos @echo ${COMPILE.cc:Q} ${.IMPSRC}
196 1.62 christos @${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
197 1.63 jtc @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
198 1.62 christos @rm -f ${.TARGET}.o
199 1.153 christos .endif
200 1.17 mycroft
201 1.18 mycroft .cc.po .C.po:
202 1.153 christos .if defined(COPTS) && !empty(COPTS:M*-g*)
203 1.153 christos ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
204 1.153 christos .else
205 1.80 christos @echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
206 1.68 cgd @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
207 1.62 christos @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
208 1.62 christos @rm -f ${.TARGET}.o
209 1.153 christos .endif
210 1.28 cgd
211 1.28 cgd .cc.so .C.so:
212 1.153 christos .if defined(COPTS) && !empty(COPTS:M*-g*)
213 1.153 christos ${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
214 1.153 christos .else
215 1.86 jonathan @echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
216 1.86 jonathan @${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
217 1.62 christos @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
218 1.62 christos @rm -f ${.TARGET}.o
219 1.153 christos .endif
220 1.118 lukem
221 1.179 dmcmahil .f.o:
222 1.179 dmcmahil .if defined(FOPTS) && !empty(FOPTS:M*-g*)
223 1.179 dmcmahil ${COMPILE.f} ${.IMPSRC}
224 1.179 dmcmahil .else
225 1.179 dmcmahil @echo ${COMPILE.f:Q} ${.IMPSRC}
226 1.179 dmcmahil @${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
227 1.179 dmcmahil @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
228 1.179 dmcmahil @rm -f ${.TARGET}.o
229 1.179 dmcmahil .endif
230 1.179 dmcmahil
231 1.179 dmcmahil .f.po:
232 1.179 dmcmahil .if defined(FOPTS) && !empty(FOPTS:M*-g*)
233 1.179 dmcmahil ${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
234 1.179 dmcmahil .else
235 1.179 dmcmahil @echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
236 1.179 dmcmahil @${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
237 1.179 dmcmahil @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
238 1.179 dmcmahil @rm -f ${.TARGET}.o
239 1.179 dmcmahil .endif
240 1.179 dmcmahil
241 1.179 dmcmahil .f.so:
242 1.179 dmcmahil .if defined(FOPTS) && !empty(FOPTS:M*-g*)
243 1.179 dmcmahil ${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
244 1.179 dmcmahil .else
245 1.179 dmcmahil @echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
246 1.179 dmcmahil @${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
247 1.179 dmcmahil @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
248 1.179 dmcmahil @rm -f ${.TARGET}.o
249 1.179 dmcmahil .endif
250 1.179 dmcmahil
251 1.179 dmcmahil .f.ln:
252 1.179 dmcmahil ${ECHO} Skipping lint for Fortran libraries.
253 1.179 dmcmahil
254 1.118 lukem .m.o:
255 1.153 christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
256 1.153 christos ${COMPILE.m} ${.IMPSRC}
257 1.153 christos .else
258 1.118 lukem @echo ${COMPILE.m:Q} ${.IMPSRC}
259 1.122 cgd @${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
260 1.118 lukem @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
261 1.118 lukem @rm -f ${.TARGET}.o
262 1.153 christos .endif
263 1.118 lukem
264 1.118 lukem .m.po:
265 1.153 christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
266 1.153 christos ${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
267 1.153 christos .else
268 1.118 lukem @echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
269 1.118 lukem @${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
270 1.118 lukem @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
271 1.118 lukem @rm -f ${.TARGET}.o
272 1.153 christos .endif
273 1.118 lukem
274 1.118 lukem .m.so:
275 1.153 christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
276 1.153 christos ${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
277 1.153 christos .else
278 1.118 lukem @echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
279 1.118 lukem @${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
280 1.118 lukem @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
281 1.118 lukem @rm -f ${.TARGET}.o
282 1.153 christos .endif
283 1.1 cgd
284 1.40 cgd .S.o .s.o:
285 1.80 christos @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
286 1.69 jtc @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
287 1.62 christos @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
288 1.62 christos @rm -f ${.TARGET}.o
289 1.1 cgd
290 1.40 cgd .S.po .s.po:
291 1.80 christos @echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
292 1.75 jtc @${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
293 1.62 christos @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
294 1.62 christos @rm -f ${.TARGET}.o
295 1.1 cgd
296 1.40 cgd .S.so .s.so:
297 1.107 jonathan @echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
298 1.107 jonathan @${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
299 1.62 christos @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
300 1.62 christos @rm -f ${.TARGET}.o
301 1.27 pk
302 1.148 lukem .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
303 1.148 lukem || ${MKLINKLIB} != "no"
304 1.130 tv _LIBS=lib${LIB}.a
305 1.130 tv .else
306 1.130 tv _LIBS=
307 1.130 tv .endif
308 1.58 cgd
309 1.167 matt OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
310 1.158 christos
311 1.149 lukem .if ${MKPROFILE} != "no"
312 1.130 tv _LIBS+=lib${LIB}_p.a
313 1.167 matt POBJS+=${OBJS:.o=.po}
314 1.1 cgd .endif
315 1.1 cgd
316 1.148 lukem .if ${MKPIC} != "no"
317 1.160 simonb .if ${MKPICLIB} == "no"
318 1.160 simonb SOLIB=lib${LIB}.a
319 1.160 simonb .else
320 1.160 simonb SOLIB=lib${LIB}_pic.a
321 1.160 simonb _LIBS+=${SOLIB}
322 1.167 matt SOBJS+=${OBJS:.o=.so}
323 1.160 simonb .endif
324 1.171 christos .if defined(SHLIB_FULLVERSION)
325 1.171 christos _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
326 1.27 pk .endif
327 1.35 pk .endif
328 1.27 pk
329 1.179 dmcmahil LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
330 1.179 dmcmahil .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
331 1.58 cgd _LIBS+=llib-l${LIB}.ln
332 1.27 pk .endif
333 1.27 pk
334 1.167 matt .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
335 1.167 matt || ${MKLINKLIB} != "no"
336 1.179 dmcmahil ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
337 1.167 matt .else
338 1.179 dmcmahil ALLOBJS=${POBJS} ${SOBJS}
339 1.179 dmcmahil .endif
340 1.179 dmcmahil .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
341 1.179 dmcmahil ALLOBJS+=${LOBJS}
342 1.167 matt .endif
343 1.186 tv
344 1.186 tv .NOPATH: ${ALLOBJS} ${_LIBS} ${SRCS:M*.[ly]:C/..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
345 1.158 christos
346 1.162 mycroft realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
347 1.1 cgd
348 1.90 christos __archivebuild: .USE
349 1.89 christos @rm -f ${.TARGET}
350 1.138 tv @${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
351 1.89 christos ${RANLIB} ${.TARGET}
352 1.89 christos
353 1.89 christos __archiveinstall: .USE
354 1.156 simonb ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
355 1.156 simonb -g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
356 1.89 christos ${RANLIB} -t ${.TARGET}
357 1.89 christos chmod ${LIBMODE} ${.TARGET}
358 1.89 christos
359 1.186 tv DPSRCS+= ${SRCS:M*.[ly]:C/..$/.c/}
360 1.186 tv CLEANFILES+= ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
361 1.103 mycroft
362 1.89 christos lib${LIB}.a:: ${OBJS} __archivebuild
363 1.1 cgd @echo building standard ${LIB} library
364 1.1 cgd
365 1.89 christos lib${LIB}_p.a:: ${POBJS} __archivebuild
366 1.1 cgd @echo building profiled ${LIB} library
367 1.1 cgd
368 1.89 christos lib${LIB}_pic.a:: ${SOBJS} __archivebuild
369 1.27 pk @echo building shared object ${LIB} library
370 1.27 pk
371 1.171 christos lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
372 1.88 cgd ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
373 1.171 christos @echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
374 1.171 christos @rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
375 1.152 fair .if defined(DESTDIR)
376 1.155 wrstuden $(LD) -nostdlib -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
377 1.152 fair ${SHLIB_LDSTARTFILE} \
378 1.160 simonb --whole-archive ${SOLIB} \
379 1.170 erh --no-whole-archive ${LDADD} \
380 1.155 wrstuden -L${DESTDIR}${LIBDIR} -R${LIBDIR} \
381 1.152 fair ${SHLIB_LDENDFILE}
382 1.152 fair .else
383 1.126 jonathan $(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
384 1.123 jonathan ${SHLIB_LDSTARTFILE} \
385 1.160 simonb --whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
386 1.115 cjs ${SHLIB_LDENDFILE}
387 1.152 fair .endif
388 1.148 lukem .if ${OBJECT_FMT} == "ELF"
389 1.177 mycroft ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
390 1.177 mycroft mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
391 1.177 mycroft ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
392 1.177 mycroft mv -f lib${LIB}.so.tmp lib${LIB}.so
393 1.133 tv .endif
394 1.35 pk
395 1.179 dmcmahil .if !empty(LOBJS)
396 1.103 mycroft LLIBS?= -lc
397 1.58 cgd llib-l${LIB}.ln: ${LOBJS}
398 1.58 cgd @echo building llib-l${LIB}.ln
399 1.58 cgd @rm -f llib-l${LIB}.ln
400 1.141 wrstuden @${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
401 1.179 dmcmahil .endif
402 1.1 cgd
403 1.81 cgd cleanlib:
404 1.48 mycroft rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
405 1.59 cgd rm -f lib${LIB}.a ${OBJS}
406 1.59 cgd rm -f lib${LIB}_p.a ${POBJS}
407 1.133 tv rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
408 1.59 cgd rm -f llib-l${LIB}.ln ${LOBJS}
409 1.1 cgd
410 1.26 mycroft .if defined(SRCS)
411 1.64 christos afterdepend: .depend
412 1.1 cgd @(TMP=/tmp/_depend$$$$; \
413 1.79 cgd sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
414 1.58 cgd < .depend > $$TMP; \
415 1.1 cgd mv $$TMP .depend)
416 1.26 mycroft .endif
417 1.1 cgd
418 1.97 mycroft .if !target(libinstall)
419 1.148 lukem # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
420 1.139 tv libinstall::
421 1.139 tv
422 1.148 lukem .if ${MKLINKLIB} != "no"
423 1.89 christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
424 1.168 mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
425 1.89 christos .if !defined(UPDATE)
426 1.89 christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
427 1.89 christos .endif
428 1.168 mycroft
429 1.157 fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
430 1.89 christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
431 1.89 christos .endif
432 1.89 christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
433 1.130 tv .endif
434 1.89 christos
435 1.149 lukem .if ${MKPROFILE} != "no"
436 1.89 christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
437 1.168 mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
438 1.89 christos .if !defined(UPDATE)
439 1.89 christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
440 1.32 pk .endif
441 1.168 mycroft
442 1.157 fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
443 1.89 christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
444 1.89 christos .endif
445 1.89 christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
446 1.89 christos .endif
447 1.89 christos
448 1.149 lukem .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
449 1.168 mycroft libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
450 1.160 simonb .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
451 1.89 christos .if !defined(UPDATE)
452 1.89 christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
453 1.89 christos .endif
454 1.168 mycroft
455 1.157 fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
456 1.89 christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
457 1.33 pk .endif
458 1.160 simonb .if ${MKPICLIB} == "no"
459 1.160 simonb ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
460 1.160 simonb rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
461 1.160 simonb ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
462 1.160 simonb .else
463 1.89 christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
464 1.160 simonb .endif
465 1.89 christos .endif
466 1.89 christos
467 1.171 christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
468 1.171 christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
469 1.171 christos .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
470 1.89 christos .if !defined(UPDATE)
471 1.171 christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
472 1.89 christos .endif
473 1.168 mycroft
474 1.171 christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
475 1.171 christos ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
476 1.89 christos .endif
477 1.171 christos ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
478 1.156 simonb ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
479 1.156 simonb -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
480 1.148 lukem .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
481 1.146 thorpej /sbin/ldconfig -m ${LIBDIR}
482 1.146 thorpej .endif
483 1.148 lukem .if ${OBJECT_FMT} == "ELF"
484 1.178 mycroft ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
485 1.177 mycroft ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
486 1.178 mycroft mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
487 1.83 cgd ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
488 1.148 lukem .if ${MKLINKLIB} != "no"
489 1.178 mycroft ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
490 1.177 mycroft ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
491 1.178 mycroft mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
492 1.83 cgd ${DESTDIR}${LIBDIR}/lib${LIB}.so
493 1.83 cgd .endif
494 1.12 cgd .endif
495 1.139 tv .endif
496 1.89 christos
497 1.179 dmcmahil .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
498 1.89 christos libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
499 1.168 mycroft .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
500 1.89 christos .if !defined(UPDATE)
501 1.89 christos .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
502 1.89 christos .endif
503 1.168 mycroft
504 1.157 fredb .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
505 1.89 christos ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
506 1.89 christos .endif
507 1.95 mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
508 1.156 simonb ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
509 1.156 simonb -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
510 1.58 cgd .endif
511 1.1 cgd .endif
512 1.1 cgd
513 1.1 cgd .include <bsd.man.mk>
514 1.57 jtc .include <bsd.nls.mk>
515 1.91 christos .include <bsd.files.mk>
516 1.89 christos .include <bsd.inc.mk>
517 1.109 cjs .include <bsd.links.mk>
518 1.24 mycroft .include <bsd.dep.mk>
519 1.66 christos .include <bsd.sys.mk>
520 1.117 mycroft
521 1.117 mycroft # Make sure all of the standard targets are defined, even if they do nothing.
522 1.117 mycroft lint regress:
523