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

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

CVSweb <webmaster@jp.NetBSD.org>