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