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

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

CVSweb <webmaster@jp.NetBSD.org>