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

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

CVSweb <webmaster@jp.NetBSD.org>