1# $Id: lib.mk,v 1.48 2012/11/12 04:08:18 sjg Exp $ 2 3.if !target(__${.PARSEFILE}__) 4__${.PARSEFILE}__: 5 6.include <init.mk> 7 8.if ${OBJECT_FMT} == "ELF" 9NEED_SOLINKS?= yes 10.endif 11 12.if exists(${.CURDIR}/shlib_version) 13SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major 14SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor 15.endif 16 17print-shlib-major: 18.if defined(SHLIB_MAJOR) && ${MK_PIC} != "no" 19 @echo ${SHLIB_MAJOR} 20.else 21 @false 22.endif 23 24print-shlib-minor: 25.if defined(SHLIB_MINOR) && ${MK_PIC} != "no" 26 @echo ${SHLIB_MINOR} 27.else 28 @false 29.endif 30 31print-shlib-teeny: 32.if defined(SHLIB_TEENY) && ${MK_PIC} != "no" 33 @echo ${SHLIB_TEENY} 34.else 35 @false 36.endif 37 38SHLIB_FULLVERSION ?= ${${SHLIB_MAJOR} ${SHLIB_MINOR} ${SHLIB_TEENY}:L:ts.} 39SHLIB_FULLVERSION := ${SHLIB_FULLVERSION} 40 41# add additional suffixes not exported. 42# .po is used for profiling object files. 43# .so is used for PIC object files. 44.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h 45.SUFFIXES: .sh .m4 .m 46 47CFLAGS+= ${COPTS} 48 49# Derrived from NetBSD-1.6 50 51# Set PICFLAGS to cc flags for producing position-independent code, 52# if not already set. Includes -DPIC, if required. 53 54# Data-driven table using make variables to control how shared libraries 55# are built for different platforms and object formats. 56# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk> 57# SHLIB_SOVERSION: version number to be compiled into a shared library 58# via -soname. Usualy ${SHLIB_MAJOR} on ELF. 59# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR} 60# [.${SHLIB_TEENY}]] 61# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library. 62# with ELF, also set shared-lib version for ld.so. 63# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors 64# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors 65# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects. 66# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS} 67# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects. 68# CAPICFLAGS flags for {$CC} to compiling .[Ss] files 69# (usually just ${CPPPICFLAGS} ${CPICFLAGS}) 70# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects. 71 72.if ${TARGET_OSNAME} == "NetBSD" 73.if ${MACHINE_ARCH} == "alpha" 74 # Alpha-specific shared library flags 75FPICFLAGS ?= -fPIC 76CPICFLAGS ?= -fPIC -DPIC 77CPPPICFLAGS?= -DPIC 78CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} 79APICFLAGS ?= 80.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" 81 # mips-specific shared library flags 82 83# On mips, all libs are compiled with ABIcalls, not just sharedlibs. 84MKPICLIB= no 85 86# so turn shlib PIC flags on for ${AS}. 87AINC+=-DABICALLS 88AFLAGS+= -fPIC 89AS+= -KPIC 90 91.elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF" 92# On the VAX, all object are PIC by default, not just sharedlibs. 93MKPICLIB= no 94 95.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \ 96 ${OBJECT_FMT} == "ELF" 97# If you use -fPIC you need to define BIGPIC to turn on 32-bit 98# relocations in asm code 99FPICFLAGS ?= -fPIC 100CPICFLAGS ?= -fPIC -DPIC 101CPPPICFLAGS?= -DPIC -DBIGPIC 102CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} 103APICFLAGS ?= -KPIC 104 105.else 106 107# Platform-independent flags for NetBSD a.out shared libraries 108SHLIB_SOVERSION=${SHLIB_FULLVERSION} 109SHLIB_SHFLAGS= 110FPICFLAGS ?= -fPIC 111CPICFLAGS?= -fPIC -DPIC 112CPPPICFLAGS?= -DPIC 113CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS} 114APICFLAGS?= -k 115 116.endif 117 118# Platform-independent linker flags for ELF shared libraries 119.if ${OBJECT_FMT} == "ELF" 120SHLIB_SOVERSION= ${SHLIB_MAJOR} 121SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION} 122SHLIB_LDSTARTFILE?= /usr/lib/crtbeginS.o 123SHLIB_LDENDFILE?= /usr/lib/crtendS.o 124.endif 125 126# for compatability with the following 127CC_PIC?= ${CPICFLAGS} 128LD_shared=${SHLIB_SHFLAGS} 129 130.endif # NetBSD 131 132.if ${TARGET_OSNAME} == "FreeBSD" 133.if ${OBJECT_FMT} == "ELF" 134SHLIB_SOVERSION= ${SHLIB_MAJOR} 135SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION} 136.else 137SHLIB_SHFLAGS= -assert pure-text 138.endif 139SHLIB_LDSTARTFILE= 140SHLIB_LDENDFILE= 141CC_PIC?= -fpic 142LD_shared=${SHLIB_SHFLAGS} 143 144.endif # FreeBSD 145 146MKPICLIB?= yes 147 148# sys.mk can override these 149CC_PG?=-pg 150CC_PIC?=-DPIC 151 152LD_X?=-X 153LD_x?=-x 154LD_r?=-r 155 156# Non BSD machines will be using bmake. 157.if ${TARGET_OSNAME} == "SunOS" 158LD_shared=-assert pure-text 159.if ${OBJECT_FMT} == "ELF" || ${MACHINE} == "solaris" 160# Solaris 161LD_shared=-h lib${LIB}.so.${SHLIB_MAJOR} -G 162.endif 163.elif ${TARGET_OSNAME} == "HP-UX" 164LD_shared=-b 165LD_so=sl 166DLLIB= 167# HPsUX lorder does not grok anything but .o 168LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.so,'` 169LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` 170.elif ${TARGET_OSNAME} == "OSF1" 171LD_shared= -msym -shared -expect_unresolved '*' 172LD_solib= -all lib${LIB}_pic.a 173DLLIB= 174# lorder does not grok anything but .o 175LD_sobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.so,'` 176LD_pobjs=`${LORDER} ${OBJS} | ${TSORT} | sed 's,\.o,.po,'` 177AR_cq= -cqs 178.elif ${TARGET_OSNAME} == "FreeBSD" 179LD_solib= lib${LIB}_pic.a 180.elif ${TARGET_OSNAME} == "Linux" 181# this is ambiguous of course 182LD_shared=-shared -h lib${LIB}.so.${SHLIB_MAJOR} 183LD_solib= --whole-archive lib${LIB}_pic.a 184# Linux uses GNU ld, which is a multi-pass linker 185# so we don't need to use lorder or tsort 186LD_objs = ${OBJS} 187LD_pobjs = ${POBJS} 188LD_sobjs = ${SOBJS} 189.elif ${TARGET_OSNAME} == "Darwin" 190SHLIB_LD = ${CC} 191SHLIB_INSTALL_VERSION ?= ${SHLIB_MAJOR} 192SHLIB_COMPATABILITY_VERSION ?= ${SHLIB_MAJOR}.${SHLIB_MINOR:U0} 193SHLIB_COMPATABILITY ?= \ 194 -compatibility_version ${SHLIB_COMPATABILITY_VERSION} \ 195 -current_version ${SHLIB_FULLVERSION} 196LD_shared = -dynamiclib \ 197 -flat_namespace -undefined suppress \ 198 -install_name ${LIBDIR}/lib${LIB}.${SHLIB_INSTALL_VERSION}.${LD_solink} \ 199 ${SHLIB_COMPATABILITY} 200SHLIB_LINKS = 201.for v in ${SHLIB_COMPATABILITY_VERSION} ${SHLIB_INSTALL_VERSION} 202.if "$v" != "${SHLIB_FULLVERSION}" 203SHLIB_LINKS += lib${LIB}.$v.${LD_solink} 204.endif 205.endfor 206.if ${MK_LINKLIB} != "no" 207SHLIB_LINKS += lib${LIB}.${LD_solink} 208.endif 209 210LD_so = ${SHLIB_FULLVERSION}.dylib 211LD_sobjs = ${SOBJS:O:u} 212LD_solib = ${LD_sobjs} 213SOLIB = ${LD_sobjs} 214LD_solink = dylib 215.if ${MACHINE_ARCH} == "i386" 216PICFLAG ?= -fPIC 217.else 218PICFLAG ?= -fPIC -fno-common 219.endif 220RANLIB = : 221.endif 222 223SHLIB_LD ?= ${LD} 224 225.if !empty(SHLIB_MAJOR) 226.if ${NEED_SOLINKS} && empty(SHLIB_LINKS) 227.if ${MK_LINKLIB} != "no" 228SHLIB_LINKS = lib${LIB}.${LD_solink} 229.endif 230.if "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}" 231SHLIB_LINKS += lib${LIB}.${LD_solink}.${SHLIB_MAJOR} 232.endif 233.endif 234.endif 235 236LIBTOOL?=libtool 237LD_shared ?= -Bshareable -Bforcearchive 238LD_so ?= so.${SHLIB_FULLVERSION} 239LD_solink ?= so 240.if empty(LORDER) 241LD_objs ?= ${OBJS} 242LD_pobjs ?= ${POBJS} 243LD_sobjs ?= ${SOBJS} 244.else 245LD_objs ?= `${LORDER} ${OBJS} | ${TSORT}` 246LD_sobjs ?= `${LORDER} ${SOBJS} | ${TSORT}` 247LD_pobjs ?= `${LORDER} ${POBJS} | ${TSORT}` 248.endif 249LD_solib ?= ${LD_sobjs} 250AR_cq ?= cq 251.if exists(/netbsd) && exists(${DESTDIR}/usr/lib/libdl.so) 252DLLIB ?= -ldl 253.endif 254 255# some libs have lots of objects, and scanning all .o, .po and .So meta files 256# is a waste of time, this tells meta.autodep.mk to just pick one 257# (typically .So) 258# yes, 42 is a random number. 259.if ${MK_META_MODE} == "yes" && ${SRCS:Uno:[\#]} > 42 260OPTIMIZE_OBJECT_META_FILES ?= yes 261.endif 262 263 264.if ${MK_LIBTOOL} == "yes" 265# because libtool is so facist about naming the object files, 266# we cannot (yet) build profiled libs 267MK_PROFILE=no 268_LIBS=lib${LIB}.a 269.if exists(${.CURDIR}/shlib_version) 270SHLIB_AGE != . ${.CURDIR}/shlib_version ; echo $$age 271.endif 272.else 273# for the normal .a we do not want to strip symbols 274.c.o: 275 ${COMPILE.c} ${.IMPSRC} 276 277# for the normal .a we do not want to strip symbols 278.cc.o .C.o: 279 ${COMPILE.cc} ${.IMPSRC} 280 281.S.o .s.o: 282 @echo ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} 283 @${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} 284 285.if (${LD_X} == "") 286.c.po: 287 ${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET} 288 289.cc.po .C.po: 290 ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET} 291 292.S.so .s.so: 293 ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} 294.else 295.c.po: 296 @echo ${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET} 297 @${COMPILE.c} ${CC_PG} ${.IMPSRC} -o ${.TARGET}.o 298 @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} 299 @rm -f ${.TARGET}.o 300 301.cc.po .C.po: 302 @echo ${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET} 303 @${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o 304 @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} 305 @rm -f ${.TARGET}.o 306 307.S.so .s.so: 308 @echo ${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} 309 @${COMPILE.S} ${PICFLAG} ${CC_PIC} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o 310 @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} 311 @rm -f ${.TARGET}.o 312.endif 313 314.if (${LD_x} == "") 315.c.so: 316 ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} 317 318.cc.so .C.so: 319 ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} 320 321.S.po .s.po: 322 ${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} 323.else 324 325.c.so: 326 @echo ${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} 327 @${COMPILE.c} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o 328 @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} 329 @rm -f ${.TARGET}.o 330 331.cc.so .C.so: 332 @echo ${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET} 333 @${COMPILE.cc} ${PICFLAG} ${CC_PIC} ${.IMPSRC} -o ${.TARGET}.o 334 @${LD} ${LD_x} ${LD_r} ${.TARGET}.o -o ${.TARGET} 335 @rm -f ${.TARGET}.o 336 337.S.po .s.po: 338 @echo ${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET} 339 @${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o 340 @${LD} ${LD_X} ${LD_r} ${.TARGET}.o -o ${.TARGET} 341 @rm -f ${.TARGET}.o 342 343.endif 344.endif 345 346.c.ln: 347 ${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} -i ${.IMPSRC} 348 349.if ${MK_LIBTOOL} != "yes" 350 351.if !defined(PICFLAG) 352PICFLAG=-fpic 353.endif 354 355_LIBS= 356 357.if ${MK_ARCHIVE} != "no" 358_LIBS += lib${LIB}.a 359.endif 360 361.if ${MK_PROFILE} != "no" 362_LIBS+=lib${LIB}_p.a 363POBJS+=${OBJS:.o=.po} 364.endif 365 366.if ${MK_PIC} != "no" 367.if ${MK_PICLIB} == "no" 368SOLIB ?= lib${LIB}.a 369.else 370SOLIB=lib${LIB}_pic.a 371_LIBS+=${SOLIB} 372.endif 373.if !empty(SHLIB_FULLVERSION) 374_LIBS+=lib${LIB}.${LD_so} 375.endif 376.endif 377 378.if ${MK_LINT} != "no" 379_LIBS+=llib-l${LIB}.ln 380.endif 381 382# here is where you can define what LIB* are 383.-include <libnames.mk> 384.if ${MK_DPADD_MK} == "yes" 385# lots of cool magic, but might not suit everyone. 386.include <dpadd.mk> 387.endif 388 389.if !defined(_SKIP_BUILD) 390all: prebuild .WAIT ${_LIBS} 391# a hook for things that must be done early 392prebuild: 393.if !defined(.PARSEDIR) 394# no-op is the best we can do if not bmake. 395.WAIT: 396.endif 397.endif 398all: _SUBDIRUSE 399 400.for s in ${SRCS:N*.h:M*/*} 401${.o .so .po .lo:L:@o@${s:T:R}$o@}: $s 402.endfor 403 404OBJS+= ${SRCS:T:N*.h:R:S/$/.o/g} 405.NOPATH: ${OBJS} 406 407.if ${MK_LIBTOOL} == "yes" 408.if ${MK_PIC} == "no" 409LT_STATIC=-static 410.else 411LT_STATIC= 412.endif 413SHLIB_AGE?=0 414 415# .lo's are created as a side effect 416.s.o .S.o .c.o: 417 ${LIBTOOL} --mode=compile ${CC} ${LT_STATIC} ${CFLAGS} ${CPPFLAGS} ${IMPFLAGS} -c ${.IMPSRC} 418 419# can't really do profiled libs with libtool - its too facist about 420# naming the output... 421lib${LIB}.a:: ${OBJS} 422 @rm -f ${.TARGET} 423 ${LIBTOOL} --mode=link ${CC} ${LT_STATIC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${SHLIBDIR}:/usr/lib -version-info ${SHLIB_MAJOR}:${SHLIB_MINOR}:${SHLIB_AGE} 424 @ln .libs/${.TARGET} . 425 426lib${LIB}.${LD_so}:: lib${LIB}.a 427 @[ -s ${.TARGET}.${SHLIB_AGE} ] || { ln -s .libs/lib${LIB}.${LD_so}* . 2>/dev/null; : } 428 @[ -s ${.TARGET} ] || ln -s ${.TARGET}.${SHLIB_AGE} ${.TARGET} 429 430.else # MK_LIBTOOL=yes 431 432lib${LIB}.a:: ${OBJS} 433 @echo building standard ${LIB} library 434 @rm -f ${.TARGET} 435 @${AR} ${AR_cq} ${.TARGET} ${LD_objs} 436 ${RANLIB} ${.TARGET} 437 438POBJS+= ${OBJS:.o=.po} 439.NOPATH: ${POBJS} 440lib${LIB}_p.a:: ${POBJS} 441 @echo building profiled ${LIB} library 442 @rm -f ${.TARGET} 443 @${AR} ${AR_cq} ${.TARGET} ${LD_pobjs} 444 ${RANLIB} ${.TARGET} 445 446SOBJS+= ${OBJS:.o=.so} 447.NOPATH: ${SOBJS} 448lib${LIB}_pic.a:: ${SOBJS} 449 @echo building shared object ${LIB} library 450 @rm -f ${.TARGET} 451 @${AR} ${AR_cq} ${.TARGET} ${LD_sobjs} 452 ${RANLIB} ${.TARGET} 453 454#SHLIB_LDADD?= ${LDADD} 455 456# bound to be non-portable... 457# this is known to work for NetBSD 1.6 and FreeBSD 4.2 458lib${LIB}.${LD_so}: ${SOLIB} ${DPADD} 459 @echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\) 460 @rm -f ${.TARGET} 461.if ${TARGET_OSNAME} == "NetBSD" || ${TARGET_OSNAME} == "FreeBSD" 462.if ${OBJECT_FMT} == "ELF" 463 ${SHLIB_LD} -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \ 464 ${SHLIB_LDSTARTFILE} \ 465 --whole-archive ${SOLIB} --no-whole-archive ${SHLIB_LDADD} \ 466 ${SHLIB_LDENDFILE} 467.else 468 ${SHLIB_LD} ${LD_x} ${LD_shared} \ 469 -o ${.TARGET} ${SOLIB} ${SHLIB_LDADD} 470.endif 471.else 472 ${SHLIB_LD} -o ${.TARGET} ${LD_shared} ${LD_solib} ${DLLIB} ${SHLIB_LDADD} 473.endif 474.endif 475.if !empty(SHLIB_LINKS) 476 rm -f ${SHLIB_LINKS}; ${SHLIB_LINKS:O:u:@x@ln -s ${.TARGET} $x;@} 477.endif 478 479LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} 480.NOPATH: ${LOBJS} 481LLIBS?= -lc 482llib-l${LIB}.ln: ${LOBJS} 483 @echo building llib-l${LIB}.ln 484 @rm -f llib-l${LIB}.ln 485 @${LINT} -C${LIB} ${LOBJS} ${LLIBS} 486 487.if !target(clean) 488cleanlib: .PHONY 489 rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} 490 rm -f lib${LIB}.a ${OBJS} 491 rm -f lib${LIB}_p.a ${POBJS} 492 rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS} 493 rm -f llib-l${LIB}.ln ${LOBJS} 494.if !empty(SHLIB_LINKS) 495 rm -f ${SHLIB_LINKS} 496.endif 497 498clean: _SUBDIRUSE cleanlib 499cleandir: _SUBDIRUSE cleanlib 500.else 501cleandir: _SUBDIRUSE clean 502.endif 503 504.if defined(SRCS) && (!defined(MKDEP) || ${MKDEP} != autodep) 505afterdepend: .depend 506 @(TMP=/tmp/_depend$$$$; \ 507 sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \ 508 < .depend > $$TMP; \ 509 mv $$TMP .depend) 510.endif 511 512.if !target(install) 513.if !target(beforeinstall) 514beforeinstall: 515.endif 516 517.if !empty(LIBOWN) 518LIB_INSTALL_OWN ?= -o ${LIBOWN} -g ${LIBGRP} 519.endif 520 521.include <links.mk> 522 523.if !target(realinstall) 524realinstall: libinstall 525.endif 526.if !target(libinstall) 527libinstall: 528 [ -d ${DESTDIR}/${LIBDIR} ] || \ 529 ${INSTALL} -d ${LIB_INSTALL_OWN} -m 775 ${DESTDIR}${LIBDIR} 530.if ${MK_ARCHIVE} != "no" 531 ${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 600 lib${LIB}.a \ 532 ${DESTDIR}${LIBDIR} 533 ${RANLIB} ${DESTDIR}${LIBDIR}/lib${LIB}.a 534 chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a 535.endif 536.if ${MK_PROFILE} != "no" 537 ${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 600 \ 538 lib${LIB}_p.a ${DESTDIR}${LIBDIR} 539 ${RANLIB} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 540 chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 541.endif 542.if ${MK_PIC} != "no" 543.if ${MK_PICLIB} != "no" 544 ${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m 600 \ 545 lib${LIB}_pic.a ${DESTDIR}${LIBDIR} 546 ${RANLIB} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a 547 chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a 548.endif 549.if !empty(SHLIB_MAJOR) 550 ${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m ${LIBMODE} \ 551 lib${LIB}.${LD_so} ${DESTDIR}${LIBDIR} 552.if !empty(SHLIB_LINKS) 553 (cd ${DESTDIR}${LIBDIR} && { rm -f ${SHLIB_LINKS}; ${SHLIB_LINKS:O:u:@x@ln -s lib${LIB}.${LD_so} $x;@} }) 554.endif 555.endif 556.endif 557.if ${MK_LINT} != "no" && ${MK_LINKLIB} != "no" && !empty(LOBJS) 558 ${INSTALL} ${COPY} ${LIB_INSTALL_OWN} -m ${LIBMODE} \ 559 llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} 560.endif 561.if defined(LINKS) && !empty(LINKS) 562 @set ${LINKS}; ${_LINKS_SCRIPT} 563.endif 564.endif 565 566install: maninstall _SUBDIRUSE 567maninstall: afterinstall 568afterinstall: realinstall 569realinstall: beforeinstall 570.endif 571 572.if ${MK_MAN} != "no" 573.include <man.mk> 574.endif 575 576.if ${MK_NLS} != "no" 577.include <nls.mk> 578.endif 579 580.include <obj.mk> 581.include <inc.mk> 582.include <dep.mk> 583.include <subdir.mk> 584.endif 585 586# during building we usually need/want to install libs somewhere central 587# note that we do NOT ch{own,grp} as that would likely fail at this point. 588# otherwise it is the same as realinstall 589# Note that we don't need this when using dpadd.mk 590.libinstall: ${_LIBS} 591 test -d ${DESTDIR}${LIBDIR} || ${INSTALL} -d -m775 ${DESTDIR}${LIBDIR} 592.for _lib in ${_LIBS:M*.a} 593 ${INSTALL} ${COPY} -m 644 ${_lib} ${DESTDIR}${LIBDIR} 594 ${RANLIB} ${DESTDIR}${LIBDIR}/${_lib} 595.endfor 596.for _lib in ${_LIBS:M*.${LD_solink}*:O:u} 597 ${INSTALL} ${COPY} -m ${LIBMODE} ${_lib} ${DESTDIR}${LIBDIR} 598.if !empty(SHLIB_LINKS) 599 (cd ${DESTDIR}${LIBDIR} && { ${SHLIB_LINKS:O:u:@x@ln -sf ${_lib} $x;@}; }) 600.endif 601.endfor 602 @touch ${.TARGET} 603 604.include <final.mk> 605.endif 606