bsd.lib.mk revision 1.324.2.1       1  1.324.2.1       tls #	$NetBSD: bsd.lib.mk,v 1.324.2.1 2012/11/20 03:00:52 tls Exp $
      2       1.92     mikel #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
      3        1.1       cgd 
      4      1.188        tv .include <bsd.init.mk>
      5      1.207   thorpej .include <bsd.shlib.mk>
      6      1.219   thorpej .include <bsd.gcc.mk>
      7      1.227     lukem # Pull in <bsd.sys.mk> here so we can override its .c.o rule
      8      1.227     lukem .include <bsd.sys.mk>
      9       1.97   mycroft 
     10      1.282     lukem LIBISMODULE?=	no
     11      1.281     lukem LIBISPRIVATE?=	no
     12      1.291       mrg LIBISCXX?=	no
     13      1.281     lukem 
     14      1.282     lukem _LIB_PREFIX=	lib
     15      1.282     lukem 
     16      1.282     lukem .if ${LIBISMODULE} != "no"
     17      1.282     lukem _LIB_PREFIX=	# empty
     18      1.282     lukem MKDEBUGLIB:=	no
     19      1.282     lukem MKLINT:=	no
     20      1.282     lukem MKPICINSTALL:=	no
     21      1.282     lukem MKPROFILE:=	no
     22      1.282     lukem MKSTATICLIB:=	no
     23      1.282     lukem .endif
     24      1.282     lukem 
     25      1.281     lukem .if ${LIBISPRIVATE} != "no"
     26      1.280     lukem MKDEBUGLIB:=	no
     27      1.280     lukem MKLINT:=	no
     28      1.290      cube MKPICINSTALL:=	no
     29      1.290      cube . if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
     30      1.290      cube MKSTATICLIB:=	no
     31      1.290      cube . else
     32      1.280     lukem MKPIC:=		no
     33      1.290      cube . endif
     34      1.280     lukem MKPROFILE:=	no
     35      1.280     lukem .endif
     36      1.280     lukem 
     37      1.188        tv ##### Basic targets
     38      1.246     lukem .PHONY:		checkver libinstall
     39      1.143       erh realinstall:	checkver libinstall
     40      1.232       erh 
     41      1.232       erh ##### LIB specific flags.
     42      1.287  christos # XXX: This is needed for programs that link with .a libraries
     43      1.287  christos # Perhaps a more correct solution is to always generate _pic.a
     44      1.287  christos # files or always have a shared library.
     45      1.287  christos .if defined(MKPIE) && (${MKPIE} != "no")
     46      1.287  christos CFLAGS+=        ${PIE_CFLAGS}
     47      1.288  christos AFLAGS+=        ${PIE_AFLAGS}
     48      1.287  christos .endif
     49        1.1       cgd 
     50      1.256     lukem ##### Libraries that this may depend upon.
     51      1.256     lukem .if defined(LIBDPLIBS) && ${MKPIC} != "no"				# {
     52      1.256     lukem .for _lib _dir in ${LIBDPLIBS}
     53      1.256     lukem .if !defined(LIBDO.${_lib})
     54      1.303  christos LIBDO.${_lib}!=	cd "${_dir}" && ${PRINTOBJDIR}
     55      1.256     lukem .MAKEOVERRIDES+=LIBDO.${_lib}
     56      1.256     lukem .endif
     57  1.324.2.1       tls .if ${LIBDO.${_lib}} == "_external"
     58  1.324.2.1       tls LDADD+=		-l${_lib}
     59  1.324.2.1       tls .else
     60      1.256     lukem LDADD+=		-L${LIBDO.${_lib}} -l${_lib}
     61      1.256     lukem DPADD+=		${LIBDO.${_lib}}/lib${_lib}.so
     62  1.324.2.1       tls .endif
     63      1.256     lukem .endfor
     64      1.256     lukem .endif									# }
     65      1.256     lukem 
     66      1.188        tv ##### Build and install rules
     67      1.304     njoly MKDEP_SUFFIXES?=	.o .po .pico .go .ln
     68      1.292     pooka 
     69      1.252     lukem .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})		# {
     70      1.154    simonb SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
     71      1.154    simonb SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
     72      1.171  christos SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
     73      1.143       erh 
     74      1.295        he DPADD+=	${SHLIB_VERSION_FILE}
     75      1.295        he 
     76      1.143       erh # Check for higher installed library versions.
     77      1.145       erh .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
     78      1.201     lukem 	exists(${NETBSDSRCDIR}/lib/checkver)
     79      1.143       erh checkver:
     80      1.303  christos 	@(cd "${.CURDIR}" && \
     81      1.289       apb 	    HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
     82      1.239     lukem 	    ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
     83      1.195     lukem 		    -d ${DESTDIR}${_LIBSODIR} ${LIB})
     84      1.173  christos .endif
     85      1.252     lukem .endif									# }
     86      1.173  christos 
     87      1.173  christos .if !target(checkver)
     88      1.143       erh checkver:
     89      1.143       erh .endif
     90      1.173  christos 
     91      1.169   thorpej print-shlib-major:
     92      1.185        tv .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
     93      1.169   thorpej 	@echo ${SHLIB_MAJOR}
     94      1.173  christos .else
     95      1.173  christos 	@false
     96      1.173  christos .endif
     97      1.169   thorpej 
     98      1.169   thorpej print-shlib-minor:
     99      1.185        tv .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
    100      1.169   thorpej 	@echo ${SHLIB_MINOR}
    101      1.173  christos .else
    102      1.173  christos 	@false
    103      1.173  christos .endif
    104      1.171  christos 
    105      1.171  christos print-shlib-teeny:
    106      1.185        tv .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
    107      1.171  christos 	@echo ${SHLIB_TEENY}
    108      1.143       erh .else
    109      1.169   thorpej 	@false
    110      1.173  christos .endif
    111      1.169   thorpej 
    112      1.252     lukem .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)				# {
    113      1.173  christos .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
    114      1.173  christos .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
    115      1.173  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
    116      1.173  christos .else
    117      1.173  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
    118      1.173  christos .endif
    119      1.173  christos .else
    120      1.173  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}
    121      1.173  christos .endif
    122      1.252     lukem .endif									# }
    123        1.1       cgd 
    124      1.101   mycroft # add additional suffixes not exported.
    125      1.101   mycroft # .po is used for profiling object files.
    126      1.304     njoly # .pico is used for PIC object files.
    127      1.304     njoly .SUFFIXES: .out .a .ln .pico .po .go .o .s .S .c .cc .cpp .cxx .C .m .F .f .r .y .l .cl .p .h
    128      1.118     lukem .SUFFIXES: .sh .m4 .m
    129       1.82     mikel 
    130       1.86  jonathan 
    131       1.86  jonathan # Set PICFLAGS to cc flags for producing position-independent code,
    132       1.86  jonathan # if not already set.  Includes -DPIC, if required.
    133       1.86  jonathan 
    134      1.164    simonb # Data-driven table using make variables to control how shared libraries
    135       1.86  jonathan # are built for different platforms and object formats.
    136      1.302       abs # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
    137      1.302       abs #			numbers of shared library
    138      1.164    simonb # SHLIB_SOVERSION:	version number to be compiled into a shared library
    139      1.164    simonb #			via -soname. Usualy ${SHLIB_MAJOR} on ELF.
    140      1.173  christos #			NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
    141      1.173  christos #			[.${SHLIB_TEENY}]]
    142      1.164    simonb # SHLIB_SHFLAGS:	Flags to tell ${LD} to emit shared library.
    143      1.123  jonathan #			with ELF, also set shared-lib version for ld.so.
    144      1.123  jonathan # SHLIB_LDSTARTFILE:	support .o file, call C++ file-level constructors
    145      1.123  jonathan # SHLIB_LDENDFILE:	support .o file, call C++ file-level destructors
    146      1.304     njoly # FPICFLAGS:		flags for ${FC} to compile .[fF] files to .pico objects.
    147      1.271   tsutsui # CPPPICFLAGS:		flags for ${CPP} to preprocess .[sS] files for ${AS}
    148      1.205      yamt # CPICFLAGS:		flags for ${CC} to compile .[cC] files to pic objects.
    149      1.304     njoly # CSHLIBFLAGS:		flags for ${CC} to compile .[cC] files to .pico objects.
    150      1.205      yamt #			(usually includes ${CPICFLAGS})
    151      1.205      yamt # CAPICFLAGS:		flags for ${CC} to compiling .[Ss] files
    152      1.107  jonathan #		 	(usually just ${CPPPICFLAGS} ${CPICFLAGS})
    153      1.304     njoly # APICFLAGS:		flags for ${AS} to assemble .[sS] to .pico objects.
    154       1.86  jonathan 
    155      1.252     lukem .if ${MACHINE_ARCH} == "alpha"						# {
    156      1.209   thorpej 
    157      1.179  dmcmahil FPICFLAGS ?= -fPIC
    158      1.165  dmcmahil CPICFLAGS ?= -fPIC -DPIC
    159      1.222     lukem CPPPICFLAGS?= -DPIC
    160      1.107  jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    161      1.107  jonathan APICFLAGS ?=
    162      1.209   thorpej 
    163      1.308       mrg .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 	# } {
    164      1.209   thorpej 
    165      1.222     lukem # If you use -fPIC you need to define BIGPIC to turn on 32-bit
    166      1.202       eeh # relocations in asm code
    167      1.179  dmcmahil FPICFLAGS ?= -fPIC
    168      1.165  dmcmahil CPICFLAGS ?= -fPIC -DPIC
    169      1.202       eeh CPPPICFLAGS?= -DPIC -DBIGPIC
    170      1.150  christos CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    171      1.203       eeh APICFLAGS ?= -KPIC
    172      1.204  fredette 
    173      1.252     lukem .else									# } {
    174       1.86  jonathan 
    175      1.244     skrll # Platform-independent flags for NetBSD shared libraries
    176      1.171  christos SHLIB_SOVERSION=${SHLIB_FULLVERSION}
    177      1.125  jonathan SHLIB_SHFLAGS=
    178      1.179  dmcmahil FPICFLAGS ?= -fPIC
    179      1.165  dmcmahil CPICFLAGS?= -fPIC -DPIC
    180      1.222     lukem CPPPICFLAGS?= -DPIC
    181      1.107  jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    182      1.107  jonathan APICFLAGS?= -k
    183       1.86  jonathan 
    184      1.252     lukem .endif									# }
    185      1.160    simonb 
    186      1.205      yamt .if ${MKPICLIB} != "no"
    187      1.205      yamt CSHLIBFLAGS+= ${CPICFLAGS}
    188      1.205      yamt .endif
    189      1.205      yamt 
    190      1.205      yamt .if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
    191      1.205      yamt MKSHLIBOBJS= yes
    192      1.205      yamt .else
    193      1.205      yamt MKSHLIBOBJS= no
    194      1.205      yamt .endif
    195      1.205      yamt 
    196      1.123  jonathan # Platform-independent linker flags for ELF shared libraries
    197      1.182       mrg SHLIB_SOVERSION=	${SHLIB_MAJOR}
    198      1.282     lukem SHLIB_SHFLAGS=		-Wl,-soname,${_LIB_PREFIX}${LIB}.so.${SHLIB_SOVERSION}
    199      1.272  christos SHLIB_SHFLAGS+=		-Wl,--warn-shared-textrel
    200      1.322  christos SHLIB_LDSTARTFILE?=	${_GCC_CRTI} ${_GCC_CRTBEGINS}
    201      1.322  christos SHLIB_LDENDFILE?=	${_GCC_CRTENDS} ${_GCC_CRTN}
    202       1.86  jonathan 
    203       1.82     mikel CFLAGS+=	${COPTS}
    204      1.267       mrg OBJCFLAGS+=	${OBJCOPTS}
    205      1.257    simonb AFLAGS+=	${COPTS}
    206      1.179  dmcmahil FFLAGS+=	${FOPTS}
    207        1.1       cgd 
    208      1.305    darran .if defined(CTFCONVERT)
    209      1.305    darran .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
    210      1.305    darran CTFFLAGS+=	-g
    211      1.305    darran .endif
    212      1.305    darran .endif
    213      1.305    darran 
    214        1.1       cgd .c.o:
    215      1.238     lukem 	${_MKTARGET_COMPILE}
    216      1.263       dsl 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    217      1.305    darran .if defined(CTFCONVERT)
    218      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    219      1.305    darran .endif
    220      1.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    221      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    222      1.153  christos .endif
    223        1.1       cgd 
    224        1.1       cgd .c.po:
    225      1.238     lukem 	${_MKTARGET_COMPILE}
    226      1.263       dsl 	${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
    227      1.305    darran .if defined(CTFCONVERT)
    228      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    229      1.305    darran .endif
    230      1.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    231      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    232      1.153  christos .endif
    233       1.17   mycroft 
    234      1.266  christos .c.go:
    235      1.266  christos 	${_MKTARGET_COMPILE}
    236      1.266  christos 	${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
    237      1.266  christos 
    238      1.304     njoly .c.pico:
    239      1.238     lukem 	${_MKTARGET_COMPILE}
    240      1.263       dsl 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
    241      1.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    242      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    243      1.153  christos .endif
    244       1.27        pk 
    245      1.223     lukem .cc.o .cpp.o .cxx.o .C.o:
    246      1.238     lukem 	${_MKTARGET_COMPILE}
    247      1.263       dsl 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    248      1.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    249      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    250      1.153  christos .endif
    251       1.17   mycroft 
    252      1.266  christos .cc.po .cpp.po .cxx.po .C.po:
    253      1.238     lukem 	${_MKTARGET_COMPILE}
    254      1.263       dsl 	${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
    255      1.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    256      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    257      1.153  christos .endif
    258       1.28       cgd 
    259      1.266  christos .cc.go .cpp.go .cxx.go .C.go:
    260      1.266  christos 	${_MKTARGET_COMPILE}
    261      1.266  christos 	${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
    262      1.266  christos 
    263      1.304     njoly .cc.pico .cpp.pico .cxx.pico .C.pico:
    264      1.238     lukem 	${_MKTARGET_COMPILE}
    265      1.263       dsl 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
    266      1.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    267      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    268      1.153  christos .endif
    269      1.118     lukem 
    270      1.179  dmcmahil .f.o:
    271      1.238     lukem 	${_MKTARGET_COMPILE}
    272      1.263       dsl 	${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
    273      1.305    darran .if defined(CTFCONVERT)
    274      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    275      1.305    darran .endif
    276      1.263       dsl .if !defined(FOPTS) || empty(FOPTS:M*-g*)
    277      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    278      1.179  dmcmahil .endif
    279      1.179  dmcmahil 
    280      1.179  dmcmahil .f.po:
    281      1.238     lukem 	${_MKTARGET_COMPILE}
    282      1.263       dsl 	${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
    283      1.305    darran .if defined(CTFCONVERT)
    284      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    285      1.305    darran .endif
    286      1.263       dsl .if !defined(FOPTS) || empty(FOPTS:M*-g*)
    287      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    288      1.179  dmcmahil .endif
    289      1.179  dmcmahil 
    290      1.266  christos .f.go:
    291      1.266  christos 	${_MKTARGET_COMPILE}
    292      1.266  christos 	${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
    293      1.266  christos 
    294      1.304     njoly .f.pico:
    295      1.238     lukem 	${_MKTARGET_COMPILE}
    296      1.263       dsl 	${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    297      1.263       dsl .if !defined(FOPTS) || empty(FOPTS:M*-g*)
    298      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    299      1.179  dmcmahil .endif
    300      1.179  dmcmahil 
    301      1.179  dmcmahil .f.ln:
    302      1.238     lukem 	${_MKTARGET_COMPILE}
    303      1.217       wiz 	@echo Skipping lint for Fortran libraries.
    304      1.179  dmcmahil 
    305      1.118     lukem .m.o:
    306      1.238     lukem 	${_MKTARGET_COMPILE}
    307      1.267       mrg 	${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    308      1.305    darran .if defined(CTFCONVERT)
    309      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    310      1.305    darran .endif
    311      1.263       dsl .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    312      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    313      1.153  christos .endif
    314      1.118     lukem 
    315      1.118     lukem .m.po:
    316      1.238     lukem 	${_MKTARGET_COMPILE}
    317      1.267       mrg 	${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    318      1.305    darran .if defined(CTFCONVERT)
    319      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    320      1.305    darran .endif
    321      1.263       dsl .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    322      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    323      1.153  christos .endif
    324      1.118     lukem 
    325      1.266  christos .m.go:
    326      1.266  christos 	${_MKTARGET_COMPILE}
    327      1.267       mrg 	${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    328      1.266  christos .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    329      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    330      1.266  christos .endif
    331      1.266  christos 
    332      1.304     njoly .m.pico:
    333      1.238     lukem 	${_MKTARGET_COMPILE}
    334      1.267       mrg 	${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    335      1.263       dsl .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    336      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    337      1.153  christos .endif
    338        1.1       cgd 
    339      1.251     lukem .s.o:
    340      1.238     lukem 	${_MKTARGET_COMPILE}
    341      1.263       dsl 	${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    342      1.305    darran .if defined(CTFCONVERT)
    343      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    344      1.305    darran .endif
    345      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    346        1.1       cgd 
    347      1.251     lukem .S.o:
    348      1.251     lukem 	${_MKTARGET_COMPILE}
    349      1.263       dsl 	${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    350      1.305    darran .if defined(CTFCONVERT)
    351      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    352      1.305    darran .endif
    353      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    354      1.251     lukem 
    355      1.251     lukem .s.po:
    356      1.251     lukem 	${_MKTARGET_COMPILE}
    357      1.263       dsl 	${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    358      1.305    darran .if defined(CTFCONVERT)
    359      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    360      1.305    darran .endif
    361      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    362      1.251     lukem 
    363      1.251     lukem .S.po:
    364      1.238     lukem 	${_MKTARGET_COMPILE}
    365      1.263       dsl 	${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    366      1.305    darran .if defined(CTFCONVERT)
    367      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    368      1.305    darran .endif
    369      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    370        1.1       cgd 
    371      1.266  christos .s.go:
    372      1.266  christos 	${_MKTARGET_COMPILE}
    373      1.266  christos 	${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    374      1.266  christos 
    375      1.266  christos .S.go:
    376      1.266  christos 	${_MKTARGET_COMPILE}
    377      1.266  christos 	${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    378      1.266  christos 
    379      1.304     njoly .s.pico:
    380      1.251     lukem 	${_MKTARGET_COMPILE}
    381      1.263       dsl 	${COMPILE.s} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    382      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    383      1.251     lukem 
    384      1.304     njoly .S.pico:
    385      1.238     lukem 	${_MKTARGET_COMPILE}
    386      1.263       dsl 	${COMPILE.S} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    387      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    388       1.27        pk 
    389      1.252     lukem .if defined(LIB)							# {
    390      1.234     lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    391      1.234     lukem 	|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
    392      1.130        tv _LIBS=lib${LIB}.a
    393      1.130        tv .else
    394      1.130        tv _LIBS=
    395      1.130        tv .endif
    396       1.58       cgd 
    397      1.321      matt .if ${LIBISPRIVATE} != "no" \
    398      1.321      matt    && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \
    399      1.321      matt    && !defined(NOCOMBINE))						# {
    400      1.321      matt .for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g}
    401      1.321      matt COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
    402      1.321      matt .if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f)
    403      1.321      matt COMBINESRCS+=	${f}
    404      1.321      matt NODPSRCS+=	${f}
    405      1.321      matt .else
    406      1.321      matt OBJS+=  	${f:R:S/$/.o/}
    407      1.321      matt .endif
    408      1.321      matt .endfor
    409      1.321      matt 
    410      1.321      matt .if !empty(COMBINESRCS)
    411      1.321      matt OBJS+=		lib${LIB}_combine.o
    412      1.321      matt lib${LIB}_combine.o: ${COMBINESRCS}
    413      1.321      matt 	${_MKTARGET_COMPILE}
    414      1.321      matt 	${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET}
    415      1.321      matt .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    416      1.321      matt 	${OBJCOPY} -x ${.TARGET}
    417      1.321      matt .endif
    418      1.321      matt 
    419      1.321      matt CLEANFILES+=	lib${LIB}_combine.d
    420      1.321      matt 
    421      1.321      matt .if exists("lib${LIB}_combine.d")
    422      1.321      matt .include "lib${LIB}_combine.d"
    423      1.321      matt .endif
    424      1.321      matt .endif   # empty(XSRCS.${LIB})
    425      1.321      matt .else							# } {
    426      1.167      matt OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
    427      1.321      matt .endif							# }
    428      1.158  christos 
    429      1.255   thorpej STOBJS+=${OBJS}
    430      1.255   thorpej 
    431      1.280     lukem LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
    432      1.280     lukem 
    433      1.281     lukem .if ${LIBISPRIVATE} != "no"
    434      1.252     lukem # No installation is required
    435      1.252     lukem libinstall::
    436      1.306     lukem .endif
    437      1.252     lukem 
    438      1.268     lukem .if ${MKDEBUGLIB} != "no"
    439      1.266  christos _LIBS+=lib${LIB}_g.a
    440      1.266  christos GOBJS+=${OBJS:.o=.go}
    441      1.266  christos DEBUGFLAGS?=-DDEBUG
    442      1.266  christos .endif
    443      1.266  christos 
    444      1.149     lukem .if ${MKPROFILE} != "no"
    445      1.130        tv _LIBS+=lib${LIB}_p.a
    446      1.167      matt POBJS+=${OBJS:.o=.po}
    447      1.262  christos PROFFLAGS?=-DGPROF -DPROF
    448        1.1       cgd .endif
    449        1.1       cgd 
    450      1.252     lukem .if ${MKPIC} != "no"							# {
    451      1.160    simonb .if ${MKPICLIB} == "no"
    452      1.205      yamt .if ${MKSHLIBOBJS} != "no"
    453      1.205      yamt # make _pic.a, which isn't really pic,
    454      1.205      yamt # since it's needed for making shared lib.
    455      1.205      yamt # but don't install it.
    456      1.205      yamt SOLIB=lib${LIB}_pic.a
    457      1.304     njoly SOBJS+=${OBJS:.o=.pico}
    458      1.205      yamt .else
    459      1.160    simonb SOLIB=lib${LIB}.a
    460      1.205      yamt .endif
    461      1.160    simonb .else
    462      1.160    simonb SOLIB=lib${LIB}_pic.a
    463      1.160    simonb _LIBS+=${SOLIB}
    464      1.304     njoly SOBJS+=${OBJS:.o=.pico}
    465      1.160    simonb .endif
    466      1.171  christos .if defined(SHLIB_FULLVERSION)
    467      1.307     lukem _LIB.so:=lib${LIB}.so.${SHLIB_FULLVERSION}
    468      1.308       mrg .if ${MKDEBUG} != "no"
    469      1.307     lukem _LIB.debug:=${_LIB.so}.debug
    470      1.307     lukem .endif
    471      1.171  christos _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
    472       1.27        pk .endif
    473      1.252     lukem .endif									# }
    474       1.27        pk 
    475      1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    476       1.58       cgd _LIBS+=llib-l${LIB}.ln
    477      1.215  christos .endif
    478       1.27        pk 
    479      1.234     lukem ALLOBJS=
    480      1.234     lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    481      1.234     lukem 	|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
    482      1.255   thorpej ALLOBJS+=${STOBJS}
    483      1.179  dmcmahil .endif
    484      1.234     lukem ALLOBJS+=${POBJS} ${SOBJS}
    485      1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    486      1.179  dmcmahil ALLOBJS+=${LOBJS}
    487      1.216  christos .endif
    488      1.252     lukem .else	# !defined(LIB)							# } {
    489      1.216  christos LOBJS=
    490      1.216  christos SOBJS=
    491      1.252     lukem .endif	# !defined(LIB)							# }
    492      1.186        tv 
    493      1.254     lukem _YLSRCS=	${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
    494      1.253  christos 
    495      1.253  christos .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
    496      1.158  christos 
    497      1.307     lukem realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.debug}
    498        1.1       cgd 
    499      1.296     perry MKARZERO?=no
    500      1.296     perry 
    501      1.296     perry .if ${MKARZERO} == "yes"
    502      1.296     perry _ARFL=crsD
    503      1.297     perry _ARRANFL=sD
    504      1.296     perry _INSTRANLIB=
    505      1.296     perry .else
    506      1.296     perry _ARFL=crs
    507      1.297     perry _ARRANFL=s
    508      1.296     perry _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
    509      1.296     perry .endif
    510      1.296     perry 
    511      1.293     pooka # If you change this, please consider reflecting the change in
    512      1.293     pooka # the override in sys/rump/Makefile.rump.
    513      1.243       rtr .if !target(__archivebuild)
    514       1.90  christos __archivebuild: .USE
    515      1.238     lukem 	${_MKTARGET_BUILD}
    516      1.236     lukem 	rm -f ${.TARGET}
    517      1.296     perry 	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
    518      1.243       rtr .endif
    519       1.89  christos 
    520      1.243       rtr .if !target(__archiveinstall)
    521       1.89  christos __archiveinstall: .USE
    522      1.238     lukem 	${_MKTARGET_INSTALL}
    523      1.198     lukem 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    524      1.296     perry 	    ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
    525      1.243       rtr .endif
    526       1.89  christos 
    527      1.197   mycroft __archivesymlinkpic: .USE
    528      1.238     lukem 	${_MKTARGET_INSTALL}
    529      1.264     jwise 	${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
    530      1.197   mycroft 
    531      1.253  christos DPSRCS+=	${_YLSRCS}
    532      1.253  christos CLEANFILES+=	${_YLSRCS}
    533      1.230     lukem 
    534      1.266  christos ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
    535      1.103   mycroft 
    536      1.255   thorpej lib${LIB}.a:: ${STOBJS} __archivebuild
    537        1.1       cgd 
    538       1.89  christos lib${LIB}_p.a:: ${POBJS} __archivebuild
    539        1.1       cgd 
    540       1.89  christos lib${LIB}_pic.a:: ${SOBJS} __archivebuild
    541       1.27        pk 
    542      1.266  christos lib${LIB}_g.a:: ${GOBJS} __archivebuild
    543      1.266  christos 
    544      1.235     lukem 
    545      1.235     lukem _LIBLDOPTS=
    546      1.235     lukem .if ${SHLIBDIR} != "/usr/lib"
    547      1.324     joerg _LIBLDOPTS+=	-Wl,-rpath,${SHLIBDIR} \
    548      1.324     joerg 		-L=${SHLIBDIR}
    549      1.324     joerg .elif ${SHLIBINSTALLDIR} != "/usr/lib"
    550      1.324     joerg _LIBLDOPTS+=	-Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
    551      1.324     joerg 		-L=${SHLIBINSTALLDIR}
    552      1.235     lukem .endif
    553      1.235     lukem 
    554      1.277  christos # gcc -shared now adds -lc automatically. For libraries other than libc and
    555      1.277  christos # libgcc* we add as a dependency the installed shared libc. For libc and
    556      1.277  christos # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
    557      1.277  christos # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
    558      1.277  christos # to add standard libraries, not the linker.
    559      1.276  christos .if !defined(LIB)
    560      1.312      matt .if !empty(LIBC_SO)
    561      1.274  christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
    562      1.312      matt .endif
    563      1.276  christos .else
    564      1.278    simonb .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
    565      1.312      matt .if !empty(LIBC_SO)
    566      1.276  christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
    567      1.312      matt .endif
    568      1.277  christos .else
    569      1.278    simonb LDLIBC ?= -nodefaultlibs
    570      1.278    simonb .if ${LIB} == "c"
    571      1.318       mrg LDADD+= -lgcc
    572      1.278    simonb .endif
    573      1.276  christos .endif
    574      1.274  christos .endif
    575      1.274  christos 
    576      1.291       mrg .if ${LIBISCXX} != "no"
    577      1.291       mrg LIBCC:=	${CXX}
    578      1.291       mrg .else
    579      1.291       mrg LIBCC:=	${CC}
    580      1.291       mrg .endif
    581      1.291       mrg 
    582      1.300  uebayasi _LDADD.lib${LIB}=	${LDADD} ${LDADD.lib${LIB}}
    583      1.300  uebayasi _LDFLAGS.lib${LIB}=	${LDFLAGS} ${LDFLAGS.lib${LIB}}
    584      1.300  uebayasi 
    585      1.274  christos lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \
    586       1.88       cgd     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
    587      1.238     lukem 	${_MKTARGET_BUILD}
    588      1.236     lukem 	rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
    589      1.300  uebayasi 	${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${_LDFLAGS.lib${LIB}} \
    590      1.277  christos 	    -o ${.TARGET} ${_LIBLDOPTS} \
    591      1.300  uebayasi 	    -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${_LDADD.lib${LIB}}
    592      1.196     lukem #  We don't use INSTALL_SYMLINK here because this is just
    593      1.196     lukem #  happening inside the build directory/objdir. XXX Why does
    594      1.196     lukem #  this spend so much effort on libraries that aren't live??? XXX
    595      1.284     lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    596      1.284     lukem     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    597      1.241      matt 	${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
    598      1.177   mycroft 	mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
    599      1.283     lukem .endif
    600      1.241      matt 	${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
    601      1.177   mycroft 	mv -f lib${LIB}.so.tmp lib${LIB}.so
    602      1.286     joerg .if ${MKSTRIPIDENT} != "no"
    603      1.286     joerg 	${OBJCOPY} -R .ident ${.TARGET}
    604      1.286     joerg .endif
    605       1.35        pk 
    606      1.307     lukem .if defined(_LIB.debug)
    607      1.307     lukem ${_LIB.debug}: ${_LIB.so}
    608      1.307     lukem 	${_MKTARGET_CREATE}
    609      1.309     lukem 	(  ${OBJCOPY} --only-keep-debug ${_LIB.so} ${_LIB.debug} \
    610      1.309     lukem 	&& ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
    611      1.309     lukem 		--add-gnu-debuglink=${_LIB.debug} ${_LIB.so} \
    612      1.309     lukem 	) || (rm -f ${_LIB.debug}; false)
    613      1.307     lukem .endif
    614      1.307     lukem 
    615      1.252     lukem .if !empty(LOBJS)							# {
    616      1.103   mycroft LLIBS?=		-lc
    617       1.58       cgd llib-l${LIB}.ln: ${LOBJS}
    618      1.238     lukem 	${_MKTARGET_COMPILE}
    619      1.236     lukem 	rm -f llib-l${LIB}.ln
    620      1.206   thorpej .if defined(DESTDIR)
    621      1.228     lukem 	${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
    622      1.206   thorpej .else
    623      1.228     lukem 	${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
    624      1.206   thorpej .endif
    625      1.252     lukem .endif									# }
    626        1.1       cgd 
    627      1.280     lukem lint: ${LOBJS}
    628      1.280     lukem .if defined(LOBJS) && !empty(LOBJS)
    629      1.280     lukem 	${LINT} ${LINTFLAGS} ${LOBJS}
    630      1.280     lukem .endif
    631      1.280     lukem 
    632      1.317       apb # If the number of entries in CLEANFILES is too large, then the
    633      1.317       apb # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
    634      1.317       apb # failed (Argument list too long)".  Avoid that by splitting the
    635      1.317       apb # files to clean into several lists using different variable names.
    636      1.317       apb # __cleanuse is an internal target in bsd.clean.mk; the way we
    637      1.317       apb # use it here mimics the way it's used by the clean target in
    638      1.317       apb # bsd.clean.mk.
    639      1.317       apb #
    640      1.317       apb clean: libclean1 libclean2 libclean3 libclean4 libclean5
    641      1.317       apb libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
    642      1.317       apb libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
    643      1.317       apb libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
    644      1.317       apb libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
    645      1.317       apb libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
    646      1.316       apb CLEANFILES+= a.out [Ee]rrs mklog core *.core
    647      1.317       apb LIBCLEANFILES1+= lib${LIB}.a   ${STOBJS} ${STOBJS:=.tmp}
    648      1.317       apb LIBCLEANFILES2+= lib${LIB}_p.a ${POBJS}  ${POBJS:=.tmp}
    649      1.317       apb LIBCLEANFILES3+= lib${LIB}_g.a ${GOBJS}  ${GOBJS:=.tmp}
    650      1.317       apb LIBCLEANFILES4+= lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${_LIB.debug}
    651      1.317       apb LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
    652      1.317       apb LIBCLEANFILES5+= llib-l${LIB}.ln ${LOBJS}
    653      1.252     lukem 
    654      1.252     lukem .if !target(libinstall)							# {
    655      1.148     lukem # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
    656      1.139        tv libinstall::
    657      1.139        tv 
    658      1.234     lukem .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
    659       1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    660      1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    661      1.197   mycroft 
    662      1.269       dbj .if ${MKUPDATE} == "no"
    663      1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
    664      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
    665       1.89  christos .endif
    666      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
    667      1.197   mycroft .else
    668      1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
    669       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
    670       1.89  christos .endif
    671       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
    672      1.130        tv .endif
    673      1.197   mycroft .endif
    674       1.89  christos 
    675      1.149     lukem .if ${MKPROFILE} != "no"
    676       1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    677      1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    678      1.197   mycroft 
    679      1.269       dbj .if ${MKUPDATE} == "no"
    680      1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
    681      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
    682       1.32        pk .endif
    683      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
    684      1.197   mycroft .else
    685      1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
    686       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
    687       1.89  christos .endif
    688       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
    689       1.89  christos .endif
    690      1.197   mycroft .endif
    691       1.89  christos 
    692      1.268     lukem .if ${MKDEBUGLIB} != "no"
    693      1.266  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
    694      1.266  christos .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
    695      1.266  christos 
    696      1.269       dbj .if ${MKUPDATE} == "no"
    697      1.266  christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
    698      1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a! .MADE
    699      1.266  christos .endif
    700      1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a! lib${LIB}_g.a __archiveinstall
    701      1.266  christos .else
    702      1.266  christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
    703      1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a: .MADE
    704      1.266  christos .endif
    705      1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a: lib${LIB}_g.a __archiveinstall
    706      1.266  christos .endif
    707      1.266  christos .endif
    708      1.266  christos 
    709      1.149     lukem .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
    710      1.168   mycroft libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    711      1.160    simonb .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    712      1.197   mycroft 
    713      1.269       dbj .if ${MKUPDATE} == "no"
    714      1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
    715      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
    716       1.89  christos .endif
    717      1.197   mycroft .if ${MKPICLIB} == "no"
    718      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
    719      1.197   mycroft .else
    720      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
    721      1.197   mycroft .endif
    722      1.197   mycroft .else
    723      1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
    724       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
    725       1.33        pk .endif
    726      1.160    simonb .if ${MKPICLIB} == "no"
    727      1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
    728      1.160    simonb .else
    729       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
    730      1.160    simonb .endif
    731       1.89  christos .endif
    732      1.197   mycroft .endif
    733       1.89  christos 
    734      1.171  christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    735      1.282     lukem _LIB_SO_TGT=		${DESTDIR}${_LIBSODIR}/${_LIB_PREFIX}${LIB}.so
    736      1.282     lukem _LIB_SO_TGTLIBDIR=	   ${DESTDIR}${LIBDIR}/${_LIB_PREFIX}${LIB}.so
    737      1.282     lukem 
    738      1.282     lukem libinstall:: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
    739      1.282     lukem .PRECIOUS: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
    740      1.197   mycroft 
    741      1.269       dbj .if ${MKUPDATE} == "no"
    742      1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
    743      1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! .MADE
    744       1.89  christos .endif
    745      1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
    746      1.197   mycroft .else
    747      1.171  christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
    748      1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: .MADE
    749       1.89  christos .endif
    750      1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
    751      1.197   mycroft .endif
    752      1.238     lukem 	${_MKTARGET_INSTALL}
    753      1.188        tv 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    754      1.264     jwise 		${.ALLSRC} ${.TARGET}
    755      1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    756      1.282     lukem 	${INSTALL_SYMLINK} -l r \
    757      1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
    758      1.282     lukem 		${_LIB_SO_TGTLIBDIR}.${SHLIB_FULLVERSION}
    759      1.195     lukem .endif
    760      1.284     lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    761      1.284     lukem     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    762      1.264     jwise 	${INSTALL_SYMLINK} \
    763      1.284     lukem 		${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
    764      1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_MAJOR}
    765      1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    766      1.282     lukem 	${INSTALL_SYMLINK} -l r \
    767      1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
    768      1.282     lukem 		${_LIB_SO_TGTLIBDIR}.${SHLIB_MAJOR}
    769      1.195     lukem .endif
    770      1.284     lukem .endif
    771      1.148     lukem .if ${MKLINKLIB} != "no"
    772      1.264     jwise 	${INSTALL_SYMLINK} \
    773      1.284     lukem 		${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
    774      1.282     lukem 		${_LIB_SO_TGT}
    775      1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    776      1.282     lukem 	${INSTALL_SYMLINK} -l r \
    777      1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
    778      1.282     lukem 		${_LIB_SO_TGTLIBDIR}
    779      1.195     lukem .endif
    780       1.83       cgd .endif
    781       1.12       cgd .endif
    782       1.89  christos 
    783      1.307     lukem .if defined(_LIB.debug)
    784      1.307     lukem libinstall:: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
    785      1.307     lukem .PRECIOUS: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
    786      1.307     lukem 
    787      1.307     lukem ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}: ${_LIB.debug}
    788      1.307     lukem 	${_MKTARGET_INSTALL}
    789      1.307     lukem 	${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
    790      1.307     lukem 		${.ALLSRC} ${.TARGET}
    791      1.307     lukem .endif
    792      1.307     lukem 
    793      1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    794       1.89  christos libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    795      1.168   mycroft .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    796      1.197   mycroft 
    797      1.269       dbj .if ${MKUPDATE} == "no"
    798      1.197   mycroft .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
    799      1.197   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
    800       1.89  christos .endif
    801      1.197   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
    802      1.197   mycroft .else
    803      1.157     fredb .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
    804       1.89  christos ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
    805       1.89  christos .endif
    806       1.95   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
    807      1.197   mycroft .endif
    808      1.238     lukem 	${_MKTARGET_INSTALL}
    809      1.188        tv 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    810      1.264     jwise 		${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
    811       1.58       cgd .endif
    812      1.252     lukem .endif	# !target(libinstall)						# }
    813        1.1       cgd 
    814      1.188        tv ##### Pull in related .mk logic
    815      1.298       apb LINKSOWN?= ${LIBOWN}
    816      1.298       apb LINKSGRP?= ${LIBGRP}
    817      1.298       apb LINKSMODE?= ${LIBMODE}
    818        1.1       cgd .include <bsd.man.mk>
    819       1.57       jtc .include <bsd.nls.mk>
    820       1.91  christos .include <bsd.files.mk>
    821       1.89  christos .include <bsd.inc.mk>
    822      1.109       cjs .include <bsd.links.mk>
    823       1.24   mycroft .include <bsd.dep.mk>
    824      1.315     joerg .include <bsd.clang-analyze.mk>
    825      1.316       apb .include <bsd.clean.mk>
    826      1.117   mycroft 
    827      1.188        tv ${TARGETS}:	# ensure existence
    828