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

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

CVSweb <webmaster@jp.NetBSD.org>