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

1.239   ! lukem       1: #      $NetBSD: bsd.lib.mk,v 1.238 2003/10/21 10:01:21 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.239   ! lukem      37:            ${HOST_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.238     lukem     174:        ${_MKTARGET_COMPILE}
1.228     lukem     175:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  176: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     177:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  178: .else
1.228     lukem     179:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    180:        rm -f ${.TARGET}.tmp
1.153     christos  181: .endif
1.1       cgd       182:
                    183: .c.po:
1.238     lukem     184:        ${_MKTARGET_COMPILE}
1.228     lukem     185:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  186: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     187:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  188: .else
1.228     lukem     189:        ${LD} -X -r ${.TARGET}.tmp -o ${.TARGET}
                    190:        rm -f ${.TARGET}.tmp
1.153     christos  191: .endif
1.17      mycroft   192:
1.27      pk        193: .c.so:
1.238     lukem     194:        ${_MKTARGET_COMPILE}
1.228     lukem     195:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  196: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     197:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  198: .else
1.228     lukem     199:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    200:        rm -f ${.TARGET}.tmp
1.153     christos  201: .endif
1.27      pk        202:
1.58      cgd       203: .c.ln:
1.238     lukem     204:        ${_MKTARGET_COMPILE}
1.224     lukem     205:        ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${CPPFLAGS.${.IMPSRC:T}:M-[-IDU]*} -i ${.IMPSRC}
1.58      cgd       206:
1.223     lukem     207: .cc.o .cpp.o .cxx.o .C.o:
1.238     lukem     208:        ${_MKTARGET_COMPILE}
1.228     lukem     209:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  210: .if defined(COPTS) && !empty(COPTS:M*-g*)
1.228     lukem     211:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  212: .else
1.228     lukem     213:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    214:        rm -f ${.TARGET}.tmp
1.153     christos  215: .endif
1.17      mycroft   216:
1.223     lukem     217: .cc.po .cpp.po .cxx.o .C.po:
1.238     lukem     218:        ${_MKTARGET_COMPILE}
1.228     lukem     219:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.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.28      cgd       226:
1.223     lukem     227: .cc.so .cpp.so .cxx.so .C.so:
1.238     lukem     228:        ${_MKTARGET_COMPILE}
1.228     lukem     229:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.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.118     lukem     236:
1.179     dmcmahil  237: .f.o:
1.238     lukem     238:        ${_MKTARGET_COMPILE}
1.228     lukem     239:        ${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.tmp
1.179     dmcmahil  240: .if defined(FOPTS) && !empty(FOPTS:M*-g*)
1.228     lukem     241:        mv ${.TARGET}.tmp ${.TARGET}
1.179     dmcmahil  242: .else
1.228     lukem     243:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    244:        rm -f ${.TARGET}.tmp
1.179     dmcmahil  245: .endif
                    246:
                    247: .f.po:
1.238     lukem     248:        ${_MKTARGET_COMPILE}
1.228     lukem     249:        ${COMPILE.f} -pg ${.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.so:
1.238     lukem     258:        ${_MKTARGET_COMPILE}
1.228     lukem     259:        ${COMPILE.f} ${FPICFLAGS} ${.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.ln:
1.238     lukem     268:        ${_MKTARGET_COMPILE}
1.217     wiz       269:        @echo Skipping lint for Fortran libraries.
1.179     dmcmahil  270:
1.118     lukem     271: .m.o:
1.238     lukem     272:        ${_MKTARGET_COMPILE}
1.228     lukem     273:        ${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.tmp
1.153     christos  274: .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
1.228     lukem     275:        mv ${.TARGET}.tmp ${.TARGET}
1.153     christos  276: .else
1.228     lukem     277:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    278:        rm -f ${.TARGET}.tmp
1.153     christos  279: .endif
1.118     lukem     280:
                    281: .m.po:
1.238     lukem     282:        ${_MKTARGET_COMPILE}
1.228     lukem     283:        ${COMPILE.m} -pg ${.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.so:
1.238     lukem     292:        ${_MKTARGET_COMPILE}
1.228     lukem     293:        ${COMPILE.m} ${CSHLIBFLAGS} ${.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.1       cgd       300:
1.40      cgd       301: .S.o .s.o:
1.238     lukem     302:        ${_MKTARGET_COMPILE}
1.228     lukem     303:        ${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.tmp
                    304:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    305:        rm -f ${.TARGET}.tmp
1.1       cgd       306:
1.40      cgd       307: .S.po .s.po:
1.238     lukem     308:        ${_MKTARGET_COMPILE}
1.228     lukem     309:        ${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.tmp
                    310:        ${LD} -X -r ${.TARGET}.tmp -o ${.TARGET}
                    311:        rm -f ${.TARGET}.tmp
1.1       cgd       312:
1.40      cgd       313: .S.so .s.so:
1.238     lukem     314:        ${_MKTARGET_COMPILE}
1.228     lukem     315:        ${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.tmp
                    316:        ${LD} -x -r ${.TARGET}.tmp -o ${.TARGET}
                    317:        rm -f ${.TARGET}.tmp
1.27      pk        318:
1.215     christos  319: .if defined(LIB)
1.234     lukem     320: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    321:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.130     tv        322: _LIBS=lib${LIB}.a
                    323: .else
                    324: _LIBS=
                    325: .endif
1.58      cgd       326:
1.167     matt      327: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.158     christos  328:
1.149     lukem     329: .if ${MKPROFILE} != "no"
1.130     tv        330: _LIBS+=lib${LIB}_p.a
1.167     matt      331: POBJS+=${OBJS:.o=.po}
1.1       cgd       332: .endif
                    333:
1.148     lukem     334: .if ${MKPIC} != "no"
1.160     simonb    335: .if ${MKPICLIB} == "no"
1.205     yamt      336: .if ${MKSHLIBOBJS} != "no"
                    337: # make _pic.a, which isn't really pic,
                    338: # since it's needed for making shared lib.
                    339: # but don't install it.
                    340: SOLIB=lib${LIB}_pic.a
                    341: SOBJS+=${OBJS:.o=.so}
                    342: .else
1.160     simonb    343: SOLIB=lib${LIB}.a
1.205     yamt      344: .endif
1.160     simonb    345: .else
                    346: SOLIB=lib${LIB}_pic.a
                    347: _LIBS+=${SOLIB}
1.167     matt      348: SOBJS+=${OBJS:.o=.so}
1.160     simonb    349: .endif
1.171     christos  350: .if defined(SHLIB_FULLVERSION)
                    351: _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
1.27      pk        352: .endif
1.35      pk        353: .endif
1.27      pk        354:
1.179     dmcmahil  355: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    356: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.58      cgd       357: _LIBS+=llib-l${LIB}.ln
1.215     christos  358: .endif
1.27      pk        359:
1.234     lukem     360: ALLOBJS=
                    361: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    362:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
                    363: ALLOBJS+=${OBJS}
1.179     dmcmahil  364: .endif
1.234     lukem     365: ALLOBJS+=${POBJS} ${SOBJS}
1.179     dmcmahil  366: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
                    367: ALLOBJS+=${LOBJS}
1.216     christos  368: .endif
                    369: .else
                    370: LOBJS=
                    371: SOBJS=
1.167     matt      372: .endif
1.186     tv        373:
1.191     tv        374: .NOPATH: ${ALLOBJS} ${_LIBS} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.158     christos  375:
1.162     mycroft   376: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
1.1       cgd       377:
1.90      christos  378: __archivebuild: .USE
1.238     lukem     379:        ${_MKTARGET_BUILD}
1.236     lukem     380:        rm -f ${.TARGET}
1.228     lukem     381:        ${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.89      christos  382:        ${RANLIB} ${.TARGET}
                    383:
                    384: __archiveinstall: .USE
1.238     lukem     385:        ${_MKTARGET_INSTALL}
1.198     lukem     386:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     387:            ${UPDATE:D:U-a "${RANLIB} -t"} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
1.89      christos  388:
1.197     mycroft   389: __archivesymlinkpic: .USE
1.238     lukem     390:        ${_MKTARGET_INSTALL}
1.208     perry     391:        ${INSTALL_SYMLINK} ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
1.197     mycroft   392:
1.229     lukem     393: DPSRCS+=       ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
1.230     lukem     394: CLEANFILES+=   ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
                    395: CLEANFILES+=   ${YHEADER:D${SRCS:M*.y:.y=.h}}
                    396:
                    397: ${OBJS} ${POBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
1.103     mycroft   398:
1.89      christos  399: lib${LIB}.a:: ${OBJS} __archivebuild
1.1       cgd       400:
1.89      christos  401: lib${LIB}_p.a:: ${POBJS} __archivebuild
1.1       cgd       402:
1.89      christos  403: lib${LIB}_pic.a:: ${SOBJS} __archivebuild
1.27      pk        404:
1.235     lukem     405:
                    406: _LIBLDOPTS=
                    407: .if ${SHLIBDIR} != "/usr/lib"
                    408: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                    409:                -R${SHLIBDIR} \
                    410:                -L${DESTDIR}${SHLIBDIR}
                    411: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
                    412: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
                    413:                -L${DESTDIR}${SHLIBINSTALLDIR}
                    414: .endif
                    415:
1.171     christos  416: lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
1.88      cgd       417:     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.238     lukem     418:        ${_MKTARGET_BUILD}
1.236     lukem     419:        rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
1.152     fair      420: .if defined(DESTDIR)
1.228     lukem     421:        ${CC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
1.235     lukem     422:            ${_LIBLDOPTS} \
1.231     lukem     423:            -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.221     drochner  424:            -Wl,--whole-archive ${SOLIB} \
                    425:            -Wl,--no-whole-archive ${LDADD} \
1.235     lukem     426:            -L${_GCC_LIBGCCDIR}
1.221     drochner  427: .else
1.231     lukem     428:        ${CC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.235     lukem     429:            ${_LIBLDOPTS} \
1.221     drochner  430:            -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD}
1.152     fair      431: .endif
1.148     lukem     432: .if ${OBJECT_FMT} == "ELF"
1.196     lukem     433: #  We don't use INSTALL_SYMLINK here because this is just
                    434: #  happening inside the build directory/objdir. XXX Why does
                    435: #  this spend so much effort on libraries that aren't live??? XXX
1.177     mycroft   436:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
                    437:        mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
                    438:        ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
                    439:        mv -f lib${LIB}.so.tmp lib${LIB}.so
1.133     tv        440: .endif
1.35      pk        441:
1.179     dmcmahil  442: .if !empty(LOBJS)
1.103     mycroft   443: LLIBS?=                -lc
1.58      cgd       444: llib-l${LIB}.ln: ${LOBJS}
1.238     lukem     445:        ${_MKTARGET_COMPILE}
1.236     lukem     446:        rm -f llib-l${LIB}.ln
1.206     thorpej   447: .if defined(DESTDIR)
1.228     lukem     448:        ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206     thorpej   449: .else
1.228     lukem     450:        ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206     thorpej   451: .endif
1.179     dmcmahil  452: .endif
1.1       cgd       453:
1.81      cgd       454: cleanlib:
1.48      mycroft   455:        rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.59      cgd       456:        rm -f lib${LIB}.a ${OBJS}
                    457:        rm -f lib${LIB}_p.a ${POBJS}
1.133     tv        458:        rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
1.228     lukem     459:        rm -f ${OBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp}
1.59      cgd       460:        rm -f llib-l${LIB}.ln ${LOBJS}
1.1       cgd       461:
1.26      mycroft   462: .if defined(SRCS)
1.64      christos  463: afterdepend: .depend
1.220     msaitoh   464:        @(TMP=/tmp/_depend$$$$; trap 'rm -f $$TMP ; exit 1' 1 2 3 13 15; \
1.79      cgd       465:            sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
1.218     wiz       466:              < .depend > $$TMP && \
1.1       cgd       467:            mv $$TMP .depend)
1.26      mycroft   468: .endif
1.1       cgd       469:
1.97      mycroft   470: .if !target(libinstall)
1.148     lukem     471: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139     tv        472: libinstall::
                    473:
1.234     lukem     474: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.89      christos  475: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.168     mycroft   476: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.197     mycroft   477:
1.89      christos  478: .if !defined(UPDATE)
1.197     mycroft   479: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
                    480: ${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
1.89      christos  481: .endif
1.197     mycroft   482: ${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
                    483: .else
1.157     fredb     484: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
1.89      christos  485: ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
                    486: .endif
                    487: ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
1.130     tv        488: .endif
1.197     mycroft   489: .endif
1.89      christos  490:
1.149     lukem     491: .if ${MKPROFILE} != "no"
1.89      christos  492: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.168     mycroft   493: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.197     mycroft   494:
1.89      christos  495: .if !defined(UPDATE)
1.197     mycroft   496: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
                    497: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
1.32      pk        498: .endif
1.197     mycroft   499: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
                    500: .else
1.157     fredb     501: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
1.89      christos  502: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
                    503: .endif
                    504: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
                    505: .endif
1.197     mycroft   506: .endif
1.89      christos  507:
1.149     lukem     508: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.168     mycroft   509: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.160     simonb    510: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.197     mycroft   511:
1.89      christos  512: .if !defined(UPDATE)
1.197     mycroft   513: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
                    514: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
1.89      christos  515: .endif
1.197     mycroft   516: .if ${MKPICLIB} == "no"
                    517: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
                    518: .else
                    519: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
                    520: .endif
                    521: .else
1.157     fredb     522: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
1.89      christos  523: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
1.33      pk        524: .endif
1.160     simonb    525: .if ${MKPICLIB} == "no"
1.197     mycroft   526: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
1.160     simonb    527: .else
1.89      christos  528: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
1.160     simonb    529: .endif
1.89      christos  530: .endif
1.197     mycroft   531: .endif
1.89      christos  532:
1.171     christos  533: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.195     lukem     534: libinstall:: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
                    535: .PRECIOUS: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   536:
1.89      christos  537: .if !defined(UPDATE)
1.197     mycroft   538: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
                    539: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! .MADE
1.89      christos  540: .endif
1.197     mycroft   541: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
                    542: .else
1.171     christos  543: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
1.195     lukem     544: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
1.89      christos  545: .endif
1.195     lukem     546: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   547: .endif
1.238     lukem     548:        ${_MKTARGET_INSTALL}
1.188     tv        549:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     550:                ${SYSPKGTAG} ${.ALLSRC} ${.TARGET}
1.195     lukem     551: .if ${_LIBSODIR} != ${LIBDIR}
1.208     perry     552:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    553:                ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
                    554:                ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.195     lukem     555: .endif
1.148     lukem     556: .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
1.195     lukem     557:        /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}
1.146     thorpej   558: .endif
1.148     lukem     559: .if ${OBJECT_FMT} == "ELF"
1.208     perry     560:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    561:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    562:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_MAJOR}
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_MAJOR}
1.195     lukem     567: .endif
1.148     lukem     568: .if ${MKLINKLIB} != "no"
1.208     perry     569:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    570:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    571:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so
1.195     lukem     572: .if ${_LIBSODIR} != ${LIBDIR}
1.208     perry     573:        ${INSTALL_SYMLINK} ${SYSPKGTAG} \
                    574:                ${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
                    575:                ${DESTDIR}${LIBDIR}/lib${LIB}.so
1.195     lukem     576: .endif
1.83      cgd       577: .endif
1.12      cgd       578: .endif
1.139     tv        579: .endif
1.89      christos  580:
1.179     dmcmahil  581: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.89      christos  582: libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.168     mycroft   583: .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.197     mycroft   584:
1.89      christos  585: .if !defined(UPDATE)
1.197     mycroft   586: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
                    587: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
1.89      christos  588: .endif
1.197     mycroft   589: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
                    590: .else
1.157     fredb     591: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
1.89      christos  592: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
                    593: .endif
1.95      mycroft   594: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
1.197     mycroft   595: .endif
1.238     lukem     596:        ${_MKTARGET_INSTALL}
1.188     tv        597:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.208     perry     598:                ${SYSPKGTAG} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
1.58      cgd       599: .endif
1.1       cgd       600: .endif
                    601:
1.188     tv        602: ##### Pull in related .mk logic
1.1       cgd       603: .include <bsd.man.mk>
1.57      jtc       604: .include <bsd.nls.mk>
1.91      christos  605: .include <bsd.files.mk>
1.89      christos  606: .include <bsd.inc.mk>
1.109     cjs       607: .include <bsd.links.mk>
1.24      mycroft   608: .include <bsd.dep.mk>
1.117     mycroft   609:
1.188     tv        610: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>