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

1.249   ! skrll       1: #      $NetBSD: bsd.lib.mk,v 1.248 2004/02/09 06:35:18 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.246     lukem      11: .PHONY:                checkver libinstall
1.143     erh        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
1.242     simonb    136:
                    137: .elif ${MACHINE_ARCH} == "ns32k"
                    138:
                    139: # XXX no shared libraries yet on ns32k
                    140: FPICFLAGS?=
                    141: CPICFLAGS?=
                    142: CPPPICFLAGS?=
                    143: CAPICFLAGS?=
                    144: APICFLAGS?=
1.86      jonathan  145:
                    146: .else
                    147:
1.244     skrll     148: # Platform-independent flags for NetBSD shared libraries
1.171     christos  149: SHLIB_SOVERSION=${SHLIB_FULLVERSION}
1.125     jonathan  150: SHLIB_SHFLAGS=
1.179     dmcmahil  151: FPICFLAGS ?= -fPIC
1.165     dmcmahil  152: CPICFLAGS?= -fPIC -DPIC
1.222     lukem     153: CPPPICFLAGS?= -DPIC
1.107     jonathan  154: CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
                    155: APICFLAGS?= -k
1.86      jonathan  156:
                    157: .endif
1.160     simonb    158:
1.205     yamt      159: .if ${MKPICLIB} != "no"
                    160: CSHLIBFLAGS+= ${CPICFLAGS}
                    161: .endif
                    162:
                    163: .if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
                    164: MKSHLIBOBJS= yes
                    165: .else
                    166: MKSHLIBOBJS= no
                    167: .endif
                    168:
1.123     jonathan  169: # Platform-independent linker flags for ELF shared libraries
1.148     lukem     170: .if ${OBJECT_FMT} == "ELF"
1.182     mrg       171: SHLIB_SOVERSION=       ${SHLIB_MAJOR}
1.221     drochner  172: SHLIB_SHFLAGS=         -Wl,-soname,lib${LIB}.so.${SHLIB_SOVERSION}
1.219     thorpej   173: SHLIB_LDSTARTFILE?=    ${DESTDIR}/usr/lib/crti.o ${_GCC_CRTBEGINS}
                    174: SHLIB_LDENDFILE?=      ${_GCC_CRTENDS} ${DESTDIR}/usr/lib/crtn.o
1.123     jonathan  175: .endif
1.86      jonathan  176:
1.82      mikel     177: CFLAGS+=       ${COPTS}
1.179     dmcmahil  178: FFLAGS+=       ${FOPTS}
1.1       cgd       179:
                    180: .c.o:
1.238     lukem     181:        ${_MKTARGET_COMPILE}
1.228     lukem     182:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  183: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     184:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  185: .else
1.228     lukem     186:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    187:        rm -f ${.TARGET}.tmp
1.153     christos  188: .endif
1.1       cgd       189:
                    190: .c.po:
