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