1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
|
1997-06-21 15:40:34 +00:00
|
|
|
# $Id: bsd.lib.mk,v 1.58 1997/06/18 03:39:34 asami 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
|
1997-05-23 08:38:46 +00:00
|
|
|
CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
|
1994-08-04 21:09:27 +00:00
|
|
|
.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
|
|
|
|
1996-09-28 06:01:01 +00:00
|
|
|
.include <bsd.libnames.mk>
|
|
|
|
|
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:
|
1997-04-09 20:31:15 +00:00
|
|
|
${CC} -pg ${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
|
|
|
|
1996-06-03 13:26:16 +00:00
|
|
|
.cc.o .C.o .cxx.o:
|
1994-08-04 21:09:27 +00:00
|
|
|
${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
|
|
|
|
1996-06-03 13:26:16 +00:00
|
|
|
.cc.po .C.po .cxx.po:
|
1997-04-09 20:31:15 +00:00
|
|
|
${CXX} -pg ${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
|
|
|
|
1996-06-03 13:26:16 +00:00
|
|
|
.cc.so .C.so .cxx.so:
|
1994-08-04 21:09:27 +00:00
|
|
|
${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:
|
1997-04-09 20:31:15 +00:00
|
|
|
${FC} -pg ${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:
|
1997-06-18 03:39:34 +00:00
|
|
|
${CC} -x assembler-with-cpp ${CFLAGS:M-[BID]*} ${AINC} -c \
|
1996-08-11 12:24:44 +00:00
|
|
|
${.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
|
|
|
|
|
|
|
.s.po:
|
1997-06-18 03:39:34 +00:00
|
|
|
${CC} -x assembler-with-cpp -DPROF ${CFLAGS:M-[BID]*} ${AINC} -c \
|
1996-08-11 12:24:44 +00:00
|
|
|
${.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
|
|
|
.s.so:
|
1997-06-18 03:39:34 +00:00
|
|
|
${CC} -x assembler-with-cpp -fpic -DPIC ${CFLAGS:M-[BID]*} ${AINC} -c \
|
1996-08-11 12:24:44 +00:00
|
|
|
${.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
|
|
|
|
|
|
|
.S.o:
|
1997-06-18 03:39:34 +00:00
|
|
|
${CC} ${CFLAGS:M-[BID]*} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
1997-04-23 10:26:18 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.S.po:
|
1997-06-18 03:39:34 +00:00
|
|
|
${CC} -DPROF ${CFLAGS:M-[BID]*} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
1997-04-23 10:26:18 +00:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.S.so:
|
1997-06-18 03:39:34 +00:00
|
|
|
${CC} -fpic -DPIC ${CFLAGS:M-[BID]*} ${AINC} -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:
|
1996-09-19 07:01:45 +00:00
|
|
|
${CC} ${CFLAGS} -fgnu-runtime -c ${.IMPSRC} -o ${.TARGET}
|
1997-04-23 10:26:18 +00:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
|
|
|
|
|
|
|
.m.po:
|
|
|
|
${CC} ${CFLAGS} -fgnu-runtime -pg -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
|
|
|
|
|
1996-09-18 06:09:19 +00:00
|
|
|
all: objwarn ${_LIBS} all-man _SUBDIR # 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
|
1996-08-03 06:43:05 +00:00
|
|
|
@${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort -q` ${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
|
1996-08-03 06:43:05 +00:00
|
|
|
@${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort -q` ${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)
|
1997-05-04 21:30:40 +00:00
|
|
|
LDDESTDIRENV?= LIBRARY_PATH=${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
|
|
|
|
1994-10-25 17:55:25 +00:00
|
|
|
.if !defined(NOPIC)
|
1994-08-04 21:09:27 +00:00
|
|
|
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}
|
1997-05-23 17:50:35 +00:00
|
|
|
@${LDDESTDIRENV} ${CC} -shared -Wl,-x -Wl,-assert -Wl,pure-text \
|
1994-08-04 21:09:27 +00:00
|
|
|
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
1996-08-03 06:43:05 +00:00
|
|
|
`lorder ${SOBJS} | tsort -q` ${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)
|
1996-06-24 04:26:21 +00:00
|
|
|
clean: _SUBDIR
|
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
|
1996-06-29 03:12:49 +00:00
|
|
|
.if defined(CLEANDIRS) && !empty(CLEANDIRS)
|
1996-06-17 15:59:52 +00:00
|
|
|
rm -rf ${CLEANDIRS}
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.if defined(SRCS)
|
1997-04-09 16:10:27 +00:00
|
|
|
_EXTRADEPEND::
|
|
|
|
@TMP=_depend$$$$; \
|
|
|
|
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so:/' < ${DEPENDFILE} \
|
|
|
|
> $$TMP; \
|
|
|
|
mv $$TMP ${DEPENDFILE}
|
|
|
|
.endif
|
|
|
|
_EXTRADEPEND::
|
|
|
|
echo lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: \
|
1997-05-04 21:30:40 +00:00
|
|
|
`${LDDESTDIRENV} ${CC} -shared -Wl,-f ${LDDESTDIR} ${LDADD}` \
|
|
|
|
>> ${DEPENDFILE}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.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
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
install: afterinstall _SUBDIR
|
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)
|
1996-06-24 04:26:21 +00:00
|
|
|
distribute: _SUBDIR
|
1997-06-21 15:40:34 +00:00
|
|
|
.for dist in ${DISTRIBUTION}
|
|
|
|
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${dist} SHARED=copies
|
|
|
|
.endfor
|
1994-11-13 21:05:28 +00:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(lint)
|
|
|
|
lint:
|
|
|
|
.endif
|
|
|
|
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(NOTAGS)
|
|
|
|
tags:
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.if !target(tags)
|
1996-06-24 04:26:21 +00:00
|
|
|
tags: ${SRCS} _SUBDIR
|
1997-04-13 06:44:25 +00:00
|
|
|
@cd ${.CURDIR} && gtags ${GTAGSFLAGS}
|
|
|
|
.if defined(HTML)
|
|
|
|
@cd ${.CURDIR} && htags ${HTAGSFLAGS}
|
|
|
|
.endif
|
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
|
|
|
|
|
|
|
|
.include <bsd.dep.mk>
|
1996-06-24 04:26:21 +00:00
|
|
|
.include <bsd.obj.mk>
|