Home | History | Annotate | Line # | Download | only in mk
bsd.lib.mk revision 1.324.2.3
      1  1.324.2.3       tls #	$NetBSD: bsd.lib.mk,v 1.324.2.3 2013/06/23 06:28:54 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 .if ${LIBISMODULE} != "no"
     15  1.324.2.2       tls _LIB_PREFIX?=	# empty
     16      1.282     lukem MKDEBUGLIB:=	no
     17      1.282     lukem MKLINT:=	no
     18      1.282     lukem MKPICINSTALL:=	no
     19      1.282     lukem MKPROFILE:=	no
     20      1.282     lukem MKSTATICLIB:=	no
     21  1.324.2.2       tls .else
     22  1.324.2.2       tls _LIB_PREFIX?=	lib
     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.324.2.2       tls DPADD+=		${LIBDO.${_lib}}/lib${_lib}.so	# Don't use _LIB_PREFIX
     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.324.2.2       tls 		    -d ${_DEST.OBJ} ${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.324.2.3       tls .if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \
    197  1.324.2.3       tls     (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
    198  1.324.2.3       tls # We only add -g to the shared library objects
    199  1.324.2.3       tls # because we don't currently split .a archives.
    200  1.324.2.3       tls CSHLIBFLAGS+=	-g
    201  1.324.2.3       tls .if ${LIBISPRIVATE} == "yes"
    202  1.324.2.3       tls CFLAGS+=	-g
    203  1.324.2.3       tls .endif
    204  1.324.2.3       tls .endif
    205  1.324.2.3       tls 
    206      1.123  jonathan # Platform-independent linker flags for ELF shared libraries
    207      1.182       mrg SHLIB_SOVERSION=	${SHLIB_MAJOR}
    208  1.324.2.2       tls SHLIB_SHFLAGS=		-Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION}
    209      1.272  christos SHLIB_SHFLAGS+=		-Wl,--warn-shared-textrel
    210      1.322  christos SHLIB_LDSTARTFILE?=	${_GCC_CRTI} ${_GCC_CRTBEGINS}
    211      1.322  christos SHLIB_LDENDFILE?=	${_GCC_CRTENDS} ${_GCC_CRTN}
    212       1.86  jonathan 
    213       1.82     mikel CFLAGS+=	${COPTS}
    214      1.267       mrg OBJCFLAGS+=	${OBJCOPTS}
    215      1.257    simonb AFLAGS+=	${COPTS}
    216      1.179  dmcmahil FFLAGS+=	${FOPTS}
    217        1.1       cgd 
    218      1.305    darran .if defined(CTFCONVERT)
    219      1.305    darran .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
    220      1.305    darran CTFFLAGS+=	-g
    221      1.305    darran .endif
    222      1.305    darran .endif
    223      1.305    darran 
    224  1.324.2.3       tls LIBSTRIPAOBJS=	yes
    225  1.324.2.3       tls .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    226  1.324.2.3       tls LIBSTRIPCOBJS=	yes
    227  1.324.2.3       tls .endif
    228  1.324.2.3       tls .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    229  1.324.2.3       tls LIBSTRIPOBJCOBJS=	yes
    230  1.324.2.3       tls .endif
    231  1.324.2.3       tls .if !defined(FFLAGS) || empty(FFLAGS:M*-g*)
    232  1.324.2.3       tls LIBSTRIPFOBJS=	yes
    233  1.324.2.3       tls .endif
    234  1.324.2.3       tls .if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*) 
    235  1.324.2.3       tls LIBSTRIPSHLIBOBJS=	yes
    236  1.324.2.3       tls .endif
    237  1.324.2.3       tls 
    238        1.1       cgd .c.o:
    239      1.238     lukem 	${_MKTARGET_COMPILE}
    240      1.263       dsl 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    241      1.305    darran .if defined(CTFCONVERT)
    242      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    243      1.305    darran .endif
    244  1.324.2.3       tls .if defined(LIBSTRIPCOBJS)
    245      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    246      1.153  christos .endif
    247        1.1       cgd 
    248        1.1       cgd .c.po:
    249      1.238     lukem 	${_MKTARGET_COMPILE}
    250      1.263       dsl 	${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
    251      1.305    darran .if defined(CTFCONVERT)
    252      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    253      1.305    darran .endif
    254  1.324.2.3       tls .if defined(LIBSTRIPCOBJS)
    255      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    256      1.153  christos .endif
    257       1.17   mycroft 
    258      1.266  christos .c.go:
    259      1.266  christos 	${_MKTARGET_COMPILE}
    260      1.266  christos 	${COMPILE.c} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
    261      1.266  christos 
    262      1.304     njoly .c.pico:
    263      1.238     lukem 	${_MKTARGET_COMPILE}
    264      1.263       dsl 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
    265  1.324.2.3       tls .if defined(LIBSTRIPSHLIBOBJS)
    266      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    267      1.153  christos .endif
    268       1.27        pk 
    269      1.223     lukem .cc.o .cpp.o .cxx.o .C.o:
    270      1.238     lukem 	${_MKTARGET_COMPILE}
    271      1.263       dsl 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    272  1.324.2.3       tls .if defined(LIBSTRIPCOBJS)
    273      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    274      1.153  christos .endif
    275       1.17   mycroft 
    276      1.266  christos .cc.po .cpp.po .cxx.po .C.po:
    277      1.238     lukem 	${_MKTARGET_COMPILE}
    278      1.263       dsl 	${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
    279  1.324.2.3       tls .if defined(LIBSTRIPCOBJS)
    280      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    281      1.153  christos .endif
    282       1.28       cgd 
    283      1.266  christos .cc.go .cpp.go .cxx.go .C.go:
    284      1.266  christos 	${_MKTARGET_COMPILE}
    285      1.266  christos 	${COMPILE.cc} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -g ${.IMPSRC} -o ${.TARGET}
    286      1.266  christos 
    287      1.304     njoly .cc.pico .cpp.pico .cxx.pico .C.pico:
    288      1.238     lukem 	${_MKTARGET_COMPILE}
    289      1.263       dsl 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
    290  1.324.2.3       tls .if defined(LIBSTRIPSHLIBOBJS)
    291      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    292      1.153  christos .endif
    293      1.118     lukem 
    294      1.179  dmcmahil .f.o:
    295      1.238     lukem 	${_MKTARGET_COMPILE}
    296      1.263       dsl 	${COMPILE.f} ${.IMPSRC} -o ${.TARGET}
    297      1.305    darran .if defined(CTFCONVERT)
    298      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    299      1.305    darran .endif
    300  1.324.2.3       tls .if defined(LIBSTRIPFOBJS)
    301      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    302      1.179  dmcmahil .endif
    303      1.179  dmcmahil 
    304      1.179  dmcmahil .f.po:
    305      1.238     lukem 	${_MKTARGET_COMPILE}
    306      1.263       dsl 	${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
    307      1.305    darran .if defined(CTFCONVERT)
    308      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    309      1.305    darran .endif
    310  1.324.2.3       tls .if defined(LIBSTRIPFOBJS)
    311      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    312      1.179  dmcmahil .endif
    313      1.179  dmcmahil 
    314      1.266  christos .f.go:
    315      1.266  christos 	${_MKTARGET_COMPILE}
    316      1.266  christos 	${COMPILE.f} ${DEBUGFLAGS} -g ${.IMPSRC} -o ${.TARGET}
    317      1.266  christos 
    318      1.304     njoly .f.pico:
    319      1.238     lukem 	${_MKTARGET_COMPILE}
    320      1.263       dsl 	${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    321  1.324.2.3       tls .if defined(LIBSTRIPFOBJS)
    322      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    323      1.179  dmcmahil .endif
    324      1.179  dmcmahil 
    325      1.179  dmcmahil .f.ln:
    326      1.238     lukem 	${_MKTARGET_COMPILE}
    327      1.217       wiz 	@echo Skipping lint for Fortran libraries.
    328      1.179  dmcmahil 
    329      1.118     lukem .m.o:
    330      1.238     lukem 	${_MKTARGET_COMPILE}
    331      1.267       mrg 	${COMPILE.m} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    332      1.305    darran .if defined(CTFCONVERT)
    333      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    334      1.305    darran .endif
    335  1.324.2.3       tls .if defined(LIBSTRIPOBJCOBJS)
    336      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    337      1.153  christos .endif
    338      1.118     lukem 
    339      1.118     lukem .m.po:
    340      1.238     lukem 	${_MKTARGET_COMPILE}
    341      1.267       mrg 	${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.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.324.2.3       tls .if defined(LIBSTRIPOBJCOBJS)
    346      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    347      1.153  christos .endif
    348      1.118     lukem 
    349      1.266  christos .m.go:
    350      1.266  christos 	${_MKTARGET_COMPILE}
    351      1.267       mrg 	${COMPILE.m} ${DEBUGFLAGS} -g ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    352  1.324.2.3       tls .if defined(LIBSTRIPOBJCOBJS)
    353      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    354      1.266  christos .endif
    355      1.266  christos 
    356      1.304     njoly .m.pico:
    357      1.238     lukem 	${_MKTARGET_COMPILE}
    358      1.267       mrg 	${COMPILE.m} ${CSHLIBFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    359  1.324.2.3       tls .if defined(LIBSTRIPOBJCOBJS)
    360      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    361      1.153  christos .endif
    362        1.1       cgd 
    363      1.251     lukem .s.o:
    364      1.238     lukem 	${_MKTARGET_COMPILE}
    365      1.263       dsl 	${COMPILE.s} ${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.324.2.3       tls .if defined(LIBSTRIPAOBJS)
    370      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    371  1.324.2.3       tls .endif
    372        1.1       cgd 
    373      1.251     lukem .S.o:
    374      1.251     lukem 	${_MKTARGET_COMPILE}
    375      1.263       dsl 	${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    376      1.305    darran .if defined(CTFCONVERT)
    377      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    378      1.305    darran .endif
    379  1.324.2.3       tls .if defined(LIBSTRIPAOBJS)
    380      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    381  1.324.2.3       tls .endif
    382      1.251     lukem 
    383      1.251     lukem .s.po:
    384      1.251     lukem 	${_MKTARGET_COMPILE}
    385      1.263       dsl 	${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    386      1.305    darran .if defined(CTFCONVERT)
    387      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    388      1.305    darran .endif
    389  1.324.2.3       tls .if defined(LIBSTRIPAOBJS)
    390      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    391  1.324.2.3       tls .endif
    392      1.251     lukem 
    393      1.251     lukem .S.po:
    394      1.238     lukem 	${_MKTARGET_COMPILE}
    395      1.263       dsl 	${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    396      1.305    darran .if defined(CTFCONVERT)
    397      1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    398      1.305    darran .endif
    399  1.324.2.3       tls .if defined(LIBSTRIPAOBJS)
    400      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    401  1.324.2.3       tls .endif
    402        1.1       cgd 
    403      1.266  christos .s.go:
    404      1.266  christos 	${_MKTARGET_COMPILE}
    405      1.266  christos 	${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    406      1.266  christos 
    407      1.266  christos .S.go:
    408      1.266  christos 	${_MKTARGET_COMPILE}
    409      1.266  christos 	${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    410      1.266  christos 
    411      1.304     njoly .s.pico:
    412      1.251     lukem 	${_MKTARGET_COMPILE}
    413      1.263       dsl 	${COMPILE.s} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    414  1.324.2.3       tls .if defined(LIBSTRIPAOBJS)
    415      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    416  1.324.2.3       tls .endif
    417      1.251     lukem 
    418      1.304     njoly .S.pico:
    419      1.238     lukem 	${_MKTARGET_COMPILE}
    420      1.263       dsl 	${COMPILE.S} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    421  1.324.2.3       tls .if defined(LIBSTRIPAOBJS)
    422      1.320  christos 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
    423  1.324.2.3       tls .endif
    424       1.27        pk 
    425  1.324.2.2       tls # Declare a few variables to make our life easier later.
    426  1.324.2.2       tls _LIB:=${_LIB_PREFIX}${LIB}
    427  1.324.2.2       tls _LIB.a:=${_LIB}.a
    428  1.324.2.2       tls _LIB_p.a:=${_LIB}_p.a
    429  1.324.2.2       tls _LIB_g.a:=${_LIB}_g.a
    430  1.324.2.2       tls _LIB_pic.a:=${_LIB}_pic.a
    431  1.324.2.2       tls _LIB.ln:=llib-l${LIB}.ln
    432  1.324.2.2       tls 
    433  1.324.2.2       tls .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    434  1.324.2.2       tls _LIB.so:=${_LIB}.so
    435  1.324.2.2       tls _LIB.so.major:=${_LIB}.so.${SHLIB_MAJOR}
    436  1.324.2.2       tls _LIB.so.full:=${_LIB}.so.${SHLIB_FULLVERSION}
    437  1.324.2.2       tls .if ${MKDEBUG} != "no"
    438  1.324.2.2       tls _LIB.so.debug:=${_LIB.so.full}.debug
    439  1.324.2.2       tls .endif
    440  1.324.2.2       tls .endif
    441  1.324.2.2       tls 
    442  1.324.2.2       tls _DEST.LIB:=${DESTDIR}${LIBDIR}
    443  1.324.2.2       tls _DEST.OBJ:=${DESTDIR}${_LIBSODIR}
    444  1.324.2.2       tls _DEST.LINT:=${DESTDIR}${LINTLIBDIR}
    445  1.324.2.2       tls _DEST.DEBUG:=${DESTDIR}${DEBUGDIR}${LIBDIR}
    446  1.324.2.3       tls _DEST.ODEBUG:=${DESTDIR}${DEBUGDIR}${_LIBSODIR}
    447  1.324.2.2       tls 
    448      1.252     lukem .if defined(LIB)							# {
    449      1.234     lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    450      1.234     lukem 	|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
    451  1.324.2.2       tls _LIBS=${_LIB.a}
    452      1.130        tv .else
    453      1.130        tv _LIBS=
    454      1.130        tv .endif
    455       1.58       cgd 
    456      1.321      matt .if ${LIBISPRIVATE} != "no" \
    457      1.321      matt    && (defined(USE_COMBINE) && ${USE_COMBINE} == "yes" \
    458      1.321      matt    && !defined(NOCOMBINE))						# {
    459      1.321      matt .for f in ${SRCS:N*.h:N*.sh:C/\.[yl]$/.c/g}
    460      1.321      matt COMBINEFLAGS.${LIB}.$f := ${CPPFLAGS.$f:D1} ${CPUFLAGS.$f:D2} ${COPTS.$f:D3} ${OBJCOPTS.$f:D4} ${CXXFLAGS.$f:D5}
    461      1.321      matt .if empty(COMBINEFLAGS.${LIB}.${f}) && !defined(NOCOMBINE.$f)
    462      1.321      matt COMBINESRCS+=	${f}
    463      1.321      matt NODPSRCS+=	${f}
    464      1.321      matt .else
    465      1.321      matt OBJS+=  	${f:R:S/$/.o/}
    466      1.321      matt .endif
    467      1.321      matt .endfor
    468      1.321      matt 
    469      1.321      matt .if !empty(COMBINESRCS)
    470  1.324.2.2       tls OBJS+=		${_LIB}_combine.o
    471  1.324.2.2       tls ${_LIB}_combine.o: ${COMBINESRCS}
    472      1.321      matt 	${_MKTARGET_COMPILE}
    473      1.321      matt 	${COMPILE.c} -MD --combine ${.ALLSRC} -o ${.TARGET}
    474  1.324.2.3       tls .if defined(LIBSTRIPOBJS)
    475      1.321      matt 	${OBJCOPY} -x ${.TARGET}
    476      1.321      matt .endif
    477      1.321      matt 
    478  1.324.2.2       tls CLEANFILES+=	${_LIB}_combine.d
    479      1.321      matt 
    480  1.324.2.2       tls .if exists("${_LIB}_combine.d")
    481  1.324.2.2       tls .include "${_LIB}_combine.d"
    482      1.321      matt .endif
    483      1.321      matt .endif   # empty(XSRCS.${LIB})
    484      1.321      matt .else							# } {
    485      1.167      matt OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
    486      1.321      matt .endif							# }
    487      1.158  christos 
    488      1.255   thorpej STOBJS+=${OBJS}
    489      1.255   thorpej 
    490      1.280     lukem LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
    491      1.280     lukem 
    492      1.281     lukem .if ${LIBISPRIVATE} != "no"
    493      1.252     lukem # No installation is required
    494      1.252     lukem libinstall::
    495      1.306     lukem .endif
    496      1.252     lukem 
    497      1.268     lukem .if ${MKDEBUGLIB} != "no"
    498  1.324.2.2       tls _LIBS+=${_LIB_g.a}
    499      1.266  christos GOBJS+=${OBJS:.o=.go}
    500      1.266  christos DEBUGFLAGS?=-DDEBUG
    501      1.266  christos .endif
    502      1.266  christos 
    503      1.149     lukem .if ${MKPROFILE} != "no"
    504  1.324.2.2       tls _LIBS+=${_LIB_p.a}
    505      1.167      matt POBJS+=${OBJS:.o=.po}
    506      1.262  christos PROFFLAGS?=-DGPROF -DPROF
    507        1.1       cgd .endif
    508        1.1       cgd 
    509      1.252     lukem .if ${MKPIC} != "no"							# {
    510      1.160    simonb .if ${MKPICLIB} == "no"
    511      1.205      yamt .if ${MKSHLIBOBJS} != "no"
    512      1.205      yamt # make _pic.a, which isn't really pic,
    513      1.205      yamt # since it's needed for making shared lib.
    514      1.205      yamt # but don't install it.
    515  1.324.2.2       tls SOLIB=${_LIB_pic.a}
    516      1.304     njoly SOBJS+=${OBJS:.o=.pico}
    517      1.205      yamt .else
    518  1.324.2.2       tls SOLIB=${_LIB.a}
    519      1.205      yamt .endif
    520      1.160    simonb .else
    521  1.324.2.2       tls SOLIB=${_LIB_pic.a}
    522      1.160    simonb _LIBS+=${SOLIB}
    523      1.304     njoly SOBJS+=${OBJS:.o=.pico}
    524      1.160    simonb .endif
    525      1.171  christos .if defined(SHLIB_FULLVERSION)
    526  1.324.2.2       tls _LIBS+=${_LIB.so.full}
    527       1.27        pk .endif
    528      1.252     lukem .endif									# }
    529       1.27        pk 
    530      1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    531  1.324.2.2       tls _LIBS+=${_LIB.ln}
    532      1.215  christos .endif
    533       1.27        pk 
    534      1.234     lukem ALLOBJS=
    535      1.234     lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    536      1.234     lukem 	|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
    537      1.255   thorpej ALLOBJS+=${STOBJS}
    538      1.179  dmcmahil .endif
    539      1.234     lukem ALLOBJS+=${POBJS} ${SOBJS}
    540      1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    541      1.179  dmcmahil ALLOBJS+=${LOBJS}
    542      1.216  christos .endif
    543      1.252     lukem .else	# !defined(LIB)							# } {
    544      1.216  christos LOBJS=
    545      1.216  christos SOBJS=
    546      1.252     lukem .endif	# !defined(LIB)							# }
    547      1.186        tv 
    548      1.254     lukem _YLSRCS=	${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
    549      1.253  christos 
    550      1.253  christos .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
    551      1.158  christos 
    552  1.324.2.2       tls realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.so.debug}
    553        1.1       cgd 
    554      1.296     perry MKARZERO?=no
    555      1.296     perry 
    556      1.296     perry .if ${MKARZERO} == "yes"
    557      1.296     perry _ARFL=crsD
    558      1.297     perry _ARRANFL=sD
    559      1.296     perry _INSTRANLIB=
    560      1.296     perry .else
    561      1.296     perry _ARFL=crs
    562      1.297     perry _ARRANFL=s
    563      1.296     perry _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
    564      1.296     perry .endif
    565      1.296     perry 
    566      1.293     pooka # If you change this, please consider reflecting the change in
    567      1.293     pooka # the override in sys/rump/Makefile.rump.
    568      1.243       rtr .if !target(__archivebuild)
    569       1.90  christos __archivebuild: .USE
    570      1.238     lukem 	${_MKTARGET_BUILD}
    571      1.236     lukem 	rm -f ${.TARGET}
    572      1.296     perry 	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
    573      1.243       rtr .endif
    574       1.89  christos 
    575      1.243       rtr .if !target(__archiveinstall)
    576       1.89  christos __archiveinstall: .USE
    577      1.238     lukem 	${_MKTARGET_INSTALL}
    578      1.198     lukem 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    579      1.296     perry 	    ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
    580      1.243       rtr .endif
    581       1.89  christos 
    582      1.197   mycroft __archivesymlinkpic: .USE
    583      1.238     lukem 	${_MKTARGET_INSTALL}
    584      1.264     jwise 	${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
    585      1.197   mycroft 
    586      1.253  christos DPSRCS+=	${_YLSRCS}
    587      1.253  christos CLEANFILES+=	${_YLSRCS}
    588      1.230     lukem 
    589      1.266  christos ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
    590      1.103   mycroft 
    591  1.324.2.2       tls ${_LIB.a}:: ${STOBJS} __archivebuild
    592        1.1       cgd 
    593  1.324.2.2       tls ${_LIB_p.a}:: ${POBJS} __archivebuild
    594        1.1       cgd 
    595  1.324.2.2       tls ${_LIB_pic.a}:: ${SOBJS} __archivebuild
    596       1.27        pk 
    597  1.324.2.2       tls ${_LIB_g.a}:: ${GOBJS} __archivebuild
    598      1.266  christos 
    599      1.235     lukem 
    600      1.235     lukem _LIBLDOPTS=
    601      1.235     lukem .if ${SHLIBDIR} != "/usr/lib"
    602      1.324     joerg _LIBLDOPTS+=	-Wl,-rpath,${SHLIBDIR} \
    603      1.324     joerg 		-L=${SHLIBDIR}
    604      1.324     joerg .elif ${SHLIBINSTALLDIR} != "/usr/lib"
    605      1.324     joerg _LIBLDOPTS+=	-Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
    606      1.324     joerg 		-L=${SHLIBINSTALLDIR}
    607      1.235     lukem .endif
    608      1.235     lukem 
    609      1.277  christos # gcc -shared now adds -lc automatically. For libraries other than libc and
    610      1.277  christos # libgcc* we add as a dependency the installed shared libc. For libc and
    611      1.277  christos # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
    612      1.277  christos # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
    613      1.277  christos # to add standard libraries, not the linker.
    614      1.276  christos .if !defined(LIB)
    615      1.312      matt .if !empty(LIBC_SO)
    616      1.274  christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
    617      1.312      matt .endif
    618      1.276  christos .else
    619      1.278    simonb .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
    620      1.312      matt .if !empty(LIBC_SO)
    621      1.276  christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
    622      1.312      matt .endif
    623      1.277  christos .else
    624      1.278    simonb LDLIBC ?= -nodefaultlibs
    625      1.278    simonb .if ${LIB} == "c"
    626      1.318       mrg LDADD+= -lgcc
    627      1.278    simonb .endif
    628      1.276  christos .endif
    629      1.274  christos .endif
    630      1.274  christos 
    631      1.291       mrg .if ${LIBISCXX} != "no"
    632      1.291       mrg LIBCC:=	${CXX}
    633      1.291       mrg .else
    634      1.291       mrg LIBCC:=	${CC}
    635      1.291       mrg .endif
    636      1.291       mrg 
    637  1.324.2.2       tls _LDADD.${_LIB}=	${LDADD} ${LDADD.${_LIB}}
    638  1.324.2.2       tls _LDFLAGS.${_LIB}=	${LDFLAGS} ${LDFLAGS.${_LIB}}
    639      1.300  uebayasi 
    640  1.324.2.2       tls ${_LIB.so.full}: ${SOLIB} ${DPADD} ${DPLIBC} \
    641       1.88       cgd     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
    642      1.238     lukem 	${_MKTARGET_BUILD}
    643  1.324.2.2       tls 	rm -f ${.TARGET}
    644  1.324.2.2       tls 	${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} \
    645  1.324.2.2       tls 	    ${_LDFLAGS.${_LIB}} -o ${.TARGET} ${_LIBLDOPTS} \
    646  1.324.2.2       tls 	    -Wl,--whole-archive ${SOLIB} \
    647  1.324.2.2       tls 	    -Wl,--no-whole-archive ${_LDADD.${_LIB}}
    648      1.196     lukem #  We don't use INSTALL_SYMLINK here because this is just
    649      1.196     lukem #  happening inside the build directory/objdir. XXX Why does
    650      1.196     lukem #  this spend so much effort on libraries that aren't live??? XXX
    651      1.284     lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    652      1.284     lukem     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    653  1.324.2.2       tls 	${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so.major}.tmp
    654  1.324.2.2       tls 	mv -f ${_LIB.so.major}.tmp ${_LIB.so.major}
    655      1.283     lukem .endif
    656  1.324.2.2       tls 	${HOST_LN} -sf ${_LIB.so.full} ${_LIB.so}.tmp
    657  1.324.2.2       tls 	mv -f ${_LIB.so}.tmp ${_LIB.so}
    658      1.286     joerg .if ${MKSTRIPIDENT} != "no"
    659      1.286     joerg 	${OBJCOPY} -R .ident ${.TARGET}
    660      1.286     joerg .endif
    661       1.35        pk 
    662  1.324.2.2       tls .if defined(_LIB.so.debug)
    663  1.324.2.2       tls ${_LIB.so.debug}: ${_LIB.so.full}
    664      1.307     lukem 	${_MKTARGET_CREATE}
    665  1.324.2.2       tls 	(  ${OBJCOPY} --only-keep-debug ${_LIB.so.full} ${_LIB.so.debug} \
    666      1.309     lukem 	&& ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
    667  1.324.2.2       tls 		--add-gnu-debuglink=${_LIB.so.debug} ${_LIB.so.full} \
    668  1.324.2.2       tls 	) || (rm -f ${.TARGET}; false)
    669      1.307     lukem .endif
    670      1.307     lukem 
    671      1.252     lukem .if !empty(LOBJS)							# {
    672      1.103   mycroft LLIBS?=		-lc
    673  1.324.2.2       tls ${_LIB.ln}: ${LOBJS}
    674      1.238     lukem 	${_MKTARGET_COMPILE}
    675  1.324.2.2       tls 	rm -f ${.TARGET}
    676      1.206   thorpej .if defined(DESTDIR)
    677      1.228     lukem 	${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
    678      1.206   thorpej .else
    679      1.228     lukem 	${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
    680      1.206   thorpej .endif
    681      1.252     lukem .endif									# }
    682        1.1       cgd 
    683      1.280     lukem lint: ${LOBJS}
    684      1.280     lukem .if defined(LOBJS) && !empty(LOBJS)
    685      1.280     lukem 	${LINT} ${LINTFLAGS} ${LOBJS}
    686      1.280     lukem .endif
    687      1.280     lukem 
    688  1.324.2.2       tls 
    689      1.317       apb # If the number of entries in CLEANFILES is too large, then the
    690      1.317       apb # commands in bsd.clean.mk encounter errors like "exec(/bin/sh)
    691      1.317       apb # failed (Argument list too long)".  Avoid that by splitting the
    692      1.317       apb # files to clean into several lists using different variable names.
    693      1.317       apb # __cleanuse is an internal target in bsd.clean.mk; the way we
    694      1.317       apb # use it here mimics the way it's used by the clean target in
    695      1.317       apb # bsd.clean.mk.
    696      1.317       apb #
    697      1.317       apb clean: libclean1 libclean2 libclean3 libclean4 libclean5
    698      1.317       apb libclean1: .PHONY .MADE __cleanuse LIBCLEANFILES1
    699      1.317       apb libclean2: .PHONY .MADE __cleanuse LIBCLEANFILES2
    700      1.317       apb libclean3: .PHONY .MADE __cleanuse LIBCLEANFILES3
    701      1.317       apb libclean4: .PHONY .MADE __cleanuse LIBCLEANFILES4
    702      1.317       apb libclean5: .PHONY .MADE __cleanuse LIBCLEANFILES5
    703      1.316       apb CLEANFILES+= a.out [Ee]rrs mklog core *.core
    704  1.324.2.2       tls LIBCLEANFILES1+= ${_LIB.a}   ${STOBJS} ${STOBJS:=.tmp}
    705  1.324.2.2       tls LIBCLEANFILES2+= ${_LIB_p.a} ${POBJS}  ${POBJS:=.tmp}
    706  1.324.2.2       tls LIBCLEANFILES3+= ${_LIB_g.a} ${GOBJS}  ${GOBJS:=.tmp}
    707  1.324.2.2       tls LIBCLEANFILES4+= ${_LIB_pic.a}
    708  1.324.2.2       tls .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    709  1.324.2.2       tls LIBCLEANFILES4+= ${_LIB.so}.* ${_LIB.so} ${_LIB.so.debug}
    710  1.324.2.2       tls .endif
    711      1.317       apb LIBCLEANFILES4+= ${SOBJS} ${SOBJS:=.tmp}
    712  1.324.2.2       tls LIBCLEANFILES5+= ${_LIB.ln} ${LOBJS}
    713      1.252     lukem 
    714      1.252     lukem .if !target(libinstall)							# {
    715      1.148     lukem # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
    716      1.139        tv libinstall::
    717      1.139        tv 
    718      1.234     lukem .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
    719  1.324.2.2       tls libinstall:: ${_DEST.LIB}/${_LIB.a}
    720  1.324.2.2       tls .PRECIOUS: ${_DEST.LIB}/${_LIB.a}
    721      1.197   mycroft 
    722      1.269       dbj .if ${MKUPDATE} == "no"
    723  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
    724  1.324.2.2       tls ${_DEST.LIB}/${_LIB.a}! .MADE
    725       1.89  christos .endif
    726  1.324.2.2       tls ${_DEST.LIB}/${_LIB.a}! ${_LIB.a} __archiveinstall
    727      1.197   mycroft .else
    728  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB.a})
    729  1.324.2.2       tls ${_DEST.LIB}/${_LIB.a}: .MADE
    730       1.89  christos .endif
    731  1.324.2.2       tls ${_DEST.LIB}/${_LIB.a}: ${_LIB.a} __archiveinstall
    732      1.130        tv .endif
    733      1.197   mycroft .endif
    734       1.89  christos 
    735      1.149     lukem .if ${MKPROFILE} != "no"
    736  1.324.2.2       tls libinstall:: ${_DEST.LIB}/${_LIB_p.a}
    737  1.324.2.2       tls .PRECIOUS: ${_DEST.LIB}/${_LIB_p.a}
    738      1.197   mycroft 
    739      1.269       dbj .if ${MKUPDATE} == "no"
    740  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
    741  1.324.2.2       tls ${_DEST.LIB}/${_LIB_p.a}! .MADE
    742       1.32        pk .endif
    743  1.324.2.2       tls ${_DEST.LIB}/${_LIB_p.a}! ${_LIB_p.a} __archiveinstall
    744      1.197   mycroft .else
    745  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB_p.a})
    746  1.324.2.2       tls ${_DEST.LIB}/${_LIB_p.a}: .MADE
    747       1.89  christos .endif
    748  1.324.2.2       tls ${_DEST.LIB}/${_LIB_p.a}: ${_LIB_p.a} __archiveinstall
    749       1.89  christos .endif
    750      1.197   mycroft .endif
    751       1.89  christos 
    752      1.268     lukem .if ${MKDEBUGLIB} != "no"
    753  1.324.2.2       tls libinstall:: ${_DEST.LIB}/${_LIB_g.a}
    754  1.324.2.2       tls .PRECIOUS: ${_DEST.LIB}/${_LIB_g.a}
    755      1.266  christos 
    756      1.269       dbj .if ${MKUPDATE} == "no"
    757  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB_g.a})
    758  1.324.2.2       tls ${_DEST.LIB}/${_LIB_g.a}! .MADE
    759      1.266  christos .endif
    760  1.324.2.2       tls ${_DEST.LIB}/${_LIB_g.a}! ${_LIB_g.a} __archiveinstall
    761      1.266  christos .else
    762  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${LIB_g.a})
    763  1.324.2.2       tls ${_DEST.LIB}/${_LIB_g.a}: .MADE
    764      1.266  christos .endif
    765  1.324.2.2       tls ${_DEST.LIB}/${_LIB_g.a}: ${_LIB_g.a} __archiveinstall
    766      1.266  christos .endif
    767      1.266  christos .endif
    768      1.266  christos 
    769      1.149     lukem .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
    770  1.324.2.2       tls libinstall:: ${_DEST.LIB}/${_LIB_pic.a}
    771  1.324.2.2       tls .PRECIOUS: ${_DEST.LIB}/${_LIB_pic.a}
    772      1.197   mycroft 
    773      1.269       dbj .if ${MKUPDATE} == "no"
    774  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
    775  1.324.2.2       tls ${_DEST.LIB}/${_LIB_pic.a}! .MADE
    776       1.89  christos .endif
    777      1.197   mycroft .if ${MKPICLIB} == "no"
    778  1.324.2.2       tls ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB.a} __archivesymlinkpic
    779      1.197   mycroft .else
    780  1.324.2.2       tls ${_DEST.LIB}/${_LIB_pic.a}! ${_LIB_pic.a} __archiveinstall
    781      1.197   mycroft .endif
    782      1.197   mycroft .else
    783  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB_pic.a})
    784  1.324.2.2       tls ${_DEST.LIB}/${_LIB_pic.a}: .MADE
    785       1.33        pk .endif
    786      1.160    simonb .if ${MKPICLIB} == "no"
    787  1.324.2.2       tls ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB.a} __archivesymlinkpic
    788      1.160    simonb .else
    789  1.324.2.2       tls ${_DEST.LIB}/${_LIB_pic.a}: ${_LIB_pic.a} __archiveinstall
    790      1.160    simonb .endif
    791       1.89  christos .endif
    792      1.197   mycroft .endif
    793       1.89  christos 
    794      1.171  christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    795      1.282     lukem 
    796  1.324.2.2       tls libinstall:: ${_DEST.OBJ}/${_LIB.so.full}
    797  1.324.2.2       tls .PRECIOUS: ${_DEST.OBJ}/${_LIB.so.full}
    798      1.197   mycroft 
    799      1.269       dbj .if ${MKUPDATE} == "no"
    800  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
    801  1.324.2.2       tls ${_DEST.OBJ}/${_LIB.so.full}! .MADE
    802       1.89  christos .endif
    803  1.324.2.2       tls ${_DEST.OBJ}/${_LIB.so.full}! ${_LIB.so.full}
    804      1.197   mycroft .else
    805  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB.so.full})
    806  1.324.2.2       tls ${_DEST.OBJ}/${_LIB.so.full}: .MADE
    807       1.89  christos .endif
    808  1.324.2.2       tls ${_DEST.OBJ}/${_LIB.so.full}: ${_LIB.so.full}
    809      1.197   mycroft .endif
    810      1.238     lukem 	${_MKTARGET_INSTALL}
    811      1.188        tv 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    812  1.324.2.2       tls 	    ${.ALLSRC} ${.TARGET}
    813      1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    814  1.324.2.2       tls 	${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
    815  1.324.2.2       tls 	    ${_DEST.LIB}/${_LIB.so.full} 
    816      1.195     lukem .endif
    817      1.284     lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    818      1.284     lukem     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    819  1.324.2.2       tls 	${INSTALL_SYMLINK} ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so.major}
    820      1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    821  1.324.2.2       tls 	${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
    822  1.324.2.2       tls 	    ${_DEST.LIB}/${_LIB.so.major}
    823      1.195     lukem .endif
    824      1.284     lukem .endif
    825      1.148     lukem .if ${MKLINKLIB} != "no"
    826  1.324.2.2       tls 	${INSTALL_SYMLINK}  ${_LIB.so.full} ${_DEST.OBJ}/${_LIB.so}
    827      1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    828  1.324.2.2       tls 	${INSTALL_SYMLINK} -l r ${_DEST.OBJ}/${_LIB.so.full} \
    829  1.324.2.2       tls 	    ${_DEST.LIB}/${_LIB.so}
    830      1.195     lukem .endif
    831       1.83       cgd .endif
    832       1.12       cgd .endif
    833       1.89  christos 
    834  1.324.2.2       tls .if defined(_LIB.so.debug)
    835  1.324.2.2       tls libinstall:: ${_DEST.DEBUG}/${_LIB.so.debug}
    836  1.324.2.2       tls .PRECIOUS: ${_DEST.DEBUG}/${_LIB.so.debug}
    837      1.307     lukem 
    838  1.324.2.2       tls ${_DEST.DEBUG}/${_LIB.so.debug}: ${_LIB.so.debug}
    839      1.307     lukem 	${_MKTARGET_INSTALL}
    840      1.307     lukem 	${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
    841  1.324.2.2       tls 	    ${.ALLSRC} ${.TARGET}
    842  1.324.2.3       tls .if ${_LIBSODIR} != ${LIBDIR}
    843  1.324.2.3       tls 	${INSTALL_SYMLINK} -l r ${_DEST.DEBUG}/${_LIB.so.debug} \
    844  1.324.2.3       tls 	    ${_DEST.ODEBUG}/${_LIB.so.debug} 
    845  1.324.2.3       tls .endif
    846      1.307     lukem .endif
    847      1.307     lukem 
    848      1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    849  1.324.2.2       tls libinstall:: ${_DEST.LINT}/${_LIB.ln}
    850  1.324.2.2       tls .PRECIOUS: ${_DEST.LINT}/${_LIB.ln}
    851      1.197   mycroft 
    852      1.269       dbj .if ${MKUPDATE} == "no"
    853  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
    854  1.324.2.2       tls ${_DEST.LINT}/${_LIB.ln}! .MADE
    855       1.89  christos .endif
    856  1.324.2.2       tls ${_DEST.LINT}/${_LIB.ln}! ${_LIB.ln}
    857      1.197   mycroft .else
    858  1.324.2.2       tls .if !defined(BUILD) && !make(all) && !make(${_LIB.ln})
    859  1.324.2.2       tls ${_DEST.LINT}/${_LIB.ln}: .MADE
    860       1.89  christos .endif
    861  1.324.2.2       tls ${_DEST.LINT}/${_LIB.ln}: ${_LIB.ln}
    862      1.197   mycroft .endif
    863      1.238     lukem 	${_MKTARGET_INSTALL}
    864      1.188        tv 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    865  1.324.2.2       tls 		${.ALLSRC} ${_DEST.LINT}
    866       1.58       cgd .endif
    867      1.252     lukem .endif	# !target(libinstall)						# }
    868        1.1       cgd 
    869      1.188        tv ##### Pull in related .mk logic
    870      1.298       apb LINKSOWN?= ${LIBOWN}
    871      1.298       apb LINKSGRP?= ${LIBGRP}
    872      1.298       apb LINKSMODE?= ${LIBMODE}
    873        1.1       cgd .include <bsd.man.mk>
    874       1.57       jtc .include <bsd.nls.mk>
    875       1.91  christos .include <bsd.files.mk>
    876       1.89  christos .include <bsd.inc.mk>
    877      1.109       cjs .include <bsd.links.mk>
    878       1.24   mycroft .include <bsd.dep.mk>
    879      1.315     joerg .include <bsd.clang-analyze.mk>
    880      1.316       apb .include <bsd.clean.mk>
    881      1.117   mycroft 
    882      1.188        tv ${TARGETS}:	# ensure existence
    883