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

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

CVSweb <webmaster@jp.NetBSD.org>