Home | History | Annotate | Line # | Download | only in mk
bsd.lib.mk revision 1.169.2.5
      1  1.169.2.3  gmcgarry #	$NetBSD: bsd.lib.mk,v 1.169.2.5 2000/08/22 06:27:13 mrg 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.169.2.4    kleink SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
     23  1.169.2.4    kleink .if !empty(SHLIB_TEENY)
     24  1.169.2.4    kleink SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
     25  1.169.2.4    kleink .else
     26  1.169.2.4    kleink SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
     27  1.169.2.4    kleink .endif
     28  1.169.2.4    kleink 
     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.169.2.3  gmcgarry 		sh ${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.169.2.4    kleink 
     46  1.169.2.4    kleink print-shlib-teeny:
     47  1.169.2.4    kleink 	@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.169.2.4    kleink 
     57  1.169.2.4    kleink print-shlib-teeny:
     58  1.169.2.4    kleink 	@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.169.2.4    kleink #			NetBSD/pmax used to use ${SHLIB_MAJOR}.${SHLIB_MINOR}
     77  1.169.2.4    kleink #			[.${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.169.2.5       mrg .elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
    106  1.169.2.5       mrg        ${OBJECT_FMT} == "ELF"
    107  1.169.2.2   mycroft 
    108  1.169.2.2   mycroft CPICFLAGS ?= -fPIC -DPIC
    109  1.169.2.2   mycroft CPPPICFLAGS?= -DPIC 
    110  1.169.2.2   mycroft CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    111  1.169.2.2   mycroft APICFLAGS ?= -KPIC
    112  1.169.2.2   mycroft 
    113  1.169.2.2   mycroft .elif ${MACHINE_ARCH} == "sparc64" && ${OBJECT_FMT} == "ELF"
    114      1.150  christos 
    115      1.165  dmcmahil CPICFLAGS ?= -fPIC -DPIC
    116      1.150  christos CPPPICFLAGS?= -DPIC 
    117      1.150  christos CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    118      1.150  christos APICFLAGS ?= -KPIC
    119       1.86  jonathan 
    120       1.86  jonathan .else
    121       1.86  jonathan 
    122      1.125  jonathan # Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
    123       1.88       cgd SHLIB_LDSTARTFILE=
    124       1.88       cgd SHLIB_LDENDFILE=
    125  1.169.2.4    kleink SHLIB_SOVERSION=${SHLIB_FULLVERSION}
    126      1.125  jonathan SHLIB_SHFLAGS=
    127      1.165  dmcmahil CPICFLAGS?= -fPIC -DPIC
    128      1.107  jonathan CPPPICFLAGS?= -DPIC 
    129      1.107  jonathan CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
    130      1.107  jonathan APICFLAGS?= -k
    131       1.86  jonathan 
    132       1.86  jonathan .endif
    133       1.86  jonathan 
    134      1.160    simonb MKPICLIB?= yes
    135      1.160    simonb 
    136      1.123  jonathan # Platform-independent linker flags for ELF shared libraries
    137      1.148     lukem .if ${OBJECT_FMT} == "ELF"
    138      1.123  jonathan SHLIB_SOVERSION=${SHLIB_MAJOR}
    139      1.125  jonathan SHLIB_SHFLAGS=-soname lib${LIB}.so.${SHLIB_SOVERSION}
    140      1.142  jonathan SHLIB_LDSTARTFILE= ${DESTDIR}/usr/lib/crtbeginS.o
    141      1.142  jonathan SHLIB_LDENDFILE= ${DESTDIR}/usr/lib/crtendS.o
    142      1.123  jonathan .endif
    143       1.86  jonathan 
    144       1.82     mikel CFLAGS+=	${COPTS}
    145        1.1       cgd 
    146        1.1       cgd .c.o:
    147      1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    148      1.153  christos 	${COMPILE.c} ${.IMPSRC}
    149      1.153  christos .else
    150       1.80  christos 	@echo ${COMPILE.c:Q} ${.IMPSRC}
    151      1.122       cgd 	@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
    152       1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    153       1.62  christos 	@rm -f ${.TARGET}.o
    154      1.153  christos .endif
    155        1.1       cgd 
    156        1.1       cgd .c.po:
    157      1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    158      1.153  christos 	${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
    159      1.153  christos .else
    160       1.80  christos 	@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
    161       1.68       cgd 	@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
    162       1.62  christos 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    163       1.62  christos 	@rm -f ${.TARGET}.o
    164      1.153  christos .endif
    165       1.17   mycroft 
    166       1.27        pk .c.so:
    167      1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    168      1.153  christos 	${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    169      1.153  christos .else
    170       1.86  jonathan 	@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    171       1.86  jonathan 	@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
    172       1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    173       1.62  christos 	@rm -f ${.TARGET}.o
    174      1.153  christos .endif
    175       1.27        pk 
    176       1.58       cgd .c.ln:
    177      1.121   thorpej 	${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
    178       1.58       cgd 
    179       1.18   mycroft .cc.o .C.o:
    180      1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    181      1.153  christos 	${COMPILE.cc} ${.IMPSRC}
    182      1.153  christos .else
    183       1.80  christos 	@echo ${COMPILE.cc:Q} ${.IMPSRC}
    184       1.62  christos 	@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
    185       1.63       jtc 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    186       1.62  christos 	@rm -f ${.TARGET}.o
    187      1.153  christos .endif
    188       1.17   mycroft 
    189       1.18   mycroft .cc.po .C.po:
    190      1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    191      1.153  christos 	${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
    192      1.153  christos .else
    193       1.80  christos 	@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
    194       1.68       cgd 	@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
    195       1.62  christos 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    196       1.62  christos 	@rm -f ${.TARGET}.o
    197      1.153  christos .endif
    198       1.28       cgd 
    199       1.28       cgd .cc.so .C.so:
    200      1.153  christos .if defined(COPTS) && !empty(COPTS:M*-g*)
    201      1.153  christos 	${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    202      1.153  christos .else
    203       1.86  jonathan 	@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    204       1.86  jonathan 	@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
    205       1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    206       1.62  christos 	@rm -f ${.TARGET}.o
    207      1.153  christos .endif
    208      1.118     lukem 
    209      1.118     lukem .m.o:
    210      1.153  christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
    211      1.153  christos 	${COMPILE.m} ${.IMPSRC}
    212      1.153  christos .else
    213      1.118     lukem 	@echo ${COMPILE.m:Q} ${.IMPSRC}
    214      1.122       cgd 	@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
    215      1.118     lukem 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    216      1.118     lukem 	@rm -f ${.TARGET}.o
    217      1.153  christos .endif
    218      1.118     lukem 
    219      1.118     lukem .m.po:
    220      1.153  christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
    221      1.153  christos 	${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
    222      1.153  christos .else
    223      1.118     lukem 	@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
    224      1.118     lukem 	@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
    225      1.118     lukem 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    226      1.118     lukem 	@rm -f ${.TARGET}.o
    227      1.153  christos .endif
    228      1.118     lukem 
    229      1.118     lukem .m.so:
    230      1.153  christos .if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
    231      1.153  christos 	${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    232      1.153  christos .else
    233      1.118     lukem 	@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
    234      1.118     lukem 	@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
    235      1.118     lukem 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    236      1.118     lukem 	@rm -f ${.TARGET}.o
    237      1.153  christos .endif
    238        1.1       cgd 
    239       1.40       cgd .S.o .s.o:
    240       1.80  christos 	@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
    241       1.69       jtc 	@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
    242       1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    243       1.62  christos 	@rm -f ${.TARGET}.o
    244        1.1       cgd 
    245       1.40       cgd .S.po .s.po:
    246       1.80  christos 	@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
    247       1.75       jtc 	@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
    248       1.62  christos 	@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
    249       1.62  christos 	@rm -f ${.TARGET}.o
    250        1.1       cgd 
    251       1.40       cgd .S.so .s.so:
    252      1.107  jonathan 	@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
    253      1.107  jonathan 	@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
    254       1.62  christos 	@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
    255       1.62  christos 	@rm -f ${.TARGET}.o
    256       1.27        pk 
    257      1.148     lukem .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    258      1.148     lukem 	|| ${MKLINKLIB} != "no"
    259      1.130        tv _LIBS=lib${LIB}.a
    260      1.130        tv .else
    261      1.130        tv _LIBS=
    262      1.130        tv .endif
    263       1.58       cgd 
    264      1.167      matt OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
    265      1.158  christos 
    266      1.149     lukem .if ${MKPROFILE} != "no"
    267      1.130        tv _LIBS+=lib${LIB}_p.a
    268      1.167      matt POBJS+=${OBJS:.o=.po}
    269        1.1       cgd .endif
    270        1.1       cgd 
    271      1.148     lukem .if ${MKPIC} != "no"
    272      1.160    simonb .if ${MKPICLIB} == "no"
    273      1.160    simonb SOLIB=lib${LIB}.a
    274      1.160    simonb .else
    275      1.160    simonb SOLIB=lib${LIB}_pic.a
    276      1.160    simonb _LIBS+=${SOLIB}
    277      1.167      matt SOBJS+=${OBJS:.o=.so}
    278      1.160    simonb .endif
    279  1.169.2.4    kleink .if defined(SHLIB_FULLVERSION)
    280  1.169.2.4    kleink _LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
    281       1.27        pk .endif
    282       1.35        pk .endif
    283       1.27        pk 
    284      1.148     lukem .if ${MKLINT} != "no" && ${MKLINKLIB} != "no"
    285       1.58       cgd _LIBS+=llib-l${LIB}.ln
    286      1.158  christos LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
    287       1.27        pk .endif
    288       1.27        pk 
    289      1.167      matt .if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
    290      1.167      matt 	|| ${MKLINKLIB} != "no"
    291      1.158  christos ALLOBJS=${OBJS} ${POBJS} ${SOBJS} ${LOBJS}
    292      1.167      matt .else
    293      1.167      matt ALLOBJS=${POBJS} ${SOBJS} ${LOBJS}
    294      1.167      matt .endif
    295      1.163       erh .NOPATH: ${ALLOBJS} ${_LIBS}
    296      1.158  christos 
    297      1.162   mycroft realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
    298        1.1       cgd 
    299       1.90  christos __archivebuild: .USE
    300       1.89  christos 	@rm -f ${.TARGET}
    301      1.138        tv 	@${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
    302       1.89  christos 	${RANLIB} ${.TARGET}
    303       1.89  christos 
    304       1.89  christos __archiveinstall: .USE
    305      1.156    simonb 	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
    306      1.156    simonb 	    -g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
    307       1.89  christos 	${RANLIB} -t ${.TARGET}
    308       1.89  christos 	chmod ${LIBMODE} ${.TARGET}
    309       1.89  christos 
    310      1.104   mycroft DPSRCS+=	${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
    311      1.128        tv CLEANFILES+=	${DPSRCS}
    312      1.129        tv .if defined(YHEADER)
    313      1.129        tv CLEANFILES+=	${SRCS:M*.y:.y=.h}
    314      1.129        tv .endif
    315      1.103   mycroft 
    316       1.89  christos lib${LIB}.a:: ${OBJS} __archivebuild
    317        1.1       cgd 	@echo building standard ${LIB} library
    318        1.1       cgd 
    319       1.89  christos lib${LIB}_p.a:: ${POBJS} __archivebuild
    320        1.1       cgd 	@echo building profiled ${LIB} library
    321        1.1       cgd 
    322       1.89  christos lib${LIB}_pic.a:: ${SOBJS} __archivebuild
    323       1.27        pk 	@echo building shared object ${LIB} library
    324       1.27        pk 
    325  1.169.2.4    kleink lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
    326       1.88       cgd     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
    327  1.169.2.4    kleink 	@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
    328  1.169.2.4    kleink 	@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
    329      1.152      fair .if defined(DESTDIR)
    330      1.155  wrstuden 	$(LD) -nostdlib -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
    331      1.152      fair 	    ${SHLIB_LDSTARTFILE} \
    332      1.160    simonb 	    --whole-archive ${SOLIB} \
    333      1.152      fair 	    --no-whole-archive ${LDADD} \
    334  1.169.2.1   thorpej 	    -L${DESTDIR}${LIBDIR} -R${LIBDIR} \
    335      1.152      fair 	    ${SHLIB_LDENDFILE}
    336      1.152      fair .else
    337      1.126  jonathan 	$(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
    338      1.123  jonathan 	    ${SHLIB_LDSTARTFILE} \
    339      1.160    simonb 	    --whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
    340      1.115       cjs 	    ${SHLIB_LDENDFILE}
    341      1.152      fair .endif
    342      1.148     lukem .if ${OBJECT_FMT} == "ELF"
    343      1.135        tv 	rm -f lib${LIB}.so.${SHLIB_MAJOR}
    344  1.169.2.4    kleink 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}
    345      1.135        tv 	rm -f lib${LIB}.so
    346  1.169.2.4    kleink 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so
    347      1.133        tv .endif
    348       1.35        pk 
    349      1.103   mycroft LLIBS?=		-lc
    350       1.58       cgd llib-l${LIB}.ln: ${LOBJS}
    351       1.58       cgd 	@echo building llib-l${LIB}.ln
    352       1.58       cgd 	@rm -f llib-l${LIB}.ln
    353      1.141  wrstuden 	@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
    354        1.1       cgd 
    355       1.81       cgd cleanlib:
    356       1.48   mycroft 	rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
    357       1.59       cgd 	rm -f lib${LIB}.a ${OBJS}
    358       1.59       cgd 	rm -f lib${LIB}_p.a ${POBJS}
    359      1.133        tv 	rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
    360       1.59       cgd 	rm -f llib-l${LIB}.ln ${LOBJS}
    361        1.1       cgd 
    362       1.26   mycroft .if defined(SRCS)
    363       1.64  christos afterdepend: .depend
    364        1.1       cgd 	@(TMP=/tmp/_depend$$$$; \
    365       1.79       cgd 	    sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
    366       1.58       cgd 	      < .depend > $$TMP; \
    367        1.1       cgd 	    mv $$TMP .depend)
    368       1.26   mycroft .endif
    369        1.1       cgd 
    370       1.97   mycroft .if !target(libinstall)
    371      1.148     lukem # Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
    372      1.139        tv libinstall::
    373      1.139        tv 
    374      1.148     lukem .if ${MKLINKLIB} != "no"
    375       1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    376      1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    377       1.89  christos .if !defined(UPDATE)
    378       1.89  christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
    379       1.89  christos .endif
    380      1.168   mycroft 
    381      1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
    382       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
    383       1.89  christos .endif
    384       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
    385      1.130        tv .endif
    386       1.89  christos 
    387      1.149     lukem .if ${MKPROFILE} != "no"
    388       1.89  christos libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    389      1.168   mycroft .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    390       1.89  christos .if !defined(UPDATE)
    391       1.89  christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
    392       1.32        pk .endif
    393      1.168   mycroft 
    394      1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
    395       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
    396       1.89  christos .endif
    397       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
    398       1.89  christos .endif
    399       1.89  christos 
    400      1.149     lukem .if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
    401      1.168   mycroft libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    402      1.160    simonb .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    403       1.89  christos .if !defined(UPDATE)
    404       1.89  christos .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    405       1.89  christos .endif
    406      1.168   mycroft 
    407      1.157     fredb .if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
    408       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
    409       1.33        pk .endif
    410      1.160    simonb .if ${MKPICLIB} == "no"
    411      1.160    simonb ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
    412      1.160    simonb 	rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    413      1.160    simonb 	ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
    414      1.160    simonb .else
    415       1.89  christos ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
    416      1.160    simonb .endif
    417       1.89  christos .endif
    418       1.89  christos 
    419  1.169.2.4    kleink .if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
    420  1.169.2.4    kleink libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
    421  1.169.2.4    kleink .PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
    422       1.89  christos .if !defined(UPDATE)
    423  1.169.2.4    kleink .PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
    424       1.89  christos .endif
    425      1.168   mycroft 
    426  1.169.2.4    kleink .if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
    427  1.169.2.4    kleink ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
    428       1.89  christos .endif
    429  1.169.2.4    kleink ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
    430      1.156    simonb 	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
    431      1.156    simonb 	    -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
    432      1.148     lukem .if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
    433      1.146   thorpej 	/sbin/ldconfig -m ${LIBDIR}
    434      1.146   thorpej .endif
    435      1.148     lukem .if ${OBJECT_FMT} == "ELF"
    436       1.83       cgd 	rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
    437  1.169.2.4    kleink 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} \
    438       1.83       cgd 	    ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
    439       1.83       cgd 	rm -f ${DESTDIR}${LIBDIR}/lib${LIB}.so
    440      1.148     lukem .if ${MKLINKLIB} != "no"
    441  1.169.2.4    kleink 	ln -s lib${LIB}.so.${SHLIB_FULLVERSION} \
    442       1.83       cgd 	    ${DESTDIR}${LIBDIR}/lib${LIB}.so
    443       1.83       cgd .endif
    444       1.12       cgd .endif
    445      1.139        tv .endif
    446       1.89  christos 
    447      1.148     lukem .if ${MKLINT} != "no" && ${MKLINKLIB} != "no"
    448       1.89  christos libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    449      1.168   mycroft .PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    450       1.89  christos .if !defined(UPDATE)
    451       1.89  christos .PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
    452       1.89  christos .endif
    453      1.168   mycroft 
    454      1.157     fredb .if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
    455       1.89  christos ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
    456       1.89  christos .endif
    457       1.95   mycroft ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
    458      1.156    simonb 	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
    459      1.156    simonb 	    -g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
    460       1.58       cgd .endif
    461        1.1       cgd .endif
    462        1.1       cgd 
    463        1.1       cgd .include <bsd.man.mk>
    464       1.57       jtc .include <bsd.nls.mk>
    465       1.91  christos .include <bsd.files.mk>
    466       1.89  christos .include <bsd.inc.mk>
    467      1.109       cjs .include <bsd.links.mk>
    468       1.24   mycroft .include <bsd.dep.mk>
    469       1.66  christos .include <bsd.sys.mk>
    470      1.117   mycroft 
    471      1.117   mycroft # Make sure all of the standard targets are defined, even if they do nothing.
    472      1.117   mycroft lint regress:
    473