1.238     lukem     191:        ${_MKTARGET_COMPILE}
1.228     lukem     192:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.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.17      mycroft   199:
1.27      pk        200: .c.so:
1.238     lukem     201:        ${_MKTARGET_COMPILE}
1.228     lukem     202:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  203: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     204:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  205: .else
1.228     lukem     206:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    207:        rm -f ${.TARGET}.tmp
1.153     christos  208: .endif
1.27      pk        209:
1.58      cgd       210: .c.ln:
1.238     lukem     211:        ${_MKTARGET_COMPILE}
1.245     lukem     212:        ${LINT} ${LINTFLAGS} \
                    213:            ${CPPFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
                    214:            ${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
                    215:            -i ${.IMPSRC}
1.58      cgd       216:
1.223     lukem     217: .cc.o .cpp.o .cxx.o .C.o:
1.238     lukem     218:        ${_MKTARGET_COMPILE}
1.228     lukem     219:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  220: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     221:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  222: .else
1.228     lukem     223:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    224:        rm -f ${.TARGET}.tmp
1.153     christos  225: .endif
1.17      mycroft   226:
1.223     lukem     227: .cc.po .cpp.po .cxx.o .C.po:
1.238     lukem     228:        ${_MKTARGET_COMPILE}
1.228     lukem     229:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  230: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     231:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  232: .else
1.228     lukem     233:        ${LD} -X -r ${.TARGET}.tmp -o ${.TARGET}
                    234:        rm -f ${.TARGET}.tmp
1.153     christos  235: .endif
1.28      cgd       236:
1.223     lukem     237: .cc.so .cpp.so .cxx.so .C.so:
1.238     lukem     238:        ${_MKTARGET_COMPILE}
1.228     lukem     239:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  240: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     241:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  242: .else
1.228     lukem     243:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    244:        rm -f ${.TARGET}.tmp
1.153     christos  245: .endif
1.118     lukem     246:
1.179     dmcmahil  247: .f.o:
1.238     lukem     248:        ${_MKTARGET_COMPILE}
1.228     lukem     249:        ${COMPILE.f} ${.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.po:
1.238     lukem     258:        ${_MKTARGET_COMPILE}
1.228     lukem     259:        ${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.tmp
1.179     dmcmahil  260: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
1.228     lukem     261:        mv ${.TARGET}.tmp ${.TARGET}
1.179     dmcmahil  262: .else
1.228     lukem     263:        ${LD} -X -r ${.TARGET}.tmp -o ${.TARGET}
                    264:        rm -f ${.TARGET}.tmp
1.179     dmcmahil  265: .endif
                    266:
                    267: .f.so:
1.238     lukem     268:        ${_MKTARGET_COMPILE}
1.228     lukem     269:        ${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.tmp
1.179     dmcmahil  270: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
1.228     lukem     271:        mv ${.TARGET}.tmp ${.TARGET}
1.179     dmcmahil  272: .else
1.228     lukem     273:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    274:        rm -f ${.TARGET}.tmp
1.179     dmcmahil  275: .endif
                    276:
                    277: .f.ln:
1.238     lukem     278:        ${_MKTARGET_COMPILE}
1.217     wiz       279:        @echo Skipping lint for Fortran libraries.
1.179     dmcmahil  280:
1.118     lukem     281: .m.o:
1.238     lukem     282:        ${_MKTARGET_COMPILE}
1.228     lukem     283:        ${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  284: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
1.228     lukem     285:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  286: .else
1.228     lukem     287:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    288:        rm -f ${.TARGET}.tmp
1.153     christos  289: .endif
1.118     lukem     290:
                    291: .m.po:
1.238     lukem     292:        ${_MKTARGET_COMPILE}
1.228     lukem     293:        ${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  294: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
1.228     lukem     295:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  296: .else
1.228     lukem     297:        ${LD} -X -r ${.TARGET}.tmp -o ${.TARGET}
                    298:        rm -f ${.TARGET}.tmp
1.153     christos  299: .endif
1.118     lukem     300:
                    301: .m.so:
1.238     lukem     302:        ${_MKTARGET_COMPILE}
1.228     lukem     303:        ${COMPILE.m} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  304: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
1.228     lukem     305:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  306: .else
1.228     lukem     307:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    308:        rm -f ${.TARGET}.tmp
1.153     christos  309: .endif
1.1       cgd       310:
1.40      cgd       311: .S.o .s.o:
1.238     lukem     312:        ${_MKTARGET_COMPILE}
1.245     lukem     313:        ${COMPILE.S} \
                    314:            ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
                    315:            ${AINC} ${.IMPSRC} -o ${.TARGET}.tmp
1.228     lukem     316:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    317:        rm -f ${.TARGET}.tmp
1.1       cgd       318:
1.40      cgd       319: .S.po .s.po:
1.238     lukem     320:        ${_MKTARGET_COMPILE}
1.245     lukem     321:        ${COMPILE.S} -DGPROF -DPROF \
                    322:            ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
                    323:            ${AINC} ${.IMPSRC} -o ${.TARGET}.tmp
1.228     lukem     324:        ${LD} -X -r ${.TARGET}.tmp -o ${.TARGET}
                    325:        rm -f ${.TARGET}.tmp
1.1       cgd       326:
1.40      cgd       327: .S.so .s.so:
1.238     lukem     328:        ${_MKTARGET_COMPILE}
1.245     lukem     329:        ${COMPILE.S} ${CAPICFLAGS} \
                    330:            ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
                    331:            ${AINC} ${.IMPSRC} -o ${.TARGET}.tmp
1.228     lukem     332:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    333:        rm -f ${.TARGET}.tmp
1.27      pk        334:
1.215     christos  335: .if defined(LIB)
1.234     lukem     336: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    337:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.130     tv        338: _LIBS=lib${LIB}.a
                    339: .else
                    340: _LIBS=
                    341: .endif
1.58      cgd       342:
1.167     matt      343: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.158     christos  344:
1.149     lukem     345: .if ${MKPROFILE} != "no"
1.130     tv        346: _LIBS+=lib${LIB}_p.a
1.167     matt      347: POBJS+=${OBJS:.o=.po}
1.1       cgd       348: .endif
                    349:
1.148     lukem     350: .if ${MKPIC} != "no"
1.160     simonb    351: .if ${MKPICLIB} == "no"
1.205     yamt      352: .if ${MKSHLIBOBJS} != "no"
                    353: # make _pic.a, which isn't really pic,
                    354: # since it's needed for making shared lib.
                    355: # but don't install it.
                    356: SOLIB=lib${LIB}_pic.a
                    357: SOBJS+=${OBJS:.o=.so}
                    358: .else
1.160     simonb    359: SOLIB=lib${LIB}.a
1.205     yamt      360: .endif
1.160     simonb    361: .else
                    362: SOLIB=lib${LIB}_pic.a
                    363: _LIBS+=${SOLIB}
1.167     matt      364: SOBJS+=${OBJS:.o=.so}
1.160     simonb    365: .endif
1.171     christos  366: .if defined(SHLIB_FULLVERSION)
                    367: _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
1.27      pk        368: .endif
1.35      pk        369: .endif
1.27      pk        370:
1.179     dmcmahil  371: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    372: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.58      cgd       373: _LIBS+=llib-l${LIB}.ln
1.215     christos  374: .endif
1.27      pk        375:
1.234     lukem     376: ALLOBJS=
                    377: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    378:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
                    379: ALLOBJS+=${OBJS}
1.179     dmcmahil  380: .endif
1.234     lukem     381: ALLOBJS+=${POBJS} ${SOBJS}
1.179     dmcmahil  382: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
                    383: ALLOBJS+=${LOBJS}
1.216     christos  384: .endif
                    385: .else
                    386: LOBJS=
                    387: SOBJS=
1.167     matt      388: .endif
1.186     tv        389:
1.191     tv        390: .NOPATH: ${ALLOBJS} ${_LIBS} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.158     christos  391:
1.162     mycroft   392: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
1.1       cgd       393:
1.243     rtr       394: .if !target(__archivebuild)
1.90      christos  395: __archivebuild: .USE
1.238     lukem     396:        ${_MKTARGET_BUILD}
1.236     lukem     397:        rm -f ${.TARGET}
1.228     lukem     398:        ${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.89      christos  399:        ${RANLIB} ${.TARGET}
1.243     rtr       400: .endif
1.89      christos  401:
1.243     rtr       402: .if !target(__archiveinstall)
1.89      christos  403: __archiveinstall: .USE
1.238     lukem     404:        ${_MKTARGET_INSTALL}
1.198     lukem     405:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     406:            ${UPDATE:D:U-a "${RANLIB} -t"} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
1.243     rtr       407: .endif
1.89      christos  408:
1.197     mycroft   409: __archivesymlinkpic: .USE
1.238     lukem     410:        ${_MKTARGET_INSTALL}
1.208     perry     411:        ${INSTALL_SYMLINK} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
1.197     mycroft   412:
1.229     lukem     413: DPSRCS+=       ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
1.230     lukem     414: CLEANFILES+=   ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
                    415: CLEANFILES+=   ${YHEADER:D${SRCS:M*.y:.y=.h}}
                    416:
                    417: ${OBJS} ${POBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
1.103     mycroft   418:
1.89      christos  419: lib${LIB}.a:: ${OBJS} __archivebuild
1.1       cgd       420:
1.89      christos  421: lib${LIB}_p.a:: ${POBJS} __archivebuild
1.1       cgd       422:
1.89      christos  423: lib${LIB}_pic.a:: ${SOBJS} __archivebuild
1.27      pk        424:
1.235     lukem     425:
                    426: _LIBLDOPTS=
                    427: .if ${SHLIBDIR} != "/usr/lib"
                    428: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                    429:                -R${SHLIBDIR} \
                    430:                -L${DESTDIR}${SHLIBDIR}
                    431: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
                    432: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
                    433:                -L${DESTDIR}${SHLIBINSTALLDIR}
                    434: .endif
                    435:
1.171     christos  436: lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
1.88      cgd       437:     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.238     lukem     438:        ${_MKTARGET_BUILD}
1.236     lukem     439:        rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
1.152     fair      440: .if defined(DESTDIR)
1.228     lukem     441:        ${CC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
1.235     lukem     442:            ${_LIBLDOPTS} \
1.231     lukem     443:            -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.221     drochner  444:            -Wl,--whole-archive ${SOLIB} \
                    445:            -Wl,--no-whole-archive ${LDADD} \
1.235     lukem     446:            -L${_GCC_LIBGCCDIR}
1.221     drochner  447: .else
1.231     lukem     448:        ${CC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.235     lukem     449:            ${_LIBLDOPTS} \
1.221     drochner  450:            -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD}
1.152     fair      451: .endif
1.148     lukem     452: .if ${OBJECT_FMT} == "ELF"
1.196     lukem     453: #  We don't use INSTALL_SYMLINK here because this is just
                    454: #  happening inside the build directory/objdir. XXX Why does
                    455: #  this spend so much effort on libraries that aren't live??? XXX
1.241     matt      456:        ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
1.177     mycroft   457:        mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
1.241     matt      458:        ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
1.177     mycroft   459:        mv -f lib${LIB}.so.tmp lib${LIB}.so
1.133     tv        460: .endif
1.35      pk        461:
1.179     dmcmahil  462: .if !empty(LOBJS)
1.103     mycroft   463: LLIBS?=                -lc
1.58      cgd       464: llib-l${LIB}.ln: ${LOBJS}
1.238     lukem     465:        ${_MKTARGET_COMPILE}
1.236     lukem     466:        rm -f llib-l${LIB}.ln
1.206     thorpej   467: .if defined(DESTDIR)
1.228     lukem     468:        ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206     thorpej   469: .else
1.228     lukem     470:        ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206     thorpej   471: .endif
1.179     dmcmahil  472: .endif
1.1       cgd       473:
1.246     lukem     474: cleanlib: .PHONY
1.48      mycroft   475:        rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59      cgd       476:        rm -f lib${LIB}.a ${OBJS}
                    477:        rm -f lib${LIB}_p.a ${POBJS}
1.133     tv        478:        rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
1.228     lukem     479:        rm -f ${OBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp}
1.59      cgd       480:        rm -f llib-l${LIB}.ln ${LOBJS}
1.1       cgd       481:
1.97      mycroft   482: .if !target(libinstall)
1.148     lukem     483: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139     tv        484: libinstall::
                    485:
1.234     lukem     486: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.89      christos  487: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.168     mycroft   488: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.197     mycroft   489:
1.89      christos  490: .if !defined(UPDATE)
1.197     mycroft   491: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
                    492: ${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
1.89      christos  493: .endif
1.197     mycroft   494: ${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
                    495: .else
1.157     fredb     496: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
1.89      christos  497: ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
                    498: .endif
                    499: ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
1.130     tv        500: .endif
1.197     mycroft   501: .endif
1.89      christos  502:
1.149     lukem     503: .if ${MKPROFILE} != "no"
1.89      christos  504: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.168     mycroft   505: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.197     mycroft   506:
1.89      christos  507: .if !defined(UPDATE)
1.197     mycroft   508: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
                    509: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
1.32      pk        510: .endif
1.197     mycroft   511: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
                    512: .else
1.157     fredb     513: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
1.89      christos  514: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
                    515: .endif
                    516: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
                    517: .endif
1.197     mycroft   518: .endif
1.89      christos  519:
1.149     lukem     520: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.168     mycroft   521: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.160     simonb    522: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.197     mycroft   523:
1.89      christos  524: .if !defined(UPDATE)
1.197     mycroft   525: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
                    526: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
1.89      christos  527: .endif
1.197     mycroft   528: .if ${MKPICLIB} == "no"
                    529: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
                    530: .else
                    531: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
                    532: .endif
                    533: .else
1.157     fredb     534: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
1.89      christos  535: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
1.33      pk        536: .endif
1.160     simonb    537: .if ${MKPICLIB} == "no"
1.197     mycroft   538: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
1.160     simonb    539: .else
1.89      christos  540: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
1.160     simonb    541: .endif
1.89      christos  542: .endif
1.197     mycroft   543: .endif
1.89      christos  544:
1.171     christos  545: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.195     lukem     546: libinstall:: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
                    547: .PRECIOUS: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   548:
1.89      christos  549: .if !defined(UPDATE)
1.197     mycroft   550: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
                    551: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! .MADE
1.89      christos  552: .endif
1.197     mycroft   553: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
                    554: .else
1.171     christos  555: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
1.195     lukem     556: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
1.89      christos  557: .endif
1.195     lukem     558: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   559: .endif
1.238     lukem     560:        ${_MKTARGET_INSTALL}
1.188     tv        561:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     562:                ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
1.195     lukem     563: .if ${_LIBSODIR} != ${LIBDIR}
1.208     perry     564:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    565:                ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
                    566:                ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.195     lukem     567: .endif
1.148     lukem     568: .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
1.195     lukem     569:        /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}
1.146     thorpej   570: .endif
1.148     lukem     571: .if ${OBJECT_FMT} == "ELF"
1.208     perry     572:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    573:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    574:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.195     lukem     575: .if ${_LIBSODIR} != ${LIBDIR}
1.208     perry     576:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    577:                ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
                    578:                ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.195     lukem     579: .endif
1.148     lukem     580: .if ${MKLINKLIB} != "no"
1.208     perry     581:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    582:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    583:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so
1.195     lukem     584: .if ${_LIBSODIR} != ${LIBDIR}
1.208     perry     585:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
1.248     lukem     586:                ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
1.208     perry     587:                ${DESTDIR}${LIBDIR}/lib${LIB}.so
1.195     lukem     588: .endif
1.83      cgd       589: .endif
1.12      cgd       590: .endif
1.139     tv        591: .endif
1.89      christos  592:
1.179     dmcmahil  593: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.89      christos  594: libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.168     mycroft   595: .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.197     mycroft   596:
1.89      christos  597: .if !defined(UPDATE)
1.197     mycroft   598: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
                    599: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
1.89      christos  600: .endif
1.197     mycroft   601: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
                    602: .else
1.157     fredb     603: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
1.89      christos  604: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
                    605: .endif
1.95      mycroft   606: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
1.197     mycroft   607: .endif
1.238     lukem     608:        ${_MKTARGET_INSTALL}
1.188     tv        609:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     610:                ${SYSPKGTAG} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
1.58      cgd       611: .endif
1.1       cgd       612: .endif
                    613:
1.188     tv        614: ##### Pull in related .mk logic
1.1       cgd       615: .include <bsd.man.mk>
1.57      jtc       616: .include <bsd.nls.mk>
1.91      christos  617: .include <bsd.files.mk>
1.89      christos  618: .include <bsd.inc.mk>
1.109     cjs       619: .include <bsd.links.mk>
1.24      mycroft   620: .include <bsd.dep.mk>
1.117     mycroft   621:
1.188     tv        622: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>