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

1.266   ! christos    1: #      $NetBSD: bsd.lib.mk,v 1.265 2006/03/30 19:49:02 christos 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.266   ! christos   95: .SUFFIXES: .out .a .ln .so .po .go .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.263     dsl       187:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    188: .if !defined(COPTS) || empty(COPTS:M*-g*)
                    189:        ${OBJCOPY} -x ${.TARGET}
1.153     christos  190: .endif
1.1       cgd       191:
                    192: .c.po:
1.238     lukem     193:        ${_MKTARGET_COMPILE}
1.263     dsl       194:        ${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
                    195: .if !defined(COPTS) || empty(COPTS:M*-g*)
                    196:        ${OBJCOPY} -X ${.TARGET}
1.153     christos  197: .endif
1.17      mycroft   198:
1.266   ! christos  199: .c.go:
        !           200:        ${_MKTARGET_COMPILE}
        !           201:        ${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
        !           202:
1.27      pk        203: .c.so:
1.238     lukem     204:        ${_MKTARGET_COMPILE}
1.263     dsl       205:        ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
                    206: .if !defined(COPTS) || empty(COPTS:M*-g*)
                    207:        ${OBJCOPY} -x ${.TARGET}
1.153     christos  208: .endif
1.27      pk        209:
1.223     lukem     210: .cc.o .cpp.o .cxx.o .C.o:
1.238     lukem     211:        ${_MKTARGET_COMPILE}
1.263     dsl       212:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    213: .if !defined(COPTS) || empty(COPTS:M*-g*)
                    214:        ${OBJCOPY} -x ${.TARGET}
1.153     christos  215: .endif
1.17      mycroft   216:
1.266   ! christos  217: .cc.po .cpp.po .cxx.po .C.po:
1.238     lukem     218:        ${_MKTARGET_COMPILE}
1.263     dsl       219:        ${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
                    220: .if !defined(COPTS) || empty(COPTS:M*-g*)
                    221:        ${OBJCOPY} -X ${.TARGET}
1.153     christos  222: .endif
1.28      cgd       223:
1.266   ! christos  224: .cc.go .cpp.go .cxx.go .C.go:
        !           225:        ${_MKTARGET_COMPILE}
        !           226:        ${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
        !           227:
1.223     lukem     228: .cc.so .cpp.so .cxx.so .C.so:
1.238     lukem     229:        ${_MKTARGET_COMPILE}
1.263     dsl       230:        ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
                    231: .if !defined(COPTS) || empty(COPTS:M*-g*)
                    232:        ${OBJCOPY} -x ${.TARGET}
1.153     christos  233: .endif
1.118     lukem     234:
1.179     dmcmahil  235: .f.o:
1.238     lukem     236:        ${_MKTARGET_COMPILE}
1.263     dsl       237:        ${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
                    238: .if !defined(FOPTS) || empty(FOPTS:M*-g*)
                    239:        ${OBJCOPY} -x ${.TARGET}
1.179     dmcmahil  240: .endif
                    241:
                    242: .f.po:
1.238     lukem     243:        ${_MKTARGET_COMPILE}
1.263     dsl       244:        ${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
                    245: .if !defined(FOPTS) || empty(FOPTS:M*-g*)
                    246:        ${OBJCOPY} -X ${.TARGET}
1.179     dmcmahil  247: .endif
                    248:
1.266   ! christos  249: .f.go:
        !           250:        ${_MKTARGET_COMPILE}
        !           251:        ${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
        !           252:
1.179     dmcmahil  253: .f.so:
1.238     lukem     254:        ${_MKTARGET_COMPILE}
1.263     dsl       255:        ${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
                    256: .if !defined(FOPTS) || empty(FOPTS:M*-g*)
                    257:        ${OBJCOPY} -x ${.TARGET}
1.179     dmcmahil  258: .endif
                    259:
                    260: .f.ln:
1.238     lukem     261:        ${_MKTARGET_COMPILE}
1.217     wiz       262:        @echo Skipping lint for Fortran libraries.
1.179     dmcmahil  263:
1.118     lukem     264: .m.o:
1.238     lukem     265:        ${_MKTARGET_COMPILE}
1.263     dsl       266:        ${COMPILE.m} ${.IMPSRC} -o ${.TARGET}
                    267: .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
                    268:        ${OBJCOPY} -x ${.TARGET}
1.153     christos  269: .endif
1.118     lukem     270:
                    271: .m.po:
1.238     lukem     272:        ${_MKTARGET_COMPILE}
1.263     dsl       273:        ${COMPILE.m} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
                    274: .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
                    275:        ${OBJCOPY} -X ${.TARGET}
1.153     christos  276: .endif
1.118     lukem     277:
1.266   ! christos  278: .m.go:
        !           279:        ${_MKTARGET_COMPILE}
        !           280:        ${COMPILE.m} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
        !           281: .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
        !           282:        ${OBJCOPY} -X ${.TARGET}
        !           283: .endif
        !           284:
1.118     lukem     285: .m.so:
1.238     lukem     286:        ${_MKTARGET_COMPILE}
1.263     dsl       287:        ${COMPILE.m} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
                    288: .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
                    289:        ${OBJCOPY} -x ${.TARGET}
1.153     christos  290: .endif
1.1       cgd       291:
1.251     lukem     292: .s.o:
1.238     lukem     293:        ${_MKTARGET_COMPILE}
1.263     dsl       294:        ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    295:        ${OBJCOPY} -x ${.TARGET}
1.1       cgd       296:
1.251     lukem     297: .S.o:
                    298:        ${_MKTARGET_COMPILE}
1.263     dsl       299:        ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    300:        ${OBJCOPY} -x ${.TARGET}
1.251     lukem     301:
                    302: .s.po:
                    303:        ${_MKTARGET_COMPILE}
1.263     dsl       304:        ${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    305:        ${OBJCOPY} -X ${.TARGET}
1.251     lukem     306:
                    307: .S.po:
1.238     lukem     308:        ${_MKTARGET_COMPILE}
1.263     dsl       309:        ${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    310:        ${OBJCOPY} -X ${.TARGET}
1.1       cgd       311:
1.266   ! christos  312: .s.go:
        !           313:        ${_MKTARGET_COMPILE}
        !           314:        ${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
        !           315:
        !           316: .S.go:
        !           317:        ${_MKTARGET_COMPILE}
        !           318:        ${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
        !           319:
1.251     lukem     320: .s.so:
                    321:        ${_MKTARGET_COMPILE}
1.263     dsl       322:        ${COMPILE.s} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    323:        ${OBJCOPY} -x ${.TARGET}
1.251     lukem     324:
                    325: .S.so:
1.238     lukem     326:        ${_MKTARGET_COMPILE}
1.263     dsl       327:        ${COMPILE.S} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
                    328:        ${OBJCOPY} -x ${.TARGET}
1.27      pk        329:
1.252     lukem     330: .if defined(LIB)                                                       # {
1.234     lukem     331: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    332:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.130     tv        333: _LIBS=lib${LIB}.a
                    334: .else
                    335: _LIBS=
                    336: .endif
1.58      cgd       337:
1.167     matt      338: OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
1.158     christos  339:
1.255     thorpej   340: STOBJS+=${OBJS}
                    341:
1.252     lukem     342: .if ${MKPRIVATELIB} != "no"
                    343: # No installation is required
                    344: libinstall::
                    345: .else  # ${MKPRIVATELIB} == "no"                                       # {
                    346:
1.266   ! christos  347: .if ${MKDEBUG} != "no"
        !           348: _LIBS+=lib${LIB}_g.a
        !           349: GOBJS+=${OBJS:.o=.go}
        !           350: DEBUGFLAGS?=-DDEBUG
        !           351: .endif
        !           352:
1.149     lukem     353: .if ${MKPROFILE} != "no"
1.130     tv        354: _LIBS+=lib${LIB}_p.a
1.167     matt      355: POBJS+=${OBJS:.o=.po}
1.262     christos  356: PROFFLAGS?=-DGPROF -DPROF
1.1       cgd       357: .endif
                    358:
1.252     lukem     359: .if ${MKPIC} != "no"                                                   # {
1.160     simonb    360: .if ${MKPICLIB} == "no"
1.205     yamt      361: .if ${MKSHLIBOBJS} != "no"
                    362: # make _pic.a, which isn't really pic,
                    363: # since it's needed for making shared lib.
                    364: # but don't install it.
                    365: SOLIB=lib${LIB}_pic.a
                    366: SOBJS+=${OBJS:.o=.so}
                    367: .else
1.160     simonb    368: SOLIB=lib${LIB}.a
1.205     yamt      369: .endif
1.160     simonb    370: .else
                    371: SOLIB=lib${LIB}_pic.a
                    372: _LIBS+=${SOLIB}
1.167     matt      373: SOBJS+=${OBJS:.o=.so}
1.160     simonb    374: .endif
1.171     christos  375: .if defined(SHLIB_FULLVERSION)
                    376: _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
1.27      pk        377: .endif
1.252     lukem     378: .endif                                                                 # }
1.27      pk        379:
1.179     dmcmahil  380: LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
                    381: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.58      cgd       382: _LIBS+=llib-l${LIB}.ln
1.215     christos  383: .endif
1.27      pk        384:
1.252     lukem     385: .endif # ${MKPRIVATELIB} == "no"                                       # }
                    386:
1.234     lukem     387: ALLOBJS=
                    388: .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
                    389:        || ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
1.255     thorpej   390: ALLOBJS+=${STOBJS}
1.179     dmcmahil  391: .endif
1.234     lukem     392: ALLOBJS+=${POBJS} ${SOBJS}
1.179     dmcmahil  393: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
                    394: ALLOBJS+=${LOBJS}
1.216     christos  395: .endif
1.252     lukem     396: .else  # !defined(LIB)                                                 # } {
1.216     christos  397: LOBJS=
                    398: SOBJS=
1.252     lukem     399: .endif # !defined(LIB)                                                 # }
1.186     tv        400:
1.254     lukem     401: _YLSRCS=       ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
1.253     christos  402:
                    403: .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
1.158     christos  404:
1.162     mycroft   405: realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
1.1       cgd       406:
1.243     rtr       407: .if !target(__archivebuild)
1.90      christos  408: __archivebuild: .USE
1.238     lukem     409:        ${_MKTARGET_BUILD}
1.236     lukem     410:        rm -f ${.TARGET}
1.228     lukem     411:        ${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
1.89      christos  412:        ${RANLIB} ${.TARGET}
1.243     rtr       413: .endif
1.89      christos  414:
1.243     rtr       415: .if !target(__archiveinstall)
1.89      christos  416: __archiveinstall: .USE
1.238     lukem     417:        ${_MKTARGET_INSTALL}
1.198     lukem     418:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.264     jwise     419:            ${UPDATE:D:U-a "${RANLIB} -t"} ${.ALLSRC} ${.TARGET}
1.243     rtr       420: .endif
1.89      christos  421:
1.197     mycroft   422: __archivesymlinkpic: .USE
1.238     lukem     423:        ${_MKTARGET_INSTALL}
1.264     jwise     424:        ${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
1.197     mycroft   425:
1.253     christos  426: DPSRCS+=       ${_YLSRCS}
                    427: CLEANFILES+=   ${_YLSRCS}
1.230     lukem     428:
1.266   ! christos  429: ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
1.103     mycroft   430:
1.255     thorpej   431: lib${LIB}.a:: ${STOBJS} __archivebuild
1.1       cgd       432:
1.89      christos  433: lib${LIB}_p.a:: ${POBJS} __archivebuild
1.1       cgd       434:
1.89      christos  435: lib${LIB}_pic.a:: ${SOBJS} __archivebuild
1.27      pk        436:
1.266   ! christos  437: lib${LIB}_g.a:: ${GOBJS} __archivebuild
        !           438:
1.235     lukem     439:
                    440: _LIBLDOPTS=
                    441: .if ${SHLIBDIR} != "/usr/lib"
                    442: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib \
                    443:                -R${SHLIBDIR} \
                    444:                -L${DESTDIR}${SHLIBDIR}
                    445: .elif ${SHLIBINSTALLDIR} != "/usr/lib"
                    446: _LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR}:${DESTDIR}/usr/lib \
                    447:                -L${DESTDIR}${SHLIBINSTALLDIR}
                    448: .endif
                    449:
1.171     christos  450: lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
1.88      cgd       451:     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
1.238     lukem     452:        ${_MKTARGET_BUILD}
1.236     lukem     453:        rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
1.152     fair      454: .if defined(DESTDIR)
1.228     lukem     455:        ${CC} -Wl,-nostdlib -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/ \
1.235     lukem     456:            ${_LIBLDOPTS} \
1.231     lukem     457:            -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.221     drochner  458:            -Wl,--whole-archive ${SOLIB} \
                    459:            -Wl,--no-whole-archive ${LDADD} \
1.235     lukem     460:            -L${_GCC_LIBGCCDIR}
1.221     drochner  461: .else
1.231     lukem     462:        ${CC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${LDFLAGS} -o ${.TARGET} \
1.235     lukem     463:            ${_LIBLDOPTS} \
1.221     drochner  464:            -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD}
1.152     fair      465: .endif
1.148     lukem     466: .if ${OBJECT_FMT} == "ELF"
1.196     lukem     467: #  We don't use INSTALL_SYMLINK here because this is just
                    468: #  happening inside the build directory/objdir. XXX Why does
                    469: #  this spend so much effort on libraries that aren't live??? XXX
1.241     matt      470:        ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
1.177     mycroft   471:        mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
1.241     matt      472:        ${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
1.177     mycroft   473:        mv -f lib${LIB}.so.tmp lib${LIB}.so
1.133     tv        474: .endif
1.35      pk        475:
1.252     lukem     476: .if !empty(LOBJS)                                                      # {
1.103     mycroft   477: LLIBS?=                -lc
1.58      cgd       478: llib-l${LIB}.ln: ${LOBJS}
1.238     lukem     479:        ${_MKTARGET_COMPILE}
1.236     lukem     480:        rm -f llib-l${LIB}.ln
1.206     thorpej   481: .if defined(DESTDIR)
1.228     lukem     482:        ${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
1.206     thorpej   483: .else
1.228     lukem     484:        ${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
1.206     thorpej   485: .endif
1.252     lukem     486: .endif                                                                 # }
1.1       cgd       487:
1.246     lukem     488: cleanlib: .PHONY
1.48      mycroft   489:        rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
1.255     thorpej   490:        rm -f lib${LIB}.a ${STOBJS}
1.59      cgd       491:        rm -f lib${LIB}_p.a ${POBJS}
1.266   ! christos  492:        rm -f lib${LIB}_g.a ${GOBJS}
1.133     tv        493:        rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
1.266   ! christos  494:        rm -f ${STOBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp} ${GOBJS:=.tmp}
1.59      cgd       495:        rm -f llib-l${LIB}.ln ${LOBJS}
1.1       cgd       496:
1.252     lukem     497:
                    498: .if !target(libinstall)                                                        # {
1.148     lukem     499: # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
1.139     tv        500: libinstall::
                    501:
1.234     lukem     502: .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
1.89      christos  503: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.168     mycroft   504: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
1.197     mycroft   505:
1.89      christos  506: .if !defined(UPDATE)
1.197     mycroft   507: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
                    508: ${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
1.89      christos  509: .endif
1.197     mycroft   510: ${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
                    511: .else
1.157     fredb     512: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
1.89      christos  513: ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
                    514: .endif
                    515: ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
1.130     tv        516: .endif
1.197     mycroft   517: .endif
1.89      christos  518:
1.149     lukem     519: .if ${MKPROFILE} != "no"
1.89      christos  520: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.168     mycroft   521: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
1.197     mycroft   522:
1.89      christos  523: .if !defined(UPDATE)
1.197     mycroft   524: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
                    525: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
1.32      pk        526: .endif
1.197     mycroft   527: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
                    528: .else
1.157     fredb     529: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
1.89      christos  530: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
                    531: .endif
                    532: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
                    533: .endif
1.197     mycroft   534: .endif
1.89      christos  535:
1.266   ! christos  536: .if ${MKDEBUG} != "no"
        !           537: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
        !           538: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
        !           539:
        !           540: .if !defined(UPDATE)
        !           541: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
        !           542: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a! .MADE
        !           543: .endif
        !           544: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a! lib${LIB}_g.a __archiveinstall
        !           545: .else
        !           546: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
        !           547: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a: .MADE
        !           548: .endif
        !           549: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a: lib${LIB}_g.a __archiveinstall
        !           550: .endif
        !           551: .endif
        !           552:
1.149     lukem     553: .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
1.168     mycroft   554: libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.160     simonb    555: .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
1.197     mycroft   556:
1.89      christos  557: .if !defined(UPDATE)
1.197     mycroft   558: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
                    559: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
1.89      christos  560: .endif
1.197     mycroft   561: .if ${MKPICLIB} == "no"
                    562: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
                    563: .else
                    564: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
                    565: .endif
                    566: .else
1.157     fredb     567: .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
1.89      christos  568: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
1.33      pk        569: .endif
1.160     simonb    570: .if ${MKPICLIB} == "no"
1.197     mycroft   571: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
1.160     simonb    572: .else
1.89      christos  573: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
1.160     simonb    574: .endif
1.89      christos  575: .endif
1.197     mycroft   576: .endif
1.89      christos  577:
1.171     christos  578: .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
1.195     lukem     579: libinstall:: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
                    580: .PRECIOUS: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   581:
1.89      christos  582: .if !defined(UPDATE)
1.197     mycroft   583: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
                    584: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! .MADE
1.89      christos  585: .endif
1.197     mycroft   586: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
                    587: .else
1.171     christos  588: .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
1.195     lukem     589: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
1.89      christos  590: .endif
1.195     lukem     591: ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
1.197     mycroft   592: .endif
1.238     lukem     593:        ${_MKTARGET_INSTALL}
1.188     tv        594:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.264     jwise     595:                ${.ALLSRC} ${.TARGET}
1.195     lukem     596: .if ${_LIBSODIR} != ${LIBDIR}
1.264     jwise     597:        ${INSTALL_SYMLINK} \
1.261     lukem     598:                -l r ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
1.208     perry     599:                ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
1.195     lukem     600: .endif
1.148     lukem     601: .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
1.195     lukem     602:        /sbin/ldconfig -m ${_LIBSODIR} ${LIBDIR}
1.146     thorpej   603: .endif
1.148     lukem     604: .if ${OBJECT_FMT} == "ELF"
1.264     jwise     605:        ${INSTALL_SYMLINK} \
1.208     perry     606:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    607:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.195     lukem     608: .if ${_LIBSODIR} != ${LIBDIR}
1.264     jwise     609:        ${INSTALL_SYMLINK} \
1.265     christos  610:                -l r ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
1.208     perry     611:                ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
1.195     lukem     612: .endif
1.148     lukem     613: .if ${MKLINKLIB} != "no"
1.264     jwise     614:        ${INSTALL_SYMLINK} \
1.208     perry     615:                lib${LIB}.so.${SHLIB_FULLVERSION} \
                    616:                ${DESTDIR}${_LIBSODIR}/lib${LIB}.so
1.195     lukem     617: .if ${_LIBSODIR} != ${LIBDIR}
1.264     jwise     618:        ${INSTALL_SYMLINK} \
1.260     lukem     619:                -l r ${DESTDIR}${_LIBSODIR}/lib${LIB}.so.${SHLIB_FULLVERSION} \
1.208     perry     620:                ${DESTDIR}${LIBDIR}/lib${LIB}.so
1.195     lukem     621: .endif
1.83      cgd       622: .endif
1.12      cgd       623: .endif
1.139     tv        624: .endif
1.89      christos  625:
1.179     dmcmahil  626: .if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
1.89      christos  627: libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.168     mycroft   628: .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
1.197     mycroft   629:
1.89      christos  630: .if !defined(UPDATE)
1.197     mycroft   631: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
                    632: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
1.89      christos  633: .endif
1.197     mycroft   634: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
                    635: .else
1.157     fredb     636: .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
1.89      christos  637: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
                    638: .endif
1.95      mycroft   639: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
1.197     mycroft   640: .endif
1.238     lukem     641:        ${_MKTARGET_INSTALL}
1.188     tv        642:        ${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
1.264     jwise     643:                ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
1.58      cgd       644: .endif
1.252     lukem     645: .endif # !target(libinstall)                                           # }
1.1       cgd       646:
1.188     tv        647: ##### Pull in related .mk logic
1.1       cgd       648: .include <bsd.man.mk>
1.57      jtc       649: .include <bsd.nls.mk>
1.91      christos  650: .include <bsd.files.mk>
1.89      christos  651: .include <bsd.inc.mk>
1.109     cjs       652: .include <bsd.links.mk>
1.24      mycroft   653: .include <bsd.dep.mk>
1.117     mycroft   654:
1.188     tv        655: ${TARGETS}:    # ensure existence

CVSweb <webmaster@jp.NetBSD.org>