version 1.8, 1993/04/09 20:05:58 |
version 1.68, 1996/09/05 19:12:33 |
|
|
|
# $NetBSD$ |
# @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 |
# @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91 |
|
|
.if exists(${.CURDIR}/../Makefile.inc) |
.if exists(${.CURDIR}/../Makefile.inc) |
.include "${.CURDIR}/../Makefile.inc" |
.include "${.CURDIR}/../Makefile.inc" |
.endif |
.endif |
|
|
LIBDIR?= /usr/lib |
.include <bsd.own.mk> # for 'NOPIC' definition |
LINTLIBDIR?= /usr/libdata/lint |
|
LIBGRP?= bin |
.if exists(${.CURDIR}/shlib_version) |
LIBOWN?= bin |
SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major |
LIBMODE?= 444 |
SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor |
|
.endif |
STRIP?= -s |
|
|
|
BINGRP?= bin |
|
BINOWN?= bin |
|
BINMODE?= 555 |
|
|
|
.MAIN: all |
.MAIN: all |
|
|
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries |
# prefer .S to a .c, add .po, remove stuff not used in the BSD libraries. |
|
# .so used for PIC object files. .ln used for lint output files. |
.SUFFIXES: |
.SUFFIXES: |
.SUFFIXES: .out .o .po .s .c .f .y .l .8 .7 .6 .5 .4 .3 .2 .1 .0 |
.SUFFIXES: .out .o .po .so .S .s .c .cc .C .f .y .l .ln .m4 |
|
|
.8.0 .7.0 .6.0 .5.0 .4.0 .3.0 .2.0 .1.0: |
|
nroff -mandoc ${.IMPSRC} > ${.TARGET} |
|
|
|
.c.o: |
.c.o: |
${CC} ${CFLAGS} -c ${.IMPSRC} |
@echo "${COMPILE.c} ${.IMPSRC}" |
@${LD} -x -r ${.TARGET} |
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o |
@mv a.out ${.TARGET} |
@${LD} -x -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
|
|
.c.po: |
.c.po: |
${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} |
@echo "${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}" |
@${LD} -X -r ${.TARGET} |
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o |
@mv a.out ${.TARGET} |
@${LD} -X -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
.s.o: |
|
${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ |
.c.so: |
${AS} -o ${.TARGET} |
@echo "${COMPILE.c} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}" |
@${LD} -x -r ${.TARGET} |
@${COMPILE.c} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}.o |
@mv a.out ${.TARGET} |
@${LD} -x -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
.s.po: |
|
${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ |
.c.ln: |
${AS} -o ${.TARGET} |
${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} -i ${.IMPSRC} |
@${LD} -X -r ${.TARGET} |
|
@mv a.out ${.TARGET} |
.cc.o .C.o: |
|
@echo "${COMPILE.cc} ${.IMPSRC}" |
|
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o |
|
@${LD} -x -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
|
|
|
.cc.po .C.po: |
|
@echo "${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}" |
|
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o |
|
@${LD} -X -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
|
|
|
.cc.so .C.so: |
|
@echo "${COMPILE.cc} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}" |
|
@${COMPILE.cc} ${PICFLAG} -DPIC ${.IMPSRC} -o ${.TARGET}.o |
|
@${LD} -x -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
|
|
|
.S.o .s.o: |
|
@echo "${CPP} ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ |
|
${AS} -o ${.TARGET}" |
|
@${CPP} ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ |
|
${AS} -o ${.TARGET}.o |
|
@${LD} -x -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
|
|
|
.S.po .s.po: |
|
@echo "${CPP} -DPROF ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} |\ |
|
${AS} -o ${.TARGET}" |
|
@${CPP} -DPROF ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ |
|
${AS} -o ${.TARGET}.o |
|
@${LD} -X -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
|
|
|
.S.so .s.so: |
|
@echo "${CPP} -DPIC ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ |
|
${AS} -k -o ${.TARGET}" |
|
@${CPP} -DPIC ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ |
|
${AS} -k -o ${.TARGET}.o |
|
@${LD} -x -r ${.TARGET}.o -o ${.TARGET} |
|
@rm -f ${.TARGET}.o |
|
|
MANALL= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8} |
.if !defined(PICFLAG) |
|
PICFLAG=-fpic |
|
.endif |
|
|
.if !defined(NOPROFILE) |
.if !defined(NOPROFILE) |
_LIBS=lib${LIB}.a lib${LIB}_p.a |
_LIBS=lib${LIB}.a lib${LIB}_p.a |
Line 55 _LIBS=lib${LIB}.a lib${LIB}_p.a |
|
Line 92 _LIBS=lib${LIB}.a lib${LIB}_p.a |
|
_LIBS=lib${LIB}.a |
_LIBS=lib${LIB}.a |
.endif |
.endif |
|
|
all: ${_LIBS} ${MANALL}# llib-l${LIB}.ln |
.if !defined(NOPIC) |
|
_LIBS+=lib${LIB}_pic.a |
|
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) |
|
_LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} |
|
.endif |
|
.endif |
|
|
|
.if !defined(NOLINT) |
|
_LIBS+=llib-l${LIB}.ln |
|
.endif |
|
|
|
all: ${_LIBS} _SUBDIRUSE |
|
|
OBJS+= ${SRCS:R:S/$/.o/g} |
OBJS+= ${SRCS:N*.h:R:S/$/.o/g} |
|
|
lib${LIB}.a:: ${OBJS} |
lib${LIB}.a:: ${OBJS} |
@echo building standard ${LIB} library |
@echo building standard ${LIB} library |
@rm -f lib${LIB}.a |
@rm -f lib${LIB}.a |
@${AR} cTq lib${LIB}.a `lorder ${OBJS} | tsort` ${LDADD} |
@${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort -q` |
ranlib lib${LIB}.a |
${RANLIB} lib${LIB}.a |
|
|
POBJS+= ${OBJS:.o=.po} |
POBJS+= ${OBJS:.o=.po} |
lib${LIB}_p.a:: ${POBJS} |
lib${LIB}_p.a:: ${POBJS} |
@echo building profiled ${LIB} library |
@echo building profiled ${LIB} library |
@rm -f lib${LIB}_p.a |
@rm -f lib${LIB}_p.a |
@${AR} cTq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${LDADD} |
@${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort -q` |
ranlib lib${LIB}_p.a |
${RANLIB} lib${LIB}_p.a |
|
|
llib-l${LIB}.ln: ${SRCS} |
SOBJS+= ${OBJS:.o=.so} |
${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c} |
lib${LIB}_pic.a:: ${SOBJS} |
|
@echo building shared object ${LIB} library |
|
@rm -f lib${LIB}_pic.a |
|
@${AR} cq lib${LIB}_pic.a `lorder ${SOBJS} | tsort -q` |
|
${RANLIB} lib${LIB}_pic.a |
|
|
|
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: lib${LIB}_pic.a ${DPADD} |
|
@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\) |
|
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} |
|
$(LD) -x -Bshareable -Bforcearchive \ |
|
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} lib${LIB}_pic.a ${LDADD} |
|
|
|
LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln} |
|
# the following looks XXX to me... -- cgd |
|
LLIBS?= -lc |
|
llib-l${LIB}.ln: ${LOBJS} |
|
@echo building llib-l${LIB}.ln |
|
@rm -f llib-l${LIB}.ln |
|
@${LINT} -C${LIB} ${LOBJS} ${LLIBS} |
|
|
.if !target(clean) |
.if !target(clean) |
clean: |
clean: _SUBDIRUSE |
rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ |
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES} |
profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln |
rm -f lib${LIB}.a ${OBJS} |
.endif |
rm -f lib${LIB}_p.a ${POBJS} |
|
rm -f lib${LIB}_pic.a lib${LIB}.so.*.* ${SOBJS} |
.if !target(cleandir) |
rm -f llib-l${LIB}.ln ${LOBJS} |
cleandir: |
.endif |
rm -f a.out Errs errs mklog core ${CLEANFILES} ${OBJS} ${POBJS} \ |
|
profiled/*.o lib${LIB}.a lib${LIB}_p.a llib-l${LIB}.ln |
cleandir: _SUBDIRUSE clean |
rm -f ${MANALL} ${.CURDIR}/tags .depend |
|
.endif |
.if defined(SRCS) |
|
afterdepend: .depend |
.if !target(depend) |
|
depend: .depend |
|
.depend: ${SRCS} |
|
mkdep ${CFLAGS:M-[ID+]*} ${AINC} ${.ALLSRC} |
|
@(TMP=/tmp/_depend$$$$; \ |
@(TMP=/tmp/_depend$$$$; \ |
sed -e 's/^\([^\.]*\).o:/\1.o \1.po:/' < .depend > $$TMP; \ |
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' \ |
|
< .depend > $$TMP; \ |
mv $$TMP .depend) |
mv $$TMP .depend) |
.endif |
.endif |
|
|
.if !target(install) |
.if !target(install) |
.if !target(beforeinstall) |
.if !target(beforeinstall) |
beforeinstall: |
beforeinstall: |
@if [ ! -d "${DESTDIR}${LIBDIR}" ]; then \ |
|
/bin/rm -f ${DESTDIR}${LIBDIR} ; \ |
|
mkdir -p ${DESTDIR}${LIBDIR} ; \ |
|
chown root.wheel ${DESTDIR}${LIBDIR} ; \ |
|
chmod 755 ${DESTDIR}${LIBDIR} ; \ |
|
else \ |
|
true ; \ |
|
fi |
|
.endif |
.endif |
|
|
realinstall: beforeinstall |
realinstall: |
ranlib lib${LIB}.a |
# ranlib lib${LIB}.a |
install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} lib${LIB}.a \ |
install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \ |
${DESTDIR}${LIBDIR} |
${DESTDIR}${LIBDIR} |
${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a |
${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a |
ranlib lib${LIB}_p.a |
chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a |
install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
.if !defined(NOPROFILE) |
|
# ranlib lib${LIB}_p.a |
|
install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \ |
lib${LIB}_p.a ${DESTDIR}${LIBDIR} |
lib${LIB}_p.a ${DESTDIR}${LIBDIR} |
${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
# install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a |
# llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} |
.endif |
|
.if !defined(NOPIC) |
|
# ranlib lib${LIB}_pic.a |
|
install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \ |
|
lib${LIB}_pic.a ${DESTDIR}${LIBDIR} |
|
${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
|
chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a |
|
.endif |
|
.if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR) |
|
install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
|
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR} |
|
.endif |
|
.if !defined(NOLINT) |
|
install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
|
llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR} |
|
.endif |
.if defined(LINKS) && !empty(LINKS) |
.if defined(LINKS) && !empty(LINKS) |
@set ${LINKS}; \ |
@set ${LINKS}; \ |
while test $$# -ge 2; do \ |
while test $$# -ge 2; do \ |
Line 134 realinstall: beforeinstall |
|
Line 206 realinstall: beforeinstall |
|
done; true |
done; true |
.endif |
.endif |
|
|
install: afterinstall |
install: maninstall _SUBDIRUSE |
afterinstall: realinstall maninstall |
maninstall: afterinstall |
|
afterinstall: realinstall |
|
realinstall: beforeinstall |
.endif |
.endif |
|
|
.if !target(lint) |
.if !defined(NOMAN) |
lint: |
.include <bsd.man.mk> |
.endif |
.endif |
|
|
.if !target(tags) |
.if !defined(NONLS) |
tags: ${SRCS} |
.include <bsd.nls.mk> |
-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \ |
|
sed "s;\${.CURDIR}/;;" > tags |
|
.endif |
.endif |
|
|
.include <bsd.man.mk> |
.include <bsd.obj.mk> |
.if !target(obj) |
.include <bsd.dep.mk> |
.if defined(NOOBJ) |
.include <bsd.subdir.mk> |
obj: |
.include <bsd.sys.mk> |
.else |
|
obj: |
|
@cd ${.CURDIR}; rm -f obj > /dev/null 2>&1 || true; \ |
|
here=`pwd`; subdir=`echo $$here | sed 's,^/usr/src/,,'`; \ |
|
if test $$here != $$subdir ; then \ |
|
dest=/usr/obj/$$subdir ; \ |
|
echo "$$here -> $$dest"; ln -s $$dest obj; \ |
|
if test -d /usr/obj -a ! -d $$dest; then \ |
|
mkdir -p $$dest; \ |
|
else \ |
|
true; \ |
|
fi; \ |
|
else \ |
|
true ; \ |
|
dest=$$here/obj ; \ |
|
echo "making $$here/obj" ; \ |
|
if test ! -d obj ; then \ |
|
mkdir $$here/obj; \ |
|
fi; \ |
|
fi; |
|
.endif |
|
.endif |
|