[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.203.2.1

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

CVSweb <webmaster@jp.NetBSD.org>