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

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

CVSweb <webmaster@jp.NetBSD.org>