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