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

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

CVSweb <webmaster@jp.NetBSD.org>