Annotation of src/share/mk/bsd.lib.mk, Revision 1.197
1.197 ! mycroft 1: # $NetBSD: bsd.lib.mk,v 1.196 2001/12/28 01:40:50 lukem 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}) && \
22: exists(${BSDSRCDIR}/lib/checkver)
1.143 erh 23: checkver:
1.144 erh 24: @(cd ${.CURDIR} && \
1.176 gmcgarry 25: sh ${BSDSRCDIR}/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.150 christos 119:
1.179 dmcmahil 120: FPICFLAGS ?= -fPIC
1.165 dmcmahil 121: CPICFLAGS ?= -fPIC -DPIC
1.150 christos 122: CPPPICFLAGS?= -DPIC
123: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
124: APICFLAGS ?= -KPIC
1.86 jonathan 125:
126: .else
127:
1.187 nathanw 128: # Platform-independent flags for NetBSD a.out shared libraries
1.171 christos 129: SHLIB_SOVERSION=${SHLIB_FULLVERSION}
1.125 jonathan 130: SHLIB_SHFLAGS=
1.179 dmcmahil 131: FPICFLAGS ?= -fPIC
1.165 dmcmahil 132: CPICFLAGS?= -fPIC -DPIC
1.107 jonathan 133: CPPPICFLAGS?= -DPIC
134: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
135: APICFLAGS?= -k
1.86 jonathan 136:
137: .endif
138:
1.160 simonb 139: MKPICLIB?= yes
140:
1.123 jonathan 141: # Platform-independent linker flags for ELF shared libraries
1.148 lukem 142: .if ${OBJECT_FMT} == "ELF"
1.182 mrg 143: SHLIB_SOVERSION= ${SHLIB_MAJOR}
144: SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
145: SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
146: SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
1.123 jonathan 147: .endif
1.86 jonathan 148:
1.82 mikel 149: CFLAGS+= ${COPTS}
1.179 dmcmahil 150: FFLAGS+= ${FOPTS}
1.1 cgd 151:
152: .c.o:
1.153 christos 153: .if defined(COPTS) && !empty(COPTS:M*-g*)
154: ${COMPILE.c} ${.IMPSRC}
155: .else
1.80 christos 156: @echo ${COMPILE.c:Q} ${.IMPSRC}
1.122 cgd 157: @${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
1.62 christos 158: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
159: @rm -f ${.TARGET}.o
1.153 christos 160: .endif
1.1 cgd 161:
162: .c.po:
1.153 christos 163: .if defined(COPTS) && !empty(COPTS:M*-g*)
164: ${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
165: .else
1.80 christos 166: @echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
1.68 cgd 167: @${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
1.62 christos 168: @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
169: @rm -f ${.TARGET}.o
1.153 christos 170: .endif
1.17 mycroft 171:
1.27 pk 172: .c.so:
1.153 christos 173: .if defined(COPTS) && !empty(COPTS:M*-g*)
174: ${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
175: .else
1.86 jonathan 176: @echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
177: @${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
1.62 christos 178: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
179: @rm -f ${.TARGET}.o
1.153 christos 180: .endif
1.27 pk 181:
1.58 cgd 182: .c.ln:
1.121 thorpej 183: ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
1.58 cgd 184:
1.18 mycroft 185: .cc.o .C.o:
1.153 christos 186: .if defined(COPTS) && !empty(COPTS:M*-g*)
187: ${COMPILE.cc} ${.IMPSRC}
188: .else
1.80 christos 189: @echo ${COMPILE.cc:Q} ${.IMPSRC}
1.62 christos 190: @${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
1.63 jtc 191: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
1.62 christos 192: @rm -f ${.TARGET}.o
1.153 christos 193: .endif
1.17 mycroft 194:
1.18 mycroft 195: .cc.po .C.po:
1.153 christos 196: .if defined(COPTS) && !empty(COPTS:M*-g*)
197: ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
198: .else
1.80 christos 199: @echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
1.68 cgd 200: @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
1.62 christos 201: @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
202: @rm -f ${.TARGET}.o
1.153 christos 203: .endif
1.28 cgd 204:
205: .cc.so .C.so:
1.153 christos 206: .if defined(COPTS) && !empty(COPTS:M*-g*)
207: ${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
208: .else
1.86 jonathan 209: @echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
210: @${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
1.62 christos 211: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
212: @rm -f ${.TARGET}.o
1.153 christos 213: .endif
1.118 lukem 214:
1.179 dmcmahil 215: .f.o:
216: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
217: ${COMPILE.f} ${.IMPSRC}
218: .else
219: @echo ${COMPILE.f:Q} ${.IMPSRC}
220: @${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
221: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
222: @rm -f ${.TARGET}.o
223: .endif
224:
225: .f.po:
226: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
227: ${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
228: .else
229: @echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
230: @${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
231: @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
232: @rm -f ${.TARGET}.o
233: .endif
234:
235: .f.so:
236: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
237: ${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
238: .else
239: @echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
240: @${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
241: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
242: @rm -f ${.TARGET}.o
243: .endif
244:
245: .f.ln:
246: ${ECHO} Skipping lint for Fortran libraries.
247:
1.118 lukem 248: .m.o:
1.153 christos 249: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
250: ${COMPILE.m} ${.IMPSRC}
251: .else
1.118 lukem 252: @echo ${COMPILE.m:Q} ${.IMPSRC}
1.122 cgd 253: @${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
1.118 lukem 254: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
255: @rm -f ${.TARGET}.o
1.153 christos 256: .endif
1.118 lukem 257:
258: .m.po:
1.153 christos 259: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
260: ${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
261: .else
1.118 lukem 262: @echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
263: @${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
264: @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
265: @rm -f ${.TARGET}.o
1.153 christos 266: .endif
1.118 lukem 267:
268: .m.so:
1.153 christos 269: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
270: ${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
271: .else
1.118 lukem 272: @echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
273: @${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
274: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
275: @rm -f ${.TARGET}.o
1.153 christos 276: .endif
1.1 cgd 277:
1.40 cgd 278: .S.o .s.o:
1.80 christos 279: @echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
1.69 jtc 280: @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
1.62 christos 281: @${LD} -x -r ${.TARGET}.o -o ${.TARGET}
282: @rm -f ${.TARGET}.o
1.1 cgd 283:
1.40 cgd 284: .S.po .s.po:
1.80 christos 285: @echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
1.75 jtc 286: @${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
1.62 christos 287: @${LD} -X -r ${.TARGET}.o -o ${.TARGET}
288: @rm -f ${.TARGET}.o
1.1 cgd 289:
1.40 cgd 290: .S.so .s.so:
1.107 jonathan 291: @echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
292: @${COMPILE.S} ${CAPICFLAGS} ${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.27 pk 295:
1.148 lukem 296: .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
297: || ${MKLINKLIB} != "no"
1.130 tv 298: _LIBS=lib${LIB}.a
299: .else
300: _LIBS=
301: .endif
1.58 cgd 302:
1.167 matt 303: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.158 christos 304:
1.149 lukem 305: .if ${MKPROFILE} != "no"
1.130 tv 306: _LIBS+=lib${LIB}_p.a
1.167 matt 307: POBJS+=${OBJS:.o=.po}
1.1 cgd 308: .endif
309:
1.148 lukem 310: .if ${MKPIC} != "no"
1.160 simonb 311: .if ${MKPICLIB} == "no"
312: SOLIB=lib${LIB}.a
313: .else
314: SOLIB=lib${LIB}_pic.a
315: _LIBS+=${SOLIB}
1.167 matt 316: SOBJS+=${OBJS:.o=.so}
1.160 simonb 317: .endif
1.171 christos 318: .if defined(SHLIB_FULLVERSION)
319: _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
1.27 pk 320: .endif
1.35 pk 321: .endif
1.27 pk 322:
1.179 dmcmahil 323: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
324: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.58 cgd 325: _LIBS+=llib-l${LIB}.ln
1.27 pk 326: .endif
327:
1.167 matt 328: .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
329: || ${MKLINKLIB} != "no"
1.179 dmcmahil 330: ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
1.167 matt 331: .else
1.179 dmcmahil 332: ALLOBJS=${POBJS} ${SOBJS}
333: .endif
334: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
335: ALLOBJS+=${LOBJS}
1.167 matt 336: .endif
1.186 tv 337:
1.191 tv 338: .NOPATH: ${ALLOBJS} ${_LIBS} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.158 christos 339:
1.162 mycroft 340: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
1.1 cgd 341:
1.90 christos 342: __archivebuild: .USE
1.89 christos 343: @rm -f ${.TARGET}
1.138 tv 344: @${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.89 christos 345: ${RANLIB} ${.TARGET}
346:
347: __archiveinstall: .USE
1.188 tv 348: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
1.89 christos 349: ${RANLIB} -t ${.TARGET}
350: chmod ${LIBMODE} ${.TARGET}
351:
1.197 ! mycroft 352: __archivesymlinkpic: .USE
! 353: ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
! 354:
1.191 tv 355: DPSRCS+= ${SRCS:M*.[ly]:C/\..$/.c/}
1.186 tv 356: CLEANFILES+= ${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.103 mycroft 357:
1.89 christos 358: lib${LIB}.a:: ${OBJS} __archivebuild
1.1 cgd 359: @echo building standard ${LIB} library
360:
1.89 christos 361: lib${LIB}_p.a:: ${POBJS} __archivebuild
1.1 cgd 362: @echo building profiled ${LIB} library
363:
1.89 christos 364: lib${LIB}_pic.a:: ${SOBJS} __archivebuild
1.27 pk 365: @echo building shared object ${LIB} library
366:
1.171 christos 367: lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
1.88 cgd 368: ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.171 christos 369: @echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
370: @rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
1.152 fair 371: .if defined(DESTDIR)
1.155 wrstuden 372: $(LD) -nostdlib -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
1.152 fair 373: ${SHLIB_LDSTARTFILE} \
1.160 simonb 374: --whole-archive ${SOLIB} \
1.170 erh 375: --no-whole-archive ${LDADD} \
1.195 lukem 376: -L${DESTDIR}${_LIBSODIR} -L${DESTDIR}${LIBDIR} \
377: -R${_LIBSODIR} -R${LIBDIR} \
1.152 fair 378: ${SHLIB_LDENDFILE}
379: .else
1.126 jonathan 380: $(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
1.123 jonathan 381: ${SHLIB_LDSTARTFILE} \
1.160 simonb 382: --whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
1.115 cjs 383: ${SHLIB_LDENDFILE}
1.152 fair 384: .endif
1.148 lukem 385: .if ${OBJECT_FMT} == "ELF"
1.196 lukem 386: # We don't use INSTALL_SYMLINK here because this is just
387: # happening inside the build directory/objdir. XXX Why does
388: # this spend so much effort on libraries that aren't live??? XXX
1.177 mycroft 389: ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
390: mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
391: ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
392: mv -f lib${LIB}.so.tmp lib${LIB}.so
1.133 tv 393: .endif
1.35 pk 394:
1.179 dmcmahil 395: .if !empty(LOBJS)
1.103 mycroft 396: LLIBS?= -lc
1.58 cgd 397: llib-l${LIB}.ln: ${LOBJS}
398: @echo building llib-l${LIB}.ln
399: @rm -f llib-l${LIB}.ln
1.141 wrstuden 400: @${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.179 dmcmahil 401: .endif
1.1 cgd 402:
1.81 cgd 403: cleanlib:
1.48 mycroft 404: rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59 cgd 405: rm -f lib${LIB}.a ${OBJS}
406: rm -f lib${LIB}_p.a ${POBJS}
1.133 tv 407: rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
1.59 cgd 408: rm -f llib-l${LIB}.ln ${LOBJS}
1.1 cgd 409:
1.26 mycroft 410: .if defined(SRCS)
1.64 christos 411: afterdepend: .depend
1.1 cgd 412: @(TMP=/tmp/_depend$$$$; \
1.79 cgd 413: sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
1.58 cgd 414: < .depend > $$TMP; \
1.1 cgd 415: mv $$TMP .depend)
1.26 mycroft 416: .endif
1.1 cgd 417:
1.97 mycroft 418: .if !target(libinstall)
1.148 lukem 419: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139 tv 420: libinstall::
421:
1.148 lukem 422: .if ${MKLINKLIB} != "no"
1.89 christos 423: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.168 mycroft 424: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.197 ! mycroft 425:
1.89 christos 426: .if !defined(UPDATE)
1.197 ! mycroft 427: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
! 428: ${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
1.89 christos 429: .endif
1.197 ! mycroft 430: ${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
! 431: .else
1.157 fredb 432: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
1.89 christos 433: ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
434: .endif
435: ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
1.130 tv 436: .endif
1.197 ! mycroft 437: .endif
1.89 christos 438:
1.149 lukem 439: .if ${MKPROFILE} != "no"
1.89 christos 440: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.168 mycroft 441: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.197 ! mycroft 442:
1.89 christos 443: .if !defined(UPDATE)
1.197 ! mycroft 444: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
! 445: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
1.32 pk 446: .endif
1.197 ! mycroft 447: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
! 448: .else
1.157 fredb 449: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
1.89 christos 450: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
451: .endif
452: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
453: .endif
1.197 ! mycroft 454: .endif
1.89 christos 455:
1.149 lukem 456: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.168 mycroft 457: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.160 simonb 458: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.197 ! mycroft 459:
1.89 christos 460: .if !defined(UPDATE)
1.197 ! mycroft 461: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
! 462: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
1.89 christos 463: .endif
1.197 ! mycroft 464: .if ${MKPICLIB} == "no"
! 465: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
! 466: .else
! 467: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
! 468: .endif
! 469: .else
1.157 fredb 470: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
1.89 christos 471: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
1.33 pk 472: .endif
1.160 simonb 473: .if ${MKPICLIB} == "no"
1.197 ! mycroft 474: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
1.160 simonb 475: .else
1.89 christos 476: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
1.160 simonb 477: .endif
1.89 christos 478: .endif
1.197 ! mycroft 479: .endif
1.89 christos 480:
1.171 christos 481: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.195 lukem 482: libinstall:: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
483: .PRECIOUS: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.197 ! mycroft 484:
1.89 christos 485: .if !defined(UPDATE)
1.197 ! mycroft 486: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
! 487: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! .MADE
1.89 christos 488: .endif
1.197 ! mycroft 489: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
! 490: .else
1.171 christos 491: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
1.195 lukem 492: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
1.89 christos 493: .endif
1.195 lukem 494: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
1.197 ! mycroft 495: .endif
1.188 tv 496: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
497: ${.ALLSRC} ${.TARGET}
1.195 lukem 498: .if ${_LIBSODIR} != ${LIBDIR}
499: ${INSTALL_SYMLINK} ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
500: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
501: .endif
1.148 lukem 502: .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
1.195 lukem 503: /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}
1.146 thorpej 504: .endif
1.148 lukem 505: .if ${OBJECT_FMT} == "ELF"
1.195 lukem 506: ${INSTALL_SYMLINK} lib${LIB}.so.${SHLIB_FULLVERSION} \
507: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_MAJOR}
508: .if ${_LIBSODIR} != ${LIBDIR}
509: ${INSTALL_SYMLINK} ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
1.83 cgd 510: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.195 lukem 511: .endif
1.148 lukem 512: .if ${MKLINKLIB} != "no"
1.195 lukem 513: ${INSTALL_SYMLINK} lib${LIB}.so.${SHLIB_FULLVERSION} \
514: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so
515: .if ${_LIBSODIR} != ${LIBDIR}
516: ${INSTALL_SYMLINK} ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
1.83 cgd 517: ${DESTDIR}${LIBDIR}/lib${LIB}.so
1.195 lukem 518: .endif
1.83 cgd 519: .endif
1.12 cgd 520: .endif
1.139 tv 521: .endif
1.89 christos 522:
1.179 dmcmahil 523: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.89 christos 524: libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.168 mycroft 525: .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.197 ! mycroft 526:
1.89 christos 527: .if !defined(UPDATE)
1.197 ! mycroft 528: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
! 529: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
1.89 christos 530: .endif
1.197 ! mycroft 531: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
! 532: .else
1.157 fredb 533: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
1.89 christos 534: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
535: .endif
1.95 mycroft 536: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
1.197 ! mycroft 537: .endif
1.188 tv 538: ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
539: ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
1.58 cgd 540: .endif
1.1 cgd 541: .endif
542:
1.188 tv 543: ##### Pull in related .mk logic
1.1 cgd 544: .include <bsd.man.mk>
1.57 jtc 545: .include <bsd.nls.mk>
1.91 christos 546: .include <bsd.files.mk>
1.89 christos 547: .include <bsd.inc.mk>
1.109 cjs 548: .include <bsd.links.mk>
1.24 mycroft 549: .include <bsd.dep.mk>
1.66 christos 550: .include <bsd.sys.mk>
1.117 mycroft 551:
1.188 tv 552: ${TARGETS}: # ensure existence
CVSweb <webmaster@jp.NetBSD.org>