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

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

CVSweb <webmaster@jp.NetBSD.org>