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

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

CVSweb <webmaster@jp.NetBSD.org>