[BACK]Return to bsd.lib.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

Annotation of src/share/mk/bsd.lib.mk, Revision 1.207

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

CVSweb <webmaster@jp.NetBSD.org>