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

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

CVSweb <webmaster@jp.NetBSD.org>