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

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

CVSweb <webmaster@jp.NetBSD.org>