Home | History | Annotate | Line # | Download | only in mk
bsd.lib.mk revision 1.171
      1  1.171  christos #	$NetBSD: bsd.lib.mk,v 1.171 2000/07/03 21:08:55 christos Exp $
      2   1.92     mikel #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
      3    1.1       cgd 
      4  1.117   mycroft .if !target(__initialized__)
      5  1.117   mycroft __initialized__:
      6    1.1       cgd .if exists(${.CURDIR}/../Makefile.inc)
      7    1.1       cgd .include "${.CURDIR}/../Makefile.inc"
      8    1.1       cgd .endif
      9   1.97   mycroft .include <bsd.own.mk>
     10  1.117   mycroft .include <bsd.obj.mk>
     11  1.159     perry .include <bsd.depall.mk>
     12  1.117   mycroft .MAIN:		all
     13  1.117   mycroft .endif
     14   1.97   mycroft 
     15  1.143       erh .PHONY:		checkver cleanlib libinstall
     16  1.143       erh realinstall:	checkver libinstall
     17  1.137     lukem clean cleandir distclean: cleanlib
     18    1.1       cgd 
     19  1.154    simonb .if exists(${SHLIB_VERSION_FILE})
     20  1.154    simonb SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
     21  1.154    simonb SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
     22  1.171  christos SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
     23  1.171  christos .if !empty(SHLIB_TEENY)
     24  1.171  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
     25  1.171  christos .else
     26  1.171  christos SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
     27  1.171  christos .endif
     28  1.171  christos 
     29  1.143       erh 
     30  1.143       erh # Check for higher installed library versions.
     31  1.145       erh .if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
     32  1.145       erh 	exists(${BSDSRCDIR}/lib/checkver)
     33  1.143       erh checkver:
     34  1.144       erh 	@(cd ${.CURDIR} && \
     35  1.154    simonb 		${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
     36  1.154    simonb 		    -d ${DESTDIR}${LIBDIR} ${LIB})
     37  1.143       erh .else
     38  1.143       erh checkver:
     39  1.143       erh .endif
     40  1.169   thorpej print-shlib-major:
     41  1.169   thorpej 	@echo ${SHLIB_MAJOR}
     42  1.169   thorpej 
     43  1.169   thorpej print-shlib-minor:
     44  1.169   thorpej 	@echo ${SHLIB_MINOR}
     45  1.171  christos 
     46  1.171  christos print-shlib-teeny:
     47  1.171  christos 	@echo ${SHLIB_TEENY}
     48  1.143       erh .else
     49  1.143       erh checkver:
     50  1.169   thorpej 
     51  1.169   thorpej print-shlib-major:
     52  1.169   thorpej 	@false
     53  1.169   thorpej 
     54  1.169   thorpej print-shlib-minor:
     55  1.169   thorpej 	@false
     56  1.171  christos 
     57  1.171  christos print-shlib-teeny:
     58  1.171  christos 	@false
     59   1.35        pk .endif
     60    1.1       cgd 
     61  1.101   mycroft # add additional suffixes not exported.
     62  1.101   mycroft # .po is used for profiling object files.
     63  1.101   mycroft # .so is used for PIC object files.
     64  1.118     lukem .SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
     65  1.118     lukem .SUFFIXES: .sh .m4 .m
     66   1.82     mikel 
     67   1.86  jonathan 
     68   1.86  jonathan # Set PICFLAGS to cc flags for producing position-independent code,
     69   1.86  jonathan # if not already set.  Includes -DPIC, if required.
     70   1.86  jonathan 
     71  1.164    simonb # Data-driven table using make variables to control how shared libraries
     72   1.86  jonathan # are built for different platforms and object formats.
     73  1.125  jonathan # OBJECT_FMT:		currently either "ELF" or "a.out", from <bsd.own.mk>
     74  1.164    simonb # SHLIB_SOVERSION:	version number to be compiled into a shared library
     75  1.164    simonb #			via -soname. Usualy ${SHLIB_MAJOR} on ELF.
     76  1.171  christos #			NetBSD/pmax used to use ${SHLIB_MAJOR}.${SHLIB_MINOR}
     77  1.171  christos #			[.${SHLIB_TEENY}]
     78  1.164    simonb # SHLIB_SHFLAGS:	Flags to tell ${LD} to emit shared library.
     79  1.123  jonathan #			with ELF, also set shared-lib version for ld.so.
     80  1.123  jonathan # SHLIB_LDSTARTFILE:	support .o file, call C++ file-level constructors
     81  1.123  jonathan # SHLIB_LDENDFILE:	support .o file, call C++ file-level destructors
     82  1.164    simonb # CPPICFLAGS:		flags for ${CPP} to preprocess .[sS] files for ${AS}
     83  1.164    simonb # CPICFLAGS:		flags for ${CC} to compile .[cC] files to .so objects.
     84  1.164    simonb # CAPICFLAGS		flags for {$CC} to compiling .[Ss] files
     85  1.107  jonathan #		 	(usually just ${CPPPICFLAGS} ${CPICFLAGS})
     86  1.164    simonb # APICFLAGS:		flags for ${AS} to assemble .[sS] to .so objects.
     87   1.86  jonathan 
     88  1.148     lukem .if ${MACHINE_ARCH} == "alpha"
     89  1.123  jonathan 		# Alpha-specific shared library flags
     90  1.165  dmcmahil CPICFLAGS ?= -fPIC -DPIC
     91  1.107  jonathan CPPPICFLAGS?= -DPIC 
     92  1.107  jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
     93  1.107  jonathan APICFLAGS ?=
     94  1.151  drochner .elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
     95  1.123  jonathan 		# mips-specific shared library flags
     96   1.86  jonathan 
     97  1.160    simonb # On mips, all libs are compiled with ABIcalls, not just sharedlibs.
     98  1.160    simonb MKPICLIB= no
     99  1.160    simonb 
    100  1.160    simonb # so turn shlib PIC flags on for ${AS}.
    101  1.160    simonb AINC+=-DABICALLS
    102   1.86  jonathan AFLAGS+= -fPIC
    103   1.86  jonathan AS+=	-KPIC
    104  1.150  christos 
    105  1.150  christos .elif ${MACHINE_ARCH} == "sparc" && ${OBJECT_FMT} == "ELF"
    106  1.150  christos 
    107  1.165  dmcmahil CPICFLAGS ?= -fPIC -DPIC
    108  1.150  christos CPPPICFLAGS?= -DPIC 
    109  1.150  christos CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    110  1.150  christos APICFLAGS ?= -KPIC
    111   1.86  jonathan 
    112   1.86  jonathan .else
    113   1.86  jonathan 
    114  1.125  jonathan # Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
    115   1.88       cgd SHLIB_LDSTARTFILE=
    116   1.88       cgd SHLIB_LDENDFILE=
    117  1.171  christos SHLIB_SOVERSION=${SHLIB_FULLVERSION}
    118  1.125  jonathan SHLIB_SHFLAGS=
    119  1.165  dmcmahil CPICFLAGS?= -fPIC -DPIC
    120  1.107  jonathan CPPPICFLAGS?= -DPIC 
    121  1.107  jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    122  1.107  jonathan APICFLAGS?= -k
    123   1.86  jonathan 
    124   1.86  jonathan .endif
    125   1.86  jonathan 
    126  1.160    simonb MKPICLIB?= yes
    127  1.160    simonb 
    128  1.123  jonathan # Platform-independent linker flags for ELF shared libraries
    129  1.148     lukem .if ${OBJECT_FMT} == "ELF"
    130  1.123  jonathan SHLIB_SOVERSION=${SHLIB_MAJOR}
    131  1.125  jonathan SHLIB_SHFLAGS=-soname lib${LIB}.so.${SHLIB_SOVERSION}
    132  1.142  jonathan SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o
    133  1.142  jonathan SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o
    134  1.123  jonathan .endif
    135   1.86  jonathan 
    136   1.82     mikel CFLAGS+=	${COPTS}
    137    1.1       cgd 
    138    1.1       cgd .c.o:
    139  1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    140  1.153  christos 	${COMPILE.c} ${.IMPSRC}
    141  1.153  christos .else
    142   1.80  christos 	@echo ${COMPILE.c:Q} ${.IMPSRC}
    143  1.122       cgd 	@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
    144   1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    145   1.62  christos 	@rm -f ${.TARGET}.o
    146  1.153  christos .endif
    147    1.1       cgd 
    148    1.1       cgd .c.po:
    149  1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    150  1.153  christos 	${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
    151  1.153  christos .else
    152   1.80  christos 	@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
    153   1.68       cgd 	@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
    154   1.62  christos 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    155   1.62  christos 	@rm -f ${.TARGET}.o
    156  1.153  christos .endif
    157   1.17   mycroft 
    158   1.27        pk .c.so:
    159  1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    160  1.153  christos 	${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    161  1.153  christos .else
    162   1.86  jonathan 	@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    163   1.86  jonathan 	@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
    164   1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    165   1.62  christos 	@rm -f ${.TARGET}.o
    166  1.153  christos .endif
    167   1.27        pk 
    168   1.58       cgd .c.ln:
    169  1.121   thorpej 	${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
    170   1.58       cgd 
    171   1.18   mycroft .cc.o .C.o:
    172  1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    173  1.153  christos 	${COMPILE.cc} ${.IMPSRC}
    174  1.153  christos .else
    175   1.80  christos 	@echo ${COMPILE.cc:Q} ${.IMPSRC}
    176   1.62  christos 	@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
    177   1.63       jtc 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    178   1.62  christos 	@rm -f ${.TARGET}.o
    179  1.153  christos .endif
    180   1.17   mycroft 
    181   1.18   mycroft .cc.po .C.po:
    182  1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    183  1.153  christos 	${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
    184  1.153  christos .else
    185   1.80  christos 	@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
    186   1.68       cgd 	@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
    187   1.62  christos 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    188   1.62  christos 	@rm -f ${.TARGET}.o
    189  1.153  christos .endif
    190   1.28       cgd 
    191   1.28       cgd .cc.so .C.so:
    192  1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    193  1.153  christos 	${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    194  1.153  christos .else
    195   1.86  jonathan 	@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    196   1.86  jonathan 	@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
    197   1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    198   1.62  christos 	@rm -f ${.TARGET}.o
    199  1.153  christos .endif
    200  1.118     lukem 
    201  1.118     lukem .m.o:
    202  1.153  christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
    203  1.153  christos 	${COMPILE.m} ${.IMPSRC}
    204  1.153  christos .else
    205  1.118     lukem 	@echo ${COMPILE.m:Q} ${.IMPSRC}
    206  1.122       cgd 	@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
    207  1.118     lukem 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    208  1.118     lukem 	@rm -f ${.TARGET}.o
    209  1.153  christos .endif
    210  1.118     lukem 
    211  1.118     lukem .m.po:
    212  1.153  christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
    213  1.153  christos 	${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
    214  1.153  christos .else
    215  1.118     lukem 	@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
    216  1.118     lukem 	@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
    217  1.118     lukem 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    218  1.118     lukem 	@rm -f ${.TARGET}.o
    219  1.153  christos .endif
    220  1.118     lukem 
    221  1.118     lukem .m.so:
    222  1.153  christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
    223  1.153  christos 	${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    224  1.153  christos .else
    225  1.118     lukem 	@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    226  1.118     lukem 	@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
    227  1.118     lukem 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    228  1.118     lukem 	@rm -f ${.TARGET}.o
    229  1.153  christos .endif
    230    1.1       cgd 
    231   1.40       cgd .S.o .s.o:
    232   1.80  christos 	@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
    233   1.69       jtc 	@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
    234   1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    235   1.62  christos 	@rm -f ${.TARGET}.o
    236    1.1       cgd 
    237   1.40       cgd .S.po .s.po:
    238   1.80  christos 	@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
    239   1.75       jtc 	@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
    240   1.62  christos 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    241   1.62  christos 	@rm -f ${.TARGET}.o
    242    1.1       cgd 
    243   1.40       cgd .S.so .s.so:
    244  1.107  jonathan 	@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
    245  1.107  jonathan 	@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
    246   1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    247   1.62  christos 	@rm -f ${.TARGET}.o
    248   1.27        pk 
    249  1.148     lukem .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    250  1.148     lukem 	|| ${MKLINKLIB} != "no"
    251  1.130        tv _LIBS=lib${LIB}.a
    252  1.130        tv .else
    253  1.130        tv _LIBS=
    254  1.130        tv .endif
    255   1.58       cgd 
    256  1.167      matt OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
    257  1.158  christos 
    258  1.149     lukem .if ${MKPROFILE} != "no"
    259  1.130        tv _LIBS+=lib${LIB}_p.a
    260  1.167      matt POBJS+=${OBJS:.o=.po}
    261    1.1       cgd .endif
    262    1.1       cgd 
    263  1.148     lukem .if ${MKPIC} != "no"
    264  1.160    simonb .if ${MKPICLIB} == "no"
    265  1.160    simonb SOLIB=lib${LIB}.a
    266  1.160    simonb .else
    267  1.160    simonb SOLIB=lib${LIB}_pic.a
    268  1.160    simonb _LIBS+=${SOLIB}
    269  1.167      matt SOBJS+=${OBJS:.o=.so}
    270  1.160    simonb .endif
    271  1.171  christos .if defined(SHLIB_FULLVERSION)
    272  1.171  christos _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
    273   1.27        pk .endif
    274   1.35        pk .endif
    275   1.27        pk 
    276  1.148     lukem .if ${MKLINT} != "no" && ${MKLINKLIB} != "no"
    277   1.58       cgd _LIBS+=llib-l${LIB}.ln
    278  1.158  christos LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
    279   1.27        pk .endif
    280   1.27        pk 
    281  1.167      matt .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    282  1.167      matt 	|| ${MKLINKLIB} != "no"
    283  1.158  christos ALLOBJS=${OBJS} ${POBJS} ${SOBJS} ${LOBJS}
    284  1.167      matt .else
    285  1.167      matt ALLOBJS=${POBJS} ${SOBJS} ${LOBJS}
    286  1.167      matt .endif
    287  1.163       erh .NOPATH: ${ALLOBJS} ${_LIBS}
    288  1.158  christos 
    289  1.162   mycroft realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
    290    1.1       cgd 
    291   1.90  christos __archivebuild: .USE
    292   1.89  christos 	@rm -f ${.TARGET}
    293  1.138        tv 	@${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
    294   1.89  christos 	${RANLIB} ${.TARGET}
    295   1.89  christos 
    296   1.89  christos __archiveinstall: .USE
    297  1.156    simonb 	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
    298  1.156    simonb 	    -g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
    299   1.89  christos 	${RANLIB} -t ${.TARGET}
    300   1.89  christos 	chmod ${LIBMODE} ${.TARGET}
    301   1.89  christos 
    302  1.104   mycroft DPSRCS+=	${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
    303  1.128        tv CLEANFILES+=	${DPSRCS}
    304  1.129        tv .if defined(YHEADER)
    305  1.129        tv CLEANFILES+=	${SRCS:M*.y:.y=.h}
    306  1.129        tv .endif
    307  1.103   mycroft 
    308   1.89  christos lib${LIB}.a:: ${OBJS} __archivebuild
    309    1.1       cgd 	@echo building standard ${LIB} library
    310    1.1       cgd 
    311   1.89  christos lib${LIB}_p.a:: ${POBJS} __archivebuild
    312    1.1       cgd 	@echo building profiled ${LIB} library
    313    1.1       cgd 
    314   1.89  christos lib${LIB}_pic.a:: ${SOBJS} __archivebuild
    315   1.27        pk 	@echo building shared object ${LIB} library
    316   1.27        pk 
    317  1.171  christos lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
    318   1.88       cgd     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
    319  1.171  christos 	@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
    320  1.171  christos 	@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
    321  1.152      fair .if defined(DESTDIR)
    322  1.155  wrstuden 	$(LD) -nostdlib -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
    323  1.152      fair 	    ${SHLIB_LDSTARTFILE} \
    324  1.160    simonb 	    --whole-archive ${SOLIB} \
    325  1.170       erh 	    --no-whole-archive ${LDADD} \
    326  1.155  wrstuden 	    -L${DESTDIR}${LIBDIR} -R${LIBDIR} \
    327  1.152      fair 	    ${SHLIB_LDENDFILE}
    328  1.152      fair .else
    329  1.126  jonathan 	$(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
    330  1.123  jonathan 	    ${SHLIB_LDSTARTFILE} \
    331  1.160    simonb 	    --whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
    332  1.115       cjs 	    ${SHLIB_LDENDFILE}
    333  1.152      fair .endif
    334  1.148     lukem .if ${OBJECT_FMT} == "ELF"
    335  1.135        tv 	rm -f lib${LIB}.so.${SHLIB_MAJOR}
    336  1.171  christos 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}
    337  1.135        tv 	rm -f lib${LIB}.so
    338  1.171  christos 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so
    339  1.133        tv .endif
    340   1.35        pk 
    341  1.103   mycroft LLIBS?=		-lc
    342   1.58       cgd llib-l${LIB}.ln: ${LOBJS}
    343   1.58       cgd 	@echo building llib-l${LIB}.ln
    344   1.58       cgd 	@rm -f llib-l${LIB}.ln
    345  1.141  wrstuden 	@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
    346    1.1       cgd 
    347   1.81       cgd cleanlib:
    348   1.48   mycroft 	rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
    349   1.59       cgd 	rm -f lib${LIB}.a ${OBJS}
    350   1.59       cgd 	rm -f lib${LIB}_p.a ${POBJS}
    351  1.133        tv 	rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
    352   1.59       cgd 	rm -f llib-l${LIB}.ln ${LOBJS}
    353    1.1       cgd 
    354   1.26   mycroft .if defined(SRCS)
    355   1.64  christos afterdepend: .depend
    356    1.1       cgd 	@(TMP=/tmp/_depend$$$$; \
    357   1.79       cgd 	    sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
    358   1.58       cgd 	      < .depend > $$TMP; \
    359    1.1       cgd 	    mv $$TMP .depend)
    360   1.26   mycroft .endif
    361    1.1       cgd 
    362   1.97   mycroft .if !target(libinstall)
    363  1.148     lukem # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
    364  1.139        tv libinstall::
    365  1.139        tv 
    366  1.148     lukem .if ${MKLINKLIB} != "no"
    367   1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    368  1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    369   1.89  christos .if !defined(UPDATE)
    370   1.89  christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    371   1.89  christos .endif
    372  1.168   mycroft 
    373  1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
    374   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
    375   1.89  christos .endif
    376   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
    377  1.130        tv .endif
    378   1.89  christos 
    379  1.149     lukem .if ${MKPROFILE} != "no"
    380   1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    381  1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    382   1.89  christos .if !defined(UPDATE)
    383   1.89  christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    384   1.32        pk .endif
    385  1.168   mycroft 
    386  1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
    387   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
    388   1.89  christos .endif
    389   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
    390   1.89  christos .endif
    391   1.89  christos 
    392  1.149     lukem .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
    393  1.168   mycroft libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    394  1.160    simonb .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    395   1.89  christos .if !defined(UPDATE)
    396   1.89  christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    397   1.89  christos .endif
    398  1.168   mycroft 
    399  1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
    400   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
    401   1.33        pk .endif
    402  1.160    simonb .if ${MKPICLIB} == "no"
    403  1.160    simonb ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
    404  1.160    simonb 	rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    405  1.160    simonb 	ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    406  1.160    simonb .else
    407   1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
    408  1.160    simonb .endif
    409   1.89  christos .endif
    410   1.89  christos 
    411  1.171  christos .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    412  1.171  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
    413  1.171  christos .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
    414   1.89  christos .if !defined(UPDATE)
    415  1.171  christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
    416   1.89  christos .endif
    417  1.168   mycroft 
    418  1.171  christos .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
    419  1.171  christos ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
    420   1.89  christos .endif
    421  1.171  christos ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
    422  1.156    simonb 	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
    423  1.156    simonb 	    -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
    424  1.148     lukem .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
    425  1.146   thorpej 	/sbin/ldconfig -m ${LIBDIR}
    426  1.146   thorpej .endif
    427  1.148     lukem .if ${OBJECT_FMT} == "ELF"
    428   1.83       cgd 	rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
    429  1.171  christos 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} \
    430   1.83       cgd 	    ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
    431   1.83       cgd 	rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so
    432  1.148     lukem .if ${MKLINKLIB} != "no"
    433  1.171  christos 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} \
    434   1.83       cgd 	    ${DESTDIR}${LIBDIR}/lib${LIB}.so
    435   1.83       cgd .endif
    436   1.12       cgd .endif
    437  1.139        tv .endif
    438   1.89  christos 
    439  1.148     lukem .if ${MKLINT} != "no" && ${MKLINKLIB} != "no"
    440   1.89  christos libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    441  1.168   mycroft .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    442   1.89  christos .if !defined(UPDATE)
    443   1.89  christos .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    444   1.89  christos .endif
    445  1.168   mycroft 
    446  1.157     fredb .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
    447   1.89  christos ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
    448   1.89  christos .endif
    449   1.95   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
    450  1.156    simonb 	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
    451  1.156    simonb 	    -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
    452   1.58       cgd .endif
    453    1.1       cgd .endif
    454    1.1       cgd 
    455    1.1       cgd .include <bsd.man.mk>
    456   1.57       jtc .include <bsd.nls.mk>
    457   1.91  christos .include <bsd.files.mk>
    458   1.89  christos .include <bsd.inc.mk>
    459  1.109       cjs .include <bsd.links.mk>
    460   1.24   mycroft .include <bsd.dep.mk>
    461   1.66  christos .include <bsd.sys.mk>
    462  1.117   mycroft 
    463  1.117   mycroft # Make sure all of the standard targets are defined, even if they do nothing.
    464  1.117   mycroft lint regress:
    465