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