1994-08-04 23:09:27 +02:00
|
|
|
# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
|
1997-05-23 19:50:35 +02:00
|
|
|
# $Id: bsd.lib.mk,v 1.56 1997/05/23 08:38:46 asami Exp $
|
1994-08-04 23:09:27 +02:00
|
|
|
#
|
1994-05-30 21:09:18 +02:00
|
|
|
|
|
|
|
.if exists(${.CURDIR}/../Makefile.inc)
|
|
|
|
.include "${.CURDIR}/../Makefile.inc"
|
|
|
|
.endif
|
|
|
|
|
1994-08-04 23:09:27 +02: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 10:38:46 +02:00
|
|
|
CXXINCLUDES+= -I${DESTDIR}/usr/include/g++
|
1994-08-04 23:09:27 +02:00
|
|
|
.endif
|
1994-08-28 17:37:40 +02:00
|
|
|
|
1994-09-16 16:30:25 +02:00
|
|
|
.if defined(DEBUG_FLAGS)
|
|
|
|
CFLAGS+= ${DEBUG_FLAGS}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !defined(DEBUG_FLAGS)
|
1994-05-30 21:09:18 +02:00
|
|
|
STRIP?= -s
|
1994-09-16 16:30:25 +02:00
|
|
|
.endif
|
1994-05-30 21:09:18 +02:00
|
|
|
|
1996-09-28 08:01:01 +02:00
|
|
|
.include <bsd.libnames.mk>
|
|
|
|
|
1994-05-30 21:09:18 +02:00
|
|
|
.MAIN: all
|
|
|
|
|
|
|
|
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
|
1994-08-04 23:09:27 +02:00
|
|
|
# .so used for PIC object files
|
1994-05-30 21:09:18 +02:00
|
|
|
.SUFFIXES:
|
1994-08-04 23:09:27 +02:00
|
|
|
.SUFFIXES: .out .o .po .so .s .S .c .cc .cxx .m .C .f .y .l
|
1994-05-30 21:09:18 +02:00
|
|
|
|
|
|
|
.c.o:
|
1994-08-04 23:09:27 +02:00
|
|
|
${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-05-30 21:09:18 +02:00
|
|
|
|
|
|
|
.c.po:
|
1997-04-09 22:31:15 +02:00
|
|
|
${CC} -pg ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-05-30 21:09:18 +02:00
|
|
|
|
1994-08-04 23:09:27 +02:00
|
|
|
.c.so:
|
|
|
|
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
1996-06-03 15:26:16 +02:00
|
|
|
.cc.o .C.o .cxx.o:
|
1994-08-04 23:09:27 +02:00
|
|
|
${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
1996-06-03 15:26:16 +02:00
|
|
|
.cc.po .C.po .cxx.po:
|
1997-04-09 22:31:15 +02:00
|
|
|
${CXX} -pg ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
1996-06-03 15:26:16 +02:00
|
|
|
.cc.so .C.so .cxx.so:
|
1994-08-04 23:09:27 +02:00
|
|
|
${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.f.o:
|
|
|
|
${FC} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.f.po:
|
1997-04-09 22:31:15 +02:00
|
|
|
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.f.so:
|
|
|
|
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
1994-05-30 21:09:18 +02:00
|
|
|
.s.o:
|
1997-02-14 02:42:29 +01:00
|
|
|
${CC} -x assembler-with-cpp ${CFLAGS:M-[ID]*} ${AINC} -c \
|
1996-08-11 14:24:44 +02:00
|
|
|
${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-05-30 21:09:18 +02:00
|
|
|
|
|
|
|
.s.po:
|
1996-08-11 14:24:44 +02:00
|
|
|
${CC} -x assembler-with-cpp -DPROF ${CFLAGS:M-[ID]*} ${AINC} -c \
|
|
|
|
${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-05-30 21:09:18 +02:00
|
|
|
|
1994-08-04 23:09:27 +02:00
|
|
|
.s.so:
|
1996-08-11 14:24:44 +02:00
|
|
|
${CC} -x assembler-with-cpp -fpic -DPIC ${CFLAGS:M-[ID]*} ${AINC} -c \
|
|
|
|
${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.S.o:
|
1996-08-11 14:24:44 +02:00
|
|
|
${CC} ${CFLAGS:M-[ID]*} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
1997-04-23 12:26:18 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.S.po:
|
1996-08-11 14:24:44 +02:00
|
|
|
${CC} -DPROF ${CFLAGS:M-[ID]*} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
1997-04-23 12:26:18 +02:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.S.so:
|
1996-08-11 14:24:44 +02:00
|
|
|
${CC} -fpic -DPIC ${CFLAGS:M-[ID]*} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.m.o:
|
1996-09-19 09:01:45 +02:00
|
|
|
${CC} ${CFLAGS} -fgnu-runtime -c ${.IMPSRC} -o ${.TARGET}
|
1997-04-23 12:26:18 +02:00
|
|
|
@${LD} -O ${.TARGET} -x -r ${.TARGET}
|
|
|
|
|
|
|
|
.m.po:
|
|
|
|
${CC} ${CFLAGS} -fgnu-runtime -pg -c ${.IMPSRC} -o ${.TARGET}
|
1996-05-28 18:20:13 +02:00
|
|
|
@${LD} -O ${.TARGET} -X -r ${.TARGET}
|
1994-05-30 21:09:18 +02:00
|
|
|
|
1994-09-19 00:22:32 +02:00
|
|
|
.if !defined(INTERNALLIB) || defined(INTERNALSTATICLIB)
|
1994-09-19 00:06:04 +02:00
|
|
|
.if !defined(NOPROFILE) && !defined(INTERNALLIB)
|
1994-05-30 21:09:18 +02:00
|
|
|
_LIBS=lib${LIB}.a lib${LIB}_p.a
|
|
|
|
.else
|
|
|
|
_LIBS=lib${LIB}.a
|
|
|
|
.endif
|
1994-09-19 00:22:32 +02:00
|
|
|
.endif
|
1994-05-30 21:09:18 +02:00
|
|
|
|
1994-08-04 23:09:27 +02: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 21:09:18 +02:00
|
|
|
.endif
|
|
|
|
|
1996-09-18 08:09:19 +02:00
|
|
|
all: objwarn ${_LIBS} all-man _SUBDIR # llib-l${LIB}.ln
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
|
1994-05-30 21:09:18 +02:00
|
|
|
|
|
|
|
lib${LIB}.a:: ${OBJS}
|
1994-08-28 17:37:40 +02:00
|
|
|
@${ECHO} building standard ${LIB} library
|
1994-05-30 21:09:18 +02:00
|
|
|
@rm -f lib${LIB}.a
|
1996-08-03 08:43:05 +02:00
|
|
|
@${AR} cq lib${LIB}.a `lorder ${OBJS} | tsort -q` ${ARADD}
|
1994-08-04 23:09:27 +02:00
|
|
|
${RANLIB} lib${LIB}.a
|
1994-05-30 21:09:18 +02:00
|
|
|
|
1994-10-25 18:55:25 +01:00
|
|
|
.if !defined(NOPROFILE)
|
1994-05-30 21:09:18 +02:00
|
|
|
POBJS+= ${OBJS:.o=.po}
|
|
|
|
lib${LIB}_p.a:: ${POBJS}
|
1994-08-28 17:37:40 +02:00
|
|
|
@${ECHO} building profiled ${LIB} library
|
1994-05-30 21:09:18 +02:00
|
|
|
@rm -f lib${LIB}_p.a
|
1996-08-03 08:43:05 +02:00
|
|
|
@${AR} cq lib${LIB}_p.a `lorder ${POBJS} | tsort -q` ${ARADD}
|
1994-08-04 23:09:27 +02:00
|
|
|
${RANLIB} lib${LIB}_p.a
|
1994-10-25 18:55:25 +01:00
|
|
|
.endif
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
.if defined(DESTDIR)
|
1997-05-04 23:30:40 +02:00
|
|
|
LDDESTDIRENV?= LIBRARY_PATH=${DESTDIR}${SHLIBDIR}:${DESTDIR}/usr/lib
|
1994-08-04 23:09:27 +02:00
|
|
|
.endif
|
|
|
|
|
1994-10-25 18:55:25 +01:00
|
|
|
.if !defined(NOPIC)
|
1994-08-04 23:09:27 +02:00
|
|
|
SOBJS+= ${OBJS:.o=.so}
|
|
|
|
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}: ${SOBJS}
|
1994-08-28 17:37:40 +02:00
|
|
|
@${ECHO} building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
|
1994-08-04 23:09:27 +02:00
|
|
|
@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
|
1997-05-23 19:50:35 +02:00
|
|
|
@${LDDESTDIRENV} ${CC} -shared -Wl,-x -Wl,-assert -Wl,pure-text \
|
1994-08-04 23:09:27 +02:00
|
|
|
-o lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
1996-08-03 08:43:05 +02:00
|
|
|
`lorder ${SOBJS} | tsort -q` ${LDDESTDIR} ${LDADD}
|
1994-08-04 23:09:27 +02:00
|
|
|
|
|
|
|
lib${LIB}_pic.a:: ${SOBJS}
|
1994-08-28 17:37:40 +02:00
|
|
|
@${ECHO} building special pic ${LIB} library
|
1994-08-04 23:09:27 +02:00
|
|
|
@rm -f lib${LIB}_pic.a
|
1994-12-28 01:49:58 +01:00
|
|
|
@${AR} cq lib${LIB}_pic.a ${SOBJS} ${ARADD}
|
1994-08-04 23:09:27 +02:00
|
|
|
${RANLIB} lib${LIB}_pic.a
|
1994-10-25 18:55:25 +01:00
|
|
|
.endif
|
1994-05-30 21:09:18 +02:00
|
|
|
|
|
|
|
llib-l${LIB}.ln: ${SRCS}
|
|
|
|
${LINT} -C${LIB} ${CFLAGS} ${.ALLSRC:M*.c}
|
|
|
|
|
|
|
|
.if !target(clean)
|
1996-06-24 06:26:21 +02:00
|
|
|
clean: _SUBDIR
|
1994-08-04 23:09:27 +02: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 05:12:49 +02:00
|
|
|
.if defined(CLEANDIRS) && !empty(CLEANDIRS)
|
1996-06-17 17:59:52 +02:00
|
|
|
rm -rf ${CLEANDIRS}
|
|
|
|
.endif
|
1994-05-30 21:09:18 +02:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 23:09:27 +02:00
|
|
|
.if defined(SRCS)
|
1997-04-09 18:10:27 +02: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 23:30:40 +02:00
|
|
|
`${LDDESTDIRENV} ${CC} -shared -Wl,-f ${LDDESTDIR} ${LDADD}` \
|
|
|
|
>> ${DEPENDFILE}
|
1994-05-30 21:09:18 +02:00
|
|
|
|
|
|
|
.if !target(install)
|
|
|
|
.if !target(beforeinstall)
|
|
|
|
beforeinstall:
|
|
|
|
.endif
|
|
|
|
|
1994-08-26 20:58:10 +02:00
|
|
|
.if defined(PRECIOUSLIB)
|
|
|
|
SHLINSTALLFLAGS+= -fschg
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 21:09:18 +02:00
|
|
|
realinstall: beforeinstall
|
1994-08-26 20:58:10 +02:00
|
|
|
.if !defined(INTERNALLIB)
|
1994-08-10 04:48:08 +02:00
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
|
|
|
${INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
|
1994-05-30 21:09:18 +02:00
|
|
|
.if !defined(NOPROFILE)
|
1994-08-04 23:09:27 +02:00
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1994-08-10 04:48:08 +02:00
|
|
|
${INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
|
1994-05-30 21:09:18 +02:00
|
|
|
.endif
|
1994-08-26 20:58:10 +02:00
|
|
|
.endif
|
1994-08-04 23:09:27 +02:00
|
|
|
.if !defined(NOPIC)
|
|
|
|
.if defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
|
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1994-08-26 20:58:10 +02:00
|
|
|
${INSTALLFLAGS} ${SHLINSTALLFLAGS} \
|
|
|
|
lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
|
1994-11-14 05:55:39 +01:00
|
|
|
${DESTDIR}${SHLIBDIR}
|
1994-08-04 23:09:27 +02:00
|
|
|
.endif
|
|
|
|
.if defined(INSTALL_PIC_ARCHIVE)
|
|
|
|
${INSTALL} ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1994-08-10 04:48:08 +02:00
|
|
|
${INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
|
1994-08-04 23:09:27 +02:00
|
|
|
.endif
|
|
|
|
.endif
|
1994-05-30 21:09:18 +02:00
|
|
|
.if defined(LINKS) && !empty(LINKS)
|
|
|
|
@set ${LINKS}; \
|
|
|
|
while test $$# -ge 2; do \
|
|
|
|
l=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
|
|
|
t=${DESTDIR}$$1; \
|
|
|
|
shift; \
|
1994-08-28 17:37:40 +02:00
|
|
|
${ECHO} $$t -\> $$l; \
|
1994-05-30 21:09:18 +02:00
|
|
|
rm -f $$t; \
|
1995-01-30 08:22:02 +01:00
|
|
|
ln ${LN_FLAGS} $$l $$t; \
|
1994-05-30 21:09:18 +02:00
|
|
|
done; true
|
|
|
|
.endif
|
|
|
|
|
1996-06-24 06:26:21 +02:00
|
|
|
install: afterinstall _SUBDIR
|
1994-05-30 21:09:18 +02:00
|
|
|
.if !defined(NOMAN)
|
1994-08-04 23:09:27 +02:00
|
|
|
afterinstall: realinstall maninstall
|
|
|
|
.else
|
|
|
|
afterinstall: realinstall
|
1994-05-30 21:09:18 +02:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1995-01-14 08:51:10 +01:00
|
|
|
DISTRIBUTION?= bin
|
1994-11-13 22:05:28 +01:00
|
|
|
.if !target(distribute)
|
1996-06-24 06:26:21 +02:00
|
|
|
distribute: _SUBDIR
|
1995-02-25 21:51:14 +01:00
|
|
|
cd ${.CURDIR} ; $(MAKE) install DESTDIR=${DISTDIR}/${DISTRIBUTION} SHARED=copies
|
1994-11-13 22:05:28 +01:00
|
|
|
.endif
|
|
|
|
|
1994-05-30 21:09:18 +02:00
|
|
|
.if !target(lint)
|
|
|
|
lint:
|
|
|
|
.endif
|
|
|
|
|
1997-04-13 08:44:25 +02:00
|
|
|
.if defined(NOTAGS)
|
|
|
|
tags:
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 21:09:18 +02:00
|
|
|
.if !target(tags)
|
1996-06-24 06:26:21 +02:00
|
|
|
tags: ${SRCS} _SUBDIR
|
1997-04-13 08:44:25 +02:00
|
|
|
@cd ${.CURDIR} && gtags ${GTAGSFLAGS}
|
|
|
|
.if defined(HTML)
|
|
|
|
@cd ${.CURDIR} && htags ${HTAGSFLAGS}
|
|
|
|
.endif
|
1994-05-30 21:09:18 +02:00
|
|
|
.endif
|
|
|
|
|
1994-08-04 23:09:27 +02:00
|
|
|
.if !defined(NOMAN)
|
1994-05-30 21:09:18 +02:00
|
|
|
.include <bsd.man.mk>
|
1994-08-04 23:09:27 +02:00
|
|
|
.elif !target(maninstall)
|
|
|
|
maninstall:
|
1995-10-02 21:02:05 +01:00
|
|
|
all-man:
|
1994-08-04 23:09:27 +02:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.include <bsd.dep.mk>
|
1996-06-24 06:26:21 +02:00
|
|
|
.include <bsd.obj.mk>
|