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

1.235   ! lukem       1: #      $NetBSD: bsd.lib.mk,v 1.234 2003/09/13 19:08:27 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.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.234     lukem     303: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    304:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "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.234     lukem     343: ALLOBJS=
                    344: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    345:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
                    346: ALLOBJS+=${OBJS}
1.179     dmcmahil  347: .endif
1.234     lukem     348: ALLOBJS+=${POBJS} ${SOBJS}
1.179     dmcmahil  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.235   ! lukem     388:
        !           389: _LIBLDOPTS=
        !           390: .if ${SHLIBDIR} != "/usr/lib"
        !           391: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
        !           392:                -R${SHLIBDIR} \
        !           393:                -L${DESTDIR}${SHLIBDIR}
        !           394: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
        !           395: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
        !           396:                -L${DESTDIR}${SHLIBINSTALLDIR}
        !           397: .endif
        !           398:
1.171     christos  399: lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
1.88      cgd       400:     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.171     christos  401:        @echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
                    402:        @rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
1.152     fair      403: .if defined(DESTDIR)
1.228     lukem     404:        ${CC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
1.235   ! lukem     405:            ${_LIBLDOPTS} \
1.231     lukem     406:            -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.221     drochner  407:            -Wl,--whole-archive ${SOLIB} \
                    408:            -Wl,--no-whole-archive ${LDADD} \
1.235   ! lukem     409:            -L${_GCC_LIBGCCDIR}
1.221     drochner  410: .else
1.231     lukem     411:        ${CC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.235   ! lukem     412:            ${_LIBLDOPTS} \
1.221     drochner  413:            -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD}
1.152     fair      414: .endif
1.148     lukem     415: .if ${OBJECT_FMT} == "ELF"
1.196     lukem     416: #  We don't use INSTALL_SYMLINK here because this is just
                    417: #  happening inside the build directory/objdir. XXX Why does
                    418: #  this spend so much effort on libraries that aren't live??? XXX
1.177     mycroft   419:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
                    420:        mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
                    421:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
                    422:        mv -f lib${LIB}.so.tmp lib${LIB}.so
1.133     tv        423: .endif
1.35      pk        424:
1.179     dmcmahil  425: .if !empty(LOBJS)
1.103     mycroft   426: LLIBS?=                -lc
1.58      cgd       427: llib-l${LIB}.ln: ${LOBJS}
                    428:        @echo building llib-l${LIB}.ln
                    429:        @rm -f llib-l${LIB}.ln
1.206     thorpej   430: .if defined(DESTDIR)
1.228     lukem     431:        ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206     thorpej   432: .else
1.228     lukem     433:        ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206     thorpej   434: .endif
1.179     dmcmahil  435: .endif
1.1       cgd       436:
1.81      cgd       437: cleanlib:
1.48      mycroft   438:        rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59      cgd       439:        rm -f lib${LIB}.a ${OBJS}
                    440:        rm -f lib${LIB}_p.a ${POBJS}
1.133     tv        441:        rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
1.228     lukem     442:        rm -f ${OBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp}
1.59      cgd       443:        rm -f llib-l${LIB}.ln ${LOBJS}
1.1       cgd       444:
1.26      mycroft   445: .if defined(SRCS)
1.64      christos  446: afterdepend: .depend
1.220     msaitoh   447:        @(TMP=/tmp/_depend$$$$; trap 'rm -f $$TMP ; exit 1' 1 2 3 13 15; \
1.79      cgd       448:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
1.218     wiz       449:              < .depend > $$TMP && \
1.1       cgd       450:            mv $$TMP .depend)
1.26      mycroft   451: .endif
1.1       cgd       452:
1.97      mycroft   453: .if !target(libinstall)
1.148     lukem     454: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139     tv        455: libinstall::
                    456:
1.234     lukem     457: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.89      christos  458: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.168     mycroft   459: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.197     mycroft   460:
1.89      christos  461: .if !defined(UPDATE)
1.197     mycroft   462: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
                    463: ${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
1.89      christos  464: .endif
1.197     mycroft   465: ${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
                    466: .else
1.157     fredb     467: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
1.89      christos  468: ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
                    469: .endif
                    470: ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
1.130     tv        471: .endif
1.197     mycroft   472: .endif
1.89      christos  473:
1.149     lukem     474: .if ${MKPROFILE} != "no"
1.89      christos  475: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.168     mycroft   476: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.197     mycroft   477:
1.89      christos  478: .if !defined(UPDATE)
1.197     mycroft   479: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
                    480: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
1.32      pk        481: .endif
1.197     mycroft   482: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
                    483: .else
1.157     fredb     484: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
1.89      christos  485: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
                    486: .endif
                    487: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
                    488: .endif
1.197     mycroft   489: .endif
1.89      christos  490:
1.149     lukem     491: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.168     mycroft   492: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.160     simonb    493: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.197     mycroft   494:
1.89      christos  495: .if !defined(UPDATE)
1.197     mycroft   496: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
                    497: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
1.89      christos  498: .endif
1.197     mycroft   499: .if ${MKPICLIB} == "no"
                    500: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
                    501: .else
                    502: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
                    503: .endif
                    504: .else
1.157     fredb     505: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
1.89      christos  506: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
1.33      pk        507: .endif
1.160     simonb    508: .if ${MKPICLIB} == "no"
1.197     mycroft   509: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
1.160     simonb    510: .else
1.89      christos  511: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
1.160     simonb    512: .endif
1.89      christos  513: .endif
1.197     mycroft   514: .endif
1.89      christos  515:
1.171     christos  516: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.195     lukem     517: libinstall:: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
                    518: .PRECIOUS: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   519:
1.89      christos  520: .if !defined(UPDATE)
1.197     mycroft   521: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
                    522: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! .MADE
1.89      christos  523: .endif
1.197     mycroft   524: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
                    525: .else
1.171     christos  526: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
1.195     lukem     527: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
1.89      christos  528: .endif
1.195     lukem     529: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   530: .endif
1.188     tv        531:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     532:                ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
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_FULLVERSION}
1.195     lukem     537: .endif
1.148     lukem     538: .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
1.195     lukem     539:        /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}
1.146     thorpej   540: .endif
1.148     lukem     541: .if ${OBJECT_FMT} == "ELF"
1.208     perry     542:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    543:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    544:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.195     lukem     545: .if ${_LIBSODIR} != ${LIBDIR}
1.208     perry     546:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    547:                ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
                    548:                ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.195     lukem     549: .endif
1.148     lukem     550: .if ${MKLINKLIB} != "no"
1.208     perry     551:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    552:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    553:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so
1.195     lukem     554: .if ${_LIBSODIR} != ${LIBDIR}
1.208     perry     555:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    556:                ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
                    557:                ${DESTDIR}${LIBDIR}/lib${LIB}.so
1.195     lukem     558: .endif
1.83      cgd       559: .endif
1.12      cgd       560: .endif
1.139     tv        561: .endif
1.89      christos  562:
1.179     dmcmahil  563: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.89      christos  564: libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.168     mycroft   565: .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.197     mycroft   566:
1.89      christos  567: .if !defined(UPDATE)
1.197     mycroft   568: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
                    569: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
1.89      christos  570: .endif
1.197     mycroft   571: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
                    572: .else
1.157     fredb     573: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
1.89      christos  574: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
                    575: .endif
1.95      mycroft   576: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
1.197     mycroft   577: .endif
1.188     tv        578:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     579:                ${SYSPKGTAG} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
1.58      cgd       580: .endif
1.1       cgd       581: .endif
                    582:
1.188     tv        583: ##### Pull in related .mk logic
1.1       cgd       584: .include <bsd.man.mk>
1.57      jtc       585: .include <bsd.nls.mk>
1.91      christos  586: .include <bsd.files.mk>
1.89      christos  587: .include <bsd.inc.mk>
1.109     cjs       588: .include <bsd.links.mk>
1.24      mycroft   589: .include <bsd.dep.mk>
1.117     mycroft   590:
1.188     tv        591: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>