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

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

CVSweb <webmaster@jp.NetBSD.org>