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

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

CVSweb <webmaster@jp.NetBSD.org>