1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
|
1996-05-28 16:20:13 +00:00
|
|
|
# $Id: bsd.lib.mk,v 1.32 1996/05/09 13:01:42 phk Exp $
|
1994-08-04 21:09:27 +00:00
|
|
|
#
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if exists(${.CURDIR}/shlib_version)
|
|
|
|
SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
|
|
|
|
SHLIB_MINOR != . ${.CURDIR}/shlib_version ; echo $$minor
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(DESTDIR)
|
|
|
|
CFLAGS+= -I${DESTDIR}/usr/include
|
|
|
|
CXXINCLUDES+= -I${DESTDIR}/usr/include/${CXX}
|
|
|
|
.endif
|
1994-08-28 15:37:40 +00:00
|
|
|
|
1994-09-16 14:30:25 +00:00
|
|
|
.if defined(DEBUG_FLAGS)
|
|
|
|
CFLAGS+= ${DEBUG_FLAGS}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(DEBUG_FLAGS)
|
1994-05-30 19:09:18 +00:00
|
|
|
STRIP?= -s
|
1994-09-16 14:30:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.MAIN: all
|
|
|
|
|
|
|
|
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
|
1994-08-04 21:09:27 +00:00
|
|
|
# .so used for PIC object files
|
1994-05-30 19:09:18 +00:00
|
|
|
.SUFFIXES:
|
1994-08-04 21:09:27 +00:00
|
|
|
.SUFFIXES: .out .o .po .so .s .S .c .cc .cxx .m .C .f .y .l
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.c.o:
|
1994-08-04 21:09:27 +00:00
|
|
|
${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.c.po:
|
|
|
|
${CC} -p ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.c.so:
|
|
|
|
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.cc.o .cxx.o .C.o:
|
|
|
|
${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.cc.po .C.po .cxx.o:
|
|
|
|
${CXX} -p ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.cc.so .C.so:
|
|
|
|
${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.f.o:
|
|
|
|
${FC} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.f.po:
|
|
|
|
${FC} -p ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.f.so:
|
|
|
|
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.s.o:
|
|
|
|
${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
|
|
|
|
${AS} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.s.po:
|
|
|
|
${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
|
|
|
|
${AS} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.s.so:
|
|
|
|
${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
|
|
|
|
${AS} -k -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.S.o:
|
|
|
|
${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
|
|
|
|
${AS} -o ${.TARGET}
|
|
|
|
|
|
|
|
.S.po:
|
|
|
|
${CPP} -E -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
|
|
|
|
${AS} -o ${.TARGET}
|
|
|
|
|
|
|
|
.S.so:
|
|
|
|
${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
|
|
|
|
${AS} -k -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.m.po:
|
|
|
|
${CC} ${CFLAGS} -p -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.m.o:
|
|
|
|
${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 16:20:13 +00:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-09-18 22:22:32 +00:00
|
|
|
.if !defined(INTERNALLIB) || defined(INTERNALSTATICLIB)
|
1994-09-18 22:06:04 +00:00
|
|
|
.if !defined(NOPROFILE) && !defined(INTERNALLIB)
|
1994-05-30 19:09:18 +00:00
|
|
|
_LIBS=lib${LIB}.a lib${LIB}_p.a
|
|
|
|
.else
|
|
|
|
_LIBS=lib${LIB}.a
|
|
|
|
.endif
|
1994-09-18 22:22:32 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if !defined(NOPIC)
|
|
|
|
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
|
|
|
|
_LIBS+=lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
|
|
|
.endif
|
|
|
|
.if defined(INSTALL_PIC_ARCHIVE)
|
|
|
|
_LIBS+=lib${LIB}_pic.a
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(PICFLAG)
|
|
|
|
PICFLAG=-fpic
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
1995-01-14 22:14:54 +00:00
|
|
|
_LIBSUBDIR: .USE
|
|
|
|
.if defined(SUBDIR) && !empty(SUBDIR)
|
|
|
|
@for entry in ${SUBDIR}; do \
|
|
|
|
(${ECHODIR} "===> ${DIRPRFX}$$entry"; \
|
|
|
|
if test -d ${.CURDIR}/$${entry}.${MACHINE}; then \
|
|
|
|
cd ${.CURDIR}/$${entry}.${MACHINE}; \
|
|
|
|
else \
|
|
|
|
cd ${.CURDIR}/$${entry}; \
|
|
|
|
fi; \
|
|
|
|
${MAKE} ${.TARGET:S/realinstall/install/:S/.depend/depend/} DIRPRFX=${DIRPRFX}$$entry/); \
|
|
|
|
done
|
|
|
|
.endif
|
|
|
|
|
1995-10-02 20:02:05 +00:00
|
|
|
all: ${_LIBS} all-man _LIBSUBDIR # llib-l${LIB}.ln
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
lib${LIB}.a:: ${OBJS}
|
1994-08-28 15:37:40 +00:00
|
|
|
@${ECHO} building standard ${LIB} library
|
1994-05-30 19:09:18 +00:00
|
|
|
@rm -f lib${LIB}.a
|
1994-12-28 00:49:58 +00:00
|
|
|
@${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort` ${ARADD}
|
1994-08-04 21:09:27 +00:00
|
|
|
${RANLIB} lib${LIB}.a
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1994-10-25 17:55:25 +00:00
|
|
|
.if !defined(NOPROFILE)
|
1994-05-30 19:09:18 +00:00
|
|
|
POBJS+= ${OBJS:.o=.po}
|
|
|
|
lib${LIB}_p.a:: ${POBJS}
|
1994-08-28 15:37:40 +00:00
|
|
|
@${ECHO} building profiled ${LIB} library
|
1994-05-30 19:09:18 +00:00
|
|
|
@rm -f lib${LIB}_p.a
|
1994-12-28 00:49:58 +00:00
|
|
|
@${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort` ${ARADD}
|
1994-08-04 21:09:27 +00:00
|
|
|
${RANLIB} lib${LIB}_p.a
|
1994-10-25 17:55:25 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.if defined(DESTDIR)
|
|
|
|
LDDESTDIR?= -L${DESTDIR}/usr/lib
|
|
|
|
.endif
|
|
|
|
|
1994-10-25 17:55:25 +00:00
|
|
|
.if !defined(NOPIC)
|
1996-01-21 17:26:25 +00:00
|
|
|
.if defined(CPLUSPLUSLIB) && !make(clean) && !make(cleandir)
|
1994-08-04 21:09:27 +00:00
|
|
|
SOBJS+= ${DESTDIR}/usr/lib/c++rt0.o
|
|
|
|
.endif
|
|
|
|
|
|
|
|
SOBJS+= ${OBJS:.o=.so}
|
|
|
|
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS}
|
1994-08-28 15:37:40 +00:00
|
|
|
@${ECHO} building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
|
1994-08-04 21:09:27 +00:00
|
|
|
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
1996-04-21 17:45:38 +00:00
|
|
|
@${LD} -Bshareable -x \
|
1994-08-04 21:09:27 +00:00
|
|
|
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
1995-08-02 22:31:52 +00:00
|
|
|
`lorder ${SOBJS} | tsort` ${LDDESTDIR} ${LDADD}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
lib${LIB}_pic.a:: ${SOBJS}
|
1994-08-28 15:37:40 +00:00
|
|
|
@${ECHO} building special pic ${LIB} library
|
1994-08-04 21:09:27 +00:00
|
|
|
@rm -f lib${LIB}_pic.a
|
1994-12-28 00:49:58 +00:00
|
|
|
@${AR} cq lib${LIB}_pic.a ${SOBJS} ${ARADD}
|
1994-08-04 21:09:27 +00:00
|
|
|
${RANLIB} lib${LIB}_pic.a
|
1994-10-25 17:55:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
llib-l${LIB}.ln: ${SRCS}
|
|
|
|
${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
|
|
|
|
|
|
|
|
.if !target(clean)
|
1995-01-14 22:18:15 +00:00
|
|
|
clean: _LIBSUBDIR
|
1994-08-04 21:09:27 +00:00
|
|
|
rm -f a.out Errs errs mklog ${CLEANFILES} ${OBJS}
|
|
|
|
rm -f lib${LIB}.a llib-l${LIB}.ln
|
|
|
|
rm -f ${POBJS} profiled/*.o lib${LIB}_p.a
|
|
|
|
rm -f ${SOBJS} shared/*.o
|
|
|
|
rm -f lib${LIB}.so.*.* lib${LIB}_pic.a
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(cleandir)
|
1995-01-14 22:18:15 +00:00
|
|
|
cleandir: _LIBSUBDIR
|
1994-08-04 21:09:27 +00:00
|
|
|
rm -f a.out Errs errs mklog ${CLEANFILES} ${OBJS}
|
|
|
|
rm -f lib${LIB}.a llib-l${LIB}.ln
|
|
|
|
rm -f ${.CURDIR}/tags .depend
|
|
|
|
rm -f ${POBJS} profiled/*.o lib${LIB}_p.a
|
|
|
|
rm -f ${SOBJS} shared/*.o
|
|
|
|
rm -f lib${LIB}.so.*.* lib${LIB}_pic.a
|
|
|
|
cd ${.CURDIR}; rm -rf obj;
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
afterdepend:
|
1994-05-30 19:09:18 +00:00
|
|
|
@(TMP=/tmp/_depend$$$$; \
|
1994-08-04 21:09:27 +00:00
|
|
|
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < .depend > $$TMP; \
|
|
|
|
mv $$TMP .depend)
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
|
1994-08-26 18:58:10 +00:00
|
|
|
.if defined(PRECIOUSLIB)
|
|
|
|
SHLINSTALLFLAGS+= -fschg
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
realinstall: beforeinstall
|
1994-08-26 18:58:10 +00:00
|
|
|
.if !defined(INTERNALLIB)
|
1994-08-10 02:48:08 +00:00
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
|
|
|
${INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !defined(NOPROFILE)
|
1994-08-04 21:09:27 +00:00
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1994-08-10 02:48:08 +00:00
|
|
|
${INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
1994-08-26 18:58:10 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
.if !defined(NOPIC)
|
|
|
|
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
|
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1994-08-26 18:58:10 +00:00
|
|
|
${INSTALLFLAGS} ${SHLINSTALLFLAGS} \
|
|
|
|
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
1994-11-14 04:55:39 +00:00
|
|
|
${DESTDIR}${SHLIBDIR}
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
|
|
|
.if defined(INSTALL_PIC_ARCHIVE)
|
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1994-08-10 02:48:08 +00:00
|
|
|
${INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
.if defined(LINKS) && !empty(LINKS)
|
|
|
|
@set ${LINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
|
|
|
l=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
t=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
1994-08-28 15:37:40 +00:00
|
|
|
${ECHO} $$t -\> $$l; \
|
1994-05-30 19:09:18 +00:00
|
|
|
rm -f $$t; \
|
1995-01-30 07:22:02 +00:00
|
|
|
ln ${LN_FLAGS} $$l $$t; \
|
1994-05-30 19:09:18 +00:00
|
|
|
done; true
|
|
|
|
.endif
|
|
|
|
|
1995-01-14 22:18:15 +00:00
|
|
|
install: afterinstall _LIBSUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !defined(NOMAN)
|
1994-08-04 21:09:27 +00:00
|
|
|
afterinstall: realinstall maninstall
|
|
|
|
.else
|
|
|
|
afterinstall: realinstall
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1995-01-14 07:51:10 +00:00
|
|
|
DISTRIBUTION?= bin
|
1994-11-13 21:05:28 +00:00
|
|
|
.if !target(distribute)
|
1995-01-14 22:18:15 +00:00
|
|
|
distribute: _LIBSUBDIR
|
1995-02-25 20:51:14 +00:00
|
|
|
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
|
1994-11-13 21:05:28 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(lint)
|
|
|
|
lint:
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(tags)
|
|
|
|
tags: ${SRCS}
|
1994-08-04 21:09:27 +00:00
|
|
|
-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:M*.c} | \
|
|
|
|
sed "s;\${.CURDIR}/;;" > tags
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if !defined(NOMAN)
|
1994-05-30 19:09:18 +00:00
|
|
|
.include <bsd.man.mk>
|
1994-08-04 21:09:27 +00:00
|
|
|
.elif !target(maninstall)
|
|
|
|
maninstall:
|
1995-10-02 20:02:05 +00:00
|
|
|
all-man:
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(obj)
|
|
|
|
.if defined(NOOBJ)
|
1995-01-14 22:18:15 +00:00
|
|
|
obj: _LIBSUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
.else
|
1995-01-14 22:18:15 +00:00
|
|
|
obj: _LIBSUBDIR
|
1994-05-30 19:09:18 +00:00
|
|
|
@cd ${.CURDIR}; rm -rf obj; \
|
1994-08-04 21:09:27 +00:00
|
|
|
here=`pwd`; dest=/usr/obj`echo $$here | sed 's,^/usr/src,,'`; \
|
1994-08-28 15:37:40 +00:00
|
|
|
${ECHO} "$$here -> $$dest"; ln -s $$dest obj; \
|
1994-05-30 19:09:18 +00:00
|
|
|
if test -d /usr/obj -a ! -d $$dest; then \
|
|
|
|
mkdir -p $$dest; \
|
|
|
|
else \
|
|
|
|
true; \
|
|
|
|
fi;
|
|
|
|
.endif
|
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1995-02-08 21:35:31 +00:00
|
|
|
_DEPSUBDIR= _LIBSUBDIR
|
1994-08-04 21:09:27 +00:00
|
|
|
.include <bsd.dep.mk>
|