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

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

CVSweb <webmaster@jp.NetBSD.org>