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