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