Home | History | Annotate | Line # | Download | only in mk
bsd.lib.mk revision 1.313
      1  1.313     joerg #	$NetBSD: bsd.lib.mk,v 1.313 2011/04/10 16:52:36 joerg 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.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.256     lukem LDADD+=		-L${LIBDO.${_lib}} -l${_lib}
     59  1.256     lukem DPADD+=		${LIBDO.${_lib}}/lib${_lib}.so
     60  1.256     lukem .endfor
     61  1.256     lukem .endif									# }
     62  1.256     lukem 
     63  1.188        tv ##### Build and install rules
     64  1.304     njoly MKDEP_SUFFIXES?=	.o .po .pico .go .ln
     65  1.292     pooka 
     66  1.252     lukem .if !defined(SHLIB_MAJOR) && exists(${SHLIB_VERSION_FILE})		# {
     67  1.154    simonb SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
     68  1.154    simonb SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
     69  1.171  christos SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
     70  1.143       erh 
     71  1.295        he DPADD+=	${SHLIB_VERSION_FILE}
     72  1.295        he 
     73  1.143       erh # Check for higher installed library versions.
     74  1.145       erh .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
     75  1.201     lukem 	exists(${NETBSDSRCDIR}/lib/checkver)
     76  1.143       erh checkver:
     77  1.303  christos 	@(cd "${.CURDIR}" && \
     78  1.289       apb 	    HOST_SH=${HOST_SH:Q} AWK=${TOOL_AWK:Q} \
     79  1.239     lukem 	    ${HOST_SH} ${NETBSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
     80  1.195     lukem 		    -d ${DESTDIR}${_LIBSODIR} ${LIB})
     81  1.173  christos .endif
     82  1.252     lukem .endif									# }
     83  1.173  christos 
     84  1.173  christos .if !target(checkver)
     85  1.143       erh checkver:
     86  1.143       erh .endif
     87  1.173  christos 
     88  1.169   thorpej print-shlib-major:
     89  1.185        tv .if defined(SHLIB_MAJOR) && ${MKPIC} != "no"
     90  1.169   thorpej 	@echo ${SHLIB_MAJOR}
     91  1.173  christos .else
     92  1.173  christos 	@false
     93  1.173  christos .endif
     94  1.169   thorpej 
     95  1.169   thorpej print-shlib-minor:
     96  1.185        tv .if defined(SHLIB_MINOR) && ${MKPIC} != "no"
     97  1.169   thorpej 	@echo ${SHLIB_MINOR}
     98  1.173  christos .else
     99  1.173  christos 	@false
    100  1.173  christos .endif
    101  1.171  christos 
    102  1.171  christos print-shlib-teeny:
    103  1.185        tv .if defined(SHLIB_TEENY) && ${MKPIC} != "no"
    104  1.171  christos 	@echo ${SHLIB_TEENY}
    105  1.143       erh .else
    106  1.169   thorpej 	@false
    107  1.173  christos .endif
    108  1.169   thorpej 
    109  1.252     lukem .if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)				# {
    110  1.173  christos .if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
    111  1.173  christos .if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
    112  1.173  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
    113  1.173  christos .else
    114  1.173  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
    115  1.173  christos .endif
    116  1.173  christos .else
    117  1.173  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}
    118  1.173  christos .endif
    119  1.252     lukem .endif									# }
    120    1.1       cgd 
    121  1.101   mycroft # add additional suffixes not exported.
    122  1.101   mycroft # .po is used for profiling object files.
    123  1.304     njoly # .pico is used for PIC object files.
    124  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
    125  1.118     lukem .SUFFIXES: .sh .m4 .m
    126   1.82     mikel 
    127   1.86  jonathan 
    128   1.86  jonathan # Set PICFLAGS to cc flags for producing position-independent code,
    129   1.86  jonathan # if not already set.  Includes -DPIC, if required.
    130   1.86  jonathan 
    131  1.164    simonb # Data-driven table using make variables to control how shared libraries
    132   1.86  jonathan # are built for different platforms and object formats.
    133  1.302       abs # SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
    134  1.302       abs #			numbers of shared library
    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.304     njoly # FPICFLAGS:		flags for ${FC} to compile .[fF] files to .pico 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.304     njoly # CSHLIBFLAGS:		flags for ${CC} to compile .[cC] files to .pico 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.304     njoly # APICFLAGS:		flags for ${AS} to assemble .[sS] to .pico 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.308       mrg .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") 	# } {
    161  1.209   thorpej 
    162  1.222     lukem # If you use -fPIC you need to define BIGPIC to turn on 32-bit
    163  1.202       eeh # relocations in asm code
    164  1.179  dmcmahil FPICFLAGS ?= -fPIC
    165  1.165  dmcmahil CPICFLAGS ?= -fPIC -DPIC
    166  1.202       eeh CPPPICFLAGS?= -DPIC -DBIGPIC
    167  1.150  christos CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    168  1.203       eeh APICFLAGS ?= -KPIC
    169  1.204  fredette 
    170  1.252     lukem .else									# } {
    171   1.86  jonathan 
    172  1.244     skrll # Platform-independent flags for NetBSD shared libraries
    173  1.171  christos SHLIB_SOVERSION=${SHLIB_FULLVERSION}
    174  1.125  jonathan SHLIB_SHFLAGS=
    175  1.179  dmcmahil FPICFLAGS ?= -fPIC
    176  1.165  dmcmahil CPICFLAGS?= -fPIC -DPIC
    177  1.222     lukem CPPPICFLAGS?= -DPIC
    178  1.107  jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    179  1.107  jonathan APICFLAGS?= -k
    180   1.86  jonathan 
    181  1.252     lukem .endif									# }
    182  1.160    simonb 
    183  1.205      yamt .if ${MKPICLIB} != "no"
    184  1.205      yamt CSHLIBFLAGS+= ${CPICFLAGS}
    185  1.205      yamt .endif
    186  1.205      yamt 
    187  1.205      yamt .if defined(CSHLIBFLAGS) && !empty(CSHLIBFLAGS)
    188  1.205      yamt MKSHLIBOBJS= yes
    189  1.205      yamt .else
    190  1.205      yamt MKSHLIBOBJS= no
    191  1.205      yamt .endif
    192  1.205      yamt 
    193  1.123  jonathan # Platform-independent linker flags for ELF shared libraries
    194  1.182       mrg SHLIB_SOVERSION=	${SHLIB_MAJOR}
    195  1.282     lukem SHLIB_SHFLAGS=		-Wl,-soname,${_LIB_PREFIX}${LIB}.so.${SHLIB_SOVERSION}
    196  1.272  christos SHLIB_SHFLAGS+=		-Wl,--warn-shared-textrel
    197  1.301       mrg SHLIB_LDSTARTFILE?=	${_GCC_CRTDIR}/crti.o ${_GCC_CRTBEGINS}
    198  1.301       mrg SHLIB_LDENDFILE?=	${_GCC_CRTENDS} ${_GCC_CRTDIR}/crtn.o
    199   1.86  jonathan 
    200   1.82     mikel CFLAGS+=	${COPTS}
    201  1.267       mrg OBJCFLAGS+=	${OBJCOPTS}
    202  1.257    simonb AFLAGS+=	${COPTS}
    203  1.179  dmcmahil FFLAGS+=	${FOPTS}
    204    1.1       cgd 
    205  1.305    darran .if defined(CTFCONVERT)
    206  1.305    darran .if defined(CFLAGS) && !empty(CFLAGS:M*-g*)
    207  1.305    darran CTFFLAGS+=	-g
    208  1.305    darran .endif
    209  1.305    darran .endif
    210  1.305    darran 
    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.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    218  1.263       dsl 	${OBJCOPY} -x ${.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.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    228  1.263       dsl 	${OBJCOPY} -X ${.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.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    239  1.263       dsl 	${OBJCOPY} -x ${.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.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    246  1.263       dsl 	${OBJCOPY} -x ${.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.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    253  1.263       dsl 	${OBJCOPY} -X ${.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.270    martin .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
    264  1.263       dsl 	${OBJCOPY} -x ${.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.263       dsl .if !defined(FOPTS) || empty(FOPTS:M*-g*)
    274  1.263       dsl 	${OBJCOPY} -x ${.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.263       dsl .if !defined(FOPTS) || empty(FOPTS:M*-g*)
    284  1.263       dsl 	${OBJCOPY} -X ${.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.263       dsl 	${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    294  1.263       dsl .if !defined(FOPTS) || empty(FOPTS:M*-g*)
    295  1.263       dsl 	${OBJCOPY} -x ${.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.263       dsl .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    309  1.263       dsl 	${OBJCOPY} -x ${.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.263       dsl .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    319  1.263       dsl 	${OBJCOPY} -X ${.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.266  christos .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    326  1.266  christos 	${OBJCOPY} -X ${.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.263       dsl .if !defined(OBJCFLAGS) || empty(OBJCFLAGS:M*-g*)
    333  1.263       dsl 	${OBJCOPY} -x ${.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.263       dsl 	${OBJCOPY} -x ${.TARGET}
    343    1.1       cgd 
    344  1.251     lukem .S.o:
    345  1.251     lukem 	${_MKTARGET_COMPILE}
    346  1.263       dsl 	${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    347  1.305    darran .if defined(CTFCONVERT)
    348  1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    349  1.305    darran .endif
    350  1.263       dsl 	${OBJCOPY} -x ${.TARGET}
    351  1.251     lukem 
    352  1.251     lukem .s.po:
    353  1.251     lukem 	${_MKTARGET_COMPILE}
    354  1.263       dsl 	${COMPILE.s} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    355  1.305    darran .if defined(CTFCONVERT)
    356  1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    357  1.305    darran .endif
    358  1.263       dsl 	${OBJCOPY} -X ${.TARGET}
    359  1.251     lukem 
    360  1.251     lukem .S.po:
    361  1.238     lukem 	${_MKTARGET_COMPILE}
    362  1.263       dsl 	${COMPILE.S} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    363  1.305    darran .if defined(CTFCONVERT)
    364  1.305    darran 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
    365  1.305    darran .endif
    366  1.263       dsl 	${OBJCOPY} -X ${.TARGET}
    367    1.1       cgd 
    368  1.266  christos .s.go:
    369  1.266  christos 	${_MKTARGET_COMPILE}
    370  1.266  christos 	${COMPILE.s} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    371  1.266  christos 
    372  1.266  christos .S.go:
    373  1.266  christos 	${_MKTARGET_COMPILE}
    374  1.266  christos 	${COMPILE.S} ${DEBUGFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    375  1.266  christos 
    376  1.304     njoly .s.pico:
    377  1.251     lukem 	${_MKTARGET_COMPILE}
    378  1.263       dsl 	${COMPILE.s} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    379  1.263       dsl 	${OBJCOPY} -x ${.TARGET}
    380  1.251     lukem 
    381  1.304     njoly .S.pico:
    382  1.238     lukem 	${_MKTARGET_COMPILE}
    383  1.263       dsl 	${COMPILE.S} ${CAPICFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
    384  1.263       dsl 	${OBJCOPY} -x ${.TARGET}
    385   1.27        pk 
    386  1.252     lukem .if defined(LIB)							# {
    387  1.234     lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    388  1.234     lukem 	|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
    389  1.130        tv _LIBS=lib${LIB}.a
    390  1.130        tv .else
    391  1.130        tv _LIBS=
    392  1.130        tv .endif
    393   1.58       cgd 
    394  1.167      matt OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
    395  1.158  christos 
    396  1.255   thorpej STOBJS+=${OBJS}
    397  1.255   thorpej 
    398  1.280     lukem LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
    399  1.280     lukem 
    400  1.281     lukem .if ${LIBISPRIVATE} != "no"
    401  1.252     lukem # No installation is required
    402  1.252     lukem libinstall::
    403  1.306     lukem .endif
    404  1.252     lukem 
    405  1.268     lukem .if ${MKDEBUGLIB} != "no"
    406  1.266  christos _LIBS+=lib${LIB}_g.a
    407  1.266  christos GOBJS+=${OBJS:.o=.go}
    408  1.266  christos DEBUGFLAGS?=-DDEBUG
    409  1.266  christos .endif
    410  1.266  christos 
    411  1.149     lukem .if ${MKPROFILE} != "no"
    412  1.130        tv _LIBS+=lib${LIB}_p.a
    413  1.167      matt POBJS+=${OBJS:.o=.po}
    414  1.262  christos PROFFLAGS?=-DGPROF -DPROF
    415    1.1       cgd .endif
    416    1.1       cgd 
    417  1.252     lukem .if ${MKPIC} != "no"							# {
    418  1.160    simonb .if ${MKPICLIB} == "no"
    419  1.205      yamt .if ${MKSHLIBOBJS} != "no"
    420  1.205      yamt # make _pic.a, which isn't really pic,
    421  1.205      yamt # since it's needed for making shared lib.
    422  1.205      yamt # but don't install it.
    423  1.205      yamt SOLIB=lib${LIB}_pic.a
    424  1.304     njoly SOBJS+=${OBJS:.o=.pico}
    425  1.205      yamt .else
    426  1.160    simonb SOLIB=lib${LIB}.a
    427  1.205      yamt .endif
    428  1.160    simonb .else
    429  1.160    simonb SOLIB=lib${LIB}_pic.a
    430  1.160    simonb _LIBS+=${SOLIB}
    431  1.304     njoly SOBJS+=${OBJS:.o=.pico}
    432  1.160    simonb .endif
    433  1.171  christos .if defined(SHLIB_FULLVERSION)
    434  1.307     lukem _LIB.so:=lib${LIB}.so.${SHLIB_FULLVERSION}
    435  1.308       mrg .if ${MKDEBUG} != "no"
    436  1.307     lukem _LIB.debug:=${_LIB.so}.debug
    437  1.307     lukem .endif
    438  1.171  christos _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
    439   1.27        pk .endif
    440  1.252     lukem .endif									# }
    441   1.27        pk 
    442  1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    443   1.58       cgd _LIBS+=llib-l${LIB}.ln
    444  1.215  christos .endif
    445   1.27        pk 
    446  1.234     lukem ALLOBJS=
    447  1.234     lukem .if (${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    448  1.234     lukem 	|| ${MKLINKLIB} != "no") && ${MKSTATICLIB} != "no"
    449  1.255   thorpej ALLOBJS+=${STOBJS}
    450  1.179  dmcmahil .endif
    451  1.234     lukem ALLOBJS+=${POBJS} ${SOBJS}
    452  1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    453  1.179  dmcmahil ALLOBJS+=${LOBJS}
    454  1.216  christos .endif
    455  1.252     lukem .else	# !defined(LIB)							# } {
    456  1.216  christos LOBJS=
    457  1.216  christos SOBJS=
    458  1.252     lukem .endif	# !defined(LIB)							# }
    459  1.186        tv 
    460  1.254     lukem _YLSRCS=	${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
    461  1.253  christos 
    462  1.253  christos .NOPATH: ${ALLOBJS} ${_LIBS} ${_YLSRCS}
    463  1.158  christos 
    464  1.307     lukem realall: ${SRCS} ${ALLOBJS:O} ${_LIBS} ${_LIB.debug}
    465    1.1       cgd 
    466  1.296     perry MKARZERO?=no
    467  1.296     perry 
    468  1.296     perry .if ${MKARZERO} == "yes"
    469  1.296     perry _ARFL=crsD
    470  1.297     perry _ARRANFL=sD
    471  1.296     perry _INSTRANLIB=
    472  1.296     perry .else
    473  1.296     perry _ARFL=crs
    474  1.297     perry _ARRANFL=s
    475  1.296     perry _INSTRANLIB=${empty(PRESERVE):?-a "${RANLIB} -t":}
    476  1.296     perry .endif
    477  1.296     perry 
    478  1.293     pooka # If you change this, please consider reflecting the change in
    479  1.293     pooka # the override in sys/rump/Makefile.rump.
    480  1.243       rtr .if !target(__archivebuild)
    481   1.90  christos __archivebuild: .USE
    482  1.238     lukem 	${_MKTARGET_BUILD}
    483  1.236     lukem 	rm -f ${.TARGET}
    484  1.296     perry 	${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
    485  1.243       rtr .endif
    486   1.89  christos 
    487  1.243       rtr .if !target(__archiveinstall)
    488   1.89  christos __archiveinstall: .USE
    489  1.238     lukem 	${_MKTARGET_INSTALL}
    490  1.198     lukem 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    491  1.296     perry 	    ${_INSTRANLIB} ${.ALLSRC} ${.TARGET}
    492  1.243       rtr .endif
    493   1.89  christos 
    494  1.197   mycroft __archivesymlinkpic: .USE
    495  1.238     lukem 	${_MKTARGET_INSTALL}
    496  1.264     jwise 	${INSTALL_SYMLINK} ${.ALLSRC} ${.TARGET}
    497  1.197   mycroft 
    498  1.253  christos DPSRCS+=	${_YLSRCS}
    499  1.253  christos CLEANFILES+=	${_YLSRCS}
    500  1.230     lukem 
    501  1.266  christos ${STOBJS} ${POBJS} ${GOBJS} ${SOBJS} ${LOBJS}: ${DPSRCS}
    502  1.103   mycroft 
    503  1.255   thorpej lib${LIB}.a:: ${STOBJS} __archivebuild
    504    1.1       cgd 
    505   1.89  christos lib${LIB}_p.a:: ${POBJS} __archivebuild
    506    1.1       cgd 
    507   1.89  christos lib${LIB}_pic.a:: ${SOBJS} __archivebuild
    508   1.27        pk 
    509  1.266  christos lib${LIB}_g.a:: ${GOBJS} __archivebuild
    510  1.266  christos 
    511  1.235     lukem 
    512  1.235     lukem _LIBLDOPTS=
    513  1.235     lukem .if ${SHLIBDIR} != "/usr/lib"
    514  1.313     joerg _LIBLDOPTS+=	-Wl,-rpath-link,=${SHLIBDIR} \
    515  1.313     joerg 		-Wl,-rpath,=${SHLIBDIR} \
    516  1.313     joerg 		-L=${SHLIBDIR}
    517  1.235     lukem .elif ${SHLIBINSTALLDIR} != "/usr/lib"
    518  1.313     joerg _LIBLDOPTS+=	-Wl,-rpath-link,=${SHLIBINSTALLDIR} \
    519  1.313     joerg 		-L=${SHLIBINSTALLDIR}
    520  1.235     lukem .endif
    521  1.235     lukem 
    522  1.277  christos # gcc -shared now adds -lc automatically. For libraries other than libc and
    523  1.277  christos # libgcc* we add as a dependency the installed shared libc. For libc and
    524  1.277  christos # libgcc* we avoid adding libc as a dependency by using -nostdlib. Note that
    525  1.277  christos # -Xl,-nostdlib is not enough because we want to tell the compiler-driver not
    526  1.277  christos # to add standard libraries, not the linker.
    527  1.276  christos .if !defined(LIB)
    528  1.312      matt .if !empty(LIBC_SO)
    529  1.274  christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
    530  1.312      matt .endif
    531  1.276  christos .else
    532  1.278    simonb .if ${LIB} != "c" && ${LIB:Mgcc*} == ""
    533  1.312      matt .if !empty(LIBC_SO)
    534  1.276  christos DPLIBC ?= ${DESTDIR}${LIBC_SO}
    535  1.312      matt .endif
    536  1.277  christos .else
    537  1.278    simonb LDLIBC ?= -nodefaultlibs
    538  1.278    simonb .if ${LIB} == "c"
    539  1.278    simonb LDADD+= -lgcc_pic
    540  1.278    simonb .endif
    541  1.276  christos .endif
    542  1.274  christos .endif
    543  1.274  christos 
    544  1.291       mrg .if ${LIBISCXX} != "no"
    545  1.291       mrg LIBCC:=	${CXX}
    546  1.291       mrg .else
    547  1.291       mrg LIBCC:=	${CC}
    548  1.291       mrg .endif
    549  1.291       mrg 
    550  1.300  uebayasi _LDADD.lib${LIB}=	${LDADD} ${LDADD.lib${LIB}}
    551  1.300  uebayasi _LDFLAGS.lib${LIB}=	${LDFLAGS} ${LDFLAGS.lib${LIB}}
    552  1.300  uebayasi 
    553  1.274  christos lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} ${DPLIBC} \
    554   1.88       cgd     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
    555  1.238     lukem 	${_MKTARGET_BUILD}
    556  1.236     lukem 	rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
    557  1.300  uebayasi 	${LIBCC} ${LDLIBC} -Wl,-x -shared ${SHLIB_SHFLAGS} ${_LDFLAGS.lib${LIB}} \
    558  1.277  christos 	    -o ${.TARGET} ${_LIBLDOPTS} \
    559  1.300  uebayasi 	    -Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${_LDADD.lib${LIB}}
    560  1.196     lukem #  We don't use INSTALL_SYMLINK here because this is just
    561  1.196     lukem #  happening inside the build directory/objdir. XXX Why does
    562  1.196     lukem #  this spend so much effort on libraries that aren't live??? XXX
    563  1.284     lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    564  1.284     lukem     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    565  1.241      matt 	${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
    566  1.177   mycroft 	mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
    567  1.283     lukem .endif
    568  1.241      matt 	${HOST_LN} -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
    569  1.177   mycroft 	mv -f lib${LIB}.so.tmp lib${LIB}.so
    570  1.286     joerg .if ${MKSTRIPIDENT} != "no"
    571  1.286     joerg 	${OBJCOPY} -R .ident ${.TARGET}
    572  1.286     joerg .endif
    573   1.35        pk 
    574  1.307     lukem .if defined(_LIB.debug)
    575  1.307     lukem ${_LIB.debug}: ${_LIB.so}
    576  1.307     lukem 	${_MKTARGET_CREATE}
    577  1.309     lukem 	(  ${OBJCOPY} --only-keep-debug ${_LIB.so} ${_LIB.debug} \
    578  1.309     lukem 	&& ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
    579  1.309     lukem 		--add-gnu-debuglink=${_LIB.debug} ${_LIB.so} \
    580  1.309     lukem 	) || (rm -f ${_LIB.debug}; false)
    581  1.307     lukem .endif
    582  1.307     lukem 
    583  1.252     lukem .if !empty(LOBJS)							# {
    584  1.103   mycroft LLIBS?=		-lc
    585   1.58       cgd llib-l${LIB}.ln: ${LOBJS}
    586  1.238     lukem 	${_MKTARGET_COMPILE}
    587  1.236     lukem 	rm -f llib-l${LIB}.ln
    588  1.206   thorpej .if defined(DESTDIR)
    589  1.228     lukem 	${LINT} -C${LIB} ${.ALLSRC} -L${DESTDIR}/usr/libdata ${LLIBS}
    590  1.206   thorpej .else
    591  1.228     lukem 	${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
    592  1.206   thorpej .endif
    593  1.252     lukem .endif									# }
    594    1.1       cgd 
    595  1.280     lukem lint: ${LOBJS}
    596  1.280     lukem .if defined(LOBJS) && !empty(LOBJS)
    597  1.280     lukem 	${LINT} ${LINTFLAGS} ${LOBJS}
    598  1.280     lukem .endif
    599  1.280     lukem 
    600  1.246     lukem cleanlib: .PHONY
    601   1.48   mycroft 	rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
    602  1.255   thorpej 	rm -f lib${LIB}.a ${STOBJS}
    603   1.59       cgd 	rm -f lib${LIB}_p.a ${POBJS}
    604  1.266  christos 	rm -f lib${LIB}_g.a ${GOBJS}
    605  1.307     lukem 	rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${_LIB.debug} ${SOBJS}
    606  1.266  christos 	rm -f ${STOBJS:=.tmp} ${POBJS:=.tmp} ${SOBJS:=.tmp} ${GOBJS:=.tmp}
    607   1.59       cgd 	rm -f llib-l${LIB}.ln ${LOBJS}
    608    1.1       cgd 
    609  1.252     lukem 
    610  1.252     lukem .if !target(libinstall)							# {
    611  1.148     lukem # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
    612  1.139        tv libinstall::
    613  1.139        tv 
    614  1.234     lukem .if ${MKLINKLIB} != "no" && ${MKSTATICLIB} != "no"
    615   1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    616  1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    617  1.197   mycroft 
    618  1.269       dbj .if ${MKUPDATE} == "no"
    619  1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
    620  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}.a! .MADE
    621   1.89  christos .endif
    622  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}.a! lib${LIB}.a __archiveinstall
    623  1.197   mycroft .else
    624  1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
    625   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
    626   1.89  christos .endif
    627   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
    628  1.130        tv .endif
    629  1.197   mycroft .endif
    630   1.89  christos 
    631  1.149     lukem .if ${MKPROFILE} != "no"
    632   1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    633  1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    634  1.197   mycroft 
    635  1.269       dbj .if ${MKUPDATE} == "no"
    636  1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
    637  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! .MADE
    638   1.32        pk .endif
    639  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_p.a! lib${LIB}_p.a __archiveinstall
    640  1.197   mycroft .else
    641  1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
    642   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
    643   1.89  christos .endif
    644   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
    645   1.89  christos .endif
    646  1.197   mycroft .endif
    647   1.89  christos 
    648  1.268     lukem .if ${MKDEBUGLIB} != "no"
    649  1.266  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
    650  1.266  christos .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_g.a
    651  1.266  christos 
    652  1.269       dbj .if ${MKUPDATE} == "no"
    653  1.266  christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
    654  1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a! .MADE
    655  1.266  christos .endif
    656  1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a! lib${LIB}_g.a __archiveinstall
    657  1.266  christos .else
    658  1.266  christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}_g.a)
    659  1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a: .MADE
    660  1.266  christos .endif
    661  1.266  christos ${DESTDIR}${LIBDIR}/lib${LIB}_g.a: lib${LIB}_g.a __archiveinstall
    662  1.266  christos .endif
    663  1.266  christos .endif
    664  1.266  christos 
    665  1.149     lukem .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
    666  1.168   mycroft libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    667  1.160    simonb .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    668  1.197   mycroft 
    669  1.269       dbj .if ${MKUPDATE} == "no"
    670  1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
    671  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! .MADE
    672   1.89  christos .endif
    673  1.197   mycroft .if ${MKPICLIB} == "no"
    674  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}.a __archivesymlinkpic
    675  1.197   mycroft .else
    676  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a! lib${LIB}_pic.a __archiveinstall
    677  1.197   mycroft .endif
    678  1.197   mycroft .else
    679  1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
    680   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
    681   1.33        pk .endif
    682  1.160    simonb .if ${MKPICLIB} == "no"
    683  1.197   mycroft ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}.a __archivesymlinkpic
    684  1.160    simonb .else
    685   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
    686  1.160    simonb .endif
    687   1.89  christos .endif
    688  1.197   mycroft .endif
    689   1.89  christos 
    690  1.171  christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    691  1.282     lukem _LIB_SO_TGT=		${DESTDIR}${_LIBSODIR}/${_LIB_PREFIX}${LIB}.so
    692  1.282     lukem _LIB_SO_TGTLIBDIR=	   ${DESTDIR}${LIBDIR}/${_LIB_PREFIX}${LIB}.so
    693  1.282     lukem 
    694  1.282     lukem libinstall:: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
    695  1.282     lukem .PRECIOUS: ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}
    696  1.197   mycroft 
    697  1.269       dbj .if ${MKUPDATE} == "no"
    698  1.197   mycroft .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
    699  1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! .MADE
    700   1.89  christos .endif
    701  1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}! lib${LIB}.so.${SHLIB_FULLVERSION}
    702  1.197   mycroft .else
    703  1.171  christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
    704  1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: .MADE
    705   1.89  christos .endif
    706  1.282     lukem ${_LIB_SO_TGT}.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
    707  1.197   mycroft .endif
    708  1.238     lukem 	${_MKTARGET_INSTALL}
    709  1.188        tv 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    710  1.264     jwise 		${.ALLSRC} ${.TARGET}
    711  1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    712  1.282     lukem 	${INSTALL_SYMLINK} -l r \
    713  1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
    714  1.282     lukem 		${_LIB_SO_TGTLIBDIR}.${SHLIB_FULLVERSION}
    715  1.195     lukem .endif
    716  1.284     lukem .if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
    717  1.284     lukem     "${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
    718  1.264     jwise 	${INSTALL_SYMLINK} \
    719  1.284     lukem 		${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
    720  1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_MAJOR}
    721  1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    722  1.282     lukem 	${INSTALL_SYMLINK} -l r \
    723  1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
    724  1.282     lukem 		${_LIB_SO_TGTLIBDIR}.${SHLIB_MAJOR}
    725  1.195     lukem .endif
    726  1.284     lukem .endif
    727  1.148     lukem .if ${MKLINKLIB} != "no"
    728  1.264     jwise 	${INSTALL_SYMLINK} \
    729  1.284     lukem 		${_LIB_PREFIX}${LIB}.so.${SHLIB_FULLVERSION} \
    730  1.282     lukem 		${_LIB_SO_TGT}
    731  1.195     lukem .if ${_LIBSODIR} != ${LIBDIR}
    732  1.282     lukem 	${INSTALL_SYMLINK} -l r \
    733  1.282     lukem 		${_LIB_SO_TGT}.${SHLIB_FULLVERSION} \
    734  1.282     lukem 		${_LIB_SO_TGTLIBDIR}
    735  1.195     lukem .endif
    736   1.83       cgd .endif
    737   1.12       cgd .endif
    738   1.89  christos 
    739  1.307     lukem .if defined(_LIB.debug)
    740  1.307     lukem libinstall:: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
    741  1.307     lukem .PRECIOUS: ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}
    742  1.307     lukem 
    743  1.307     lukem ${DESTDIR}${DEBUGDIR}${LIBDIR}/${_LIB.debug}: ${_LIB.debug}
    744  1.307     lukem 	${_MKTARGET_INSTALL}
    745  1.307     lukem 	${INSTALL_FILE} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
    746  1.307     lukem 		${.ALLSRC} ${.TARGET}
    747  1.307     lukem .endif
    748  1.307     lukem 
    749  1.279     lukem .if ${MKLINT} != "no" && !empty(LOBJS)
    750   1.89  christos libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    751  1.168   mycroft .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    752  1.197   mycroft 
    753  1.269       dbj .if ${MKUPDATE} == "no"
    754  1.197   mycroft .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
    755  1.197   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! .MADE
    756   1.89  christos .endif
    757  1.197   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln! llib-l${LIB}.ln
    758  1.197   mycroft .else
    759  1.157     fredb .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
    760   1.89  christos ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
    761   1.89  christos .endif
    762   1.95   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
    763  1.197   mycroft .endif
    764  1.238     lukem 	${_MKTARGET_INSTALL}
    765  1.188        tv 	${INSTALL_FILE} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
    766  1.264     jwise 		${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
    767   1.58       cgd .endif
    768  1.252     lukem .endif	# !target(libinstall)						# }
    769    1.1       cgd 
    770  1.188        tv ##### Pull in related .mk logic
    771  1.298       apb LINKSOWN?= ${LIBOWN}
    772  1.298       apb LINKSGRP?= ${LIBGRP}
    773  1.298       apb LINKSMODE?= ${LIBMODE}
    774    1.1       cgd .include <bsd.man.mk>
    775   1.57       jtc .include <bsd.nls.mk>
    776   1.91  christos .include <bsd.files.mk>
    777   1.89  christos .include <bsd.inc.mk>
    778  1.109       cjs .include <bsd.links.mk>
    779   1.24   mycroft .include <bsd.dep.mk>
    780  1.117   mycroft 
    781  1.188        tv ${TARGETS}:	# ensure existence
    782