1994-08-04 21:09:27 +00:00
|
|
|
# from: @(#)bsd.lib.mk 5.26 (Berkeley) 5/2/91
|
1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1994-08-04 21:09:27 +00:00
|
|
|
#
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-17 13:49:29 +00:00
|
|
|
.include <bsd.init.mk>
|
1994-05-30 19:09:18 +00:00
|
|
|
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
# Set up the variables controlling shared libraries. After this section,
|
|
|
|
# SHLIB_NAME will be defined only if we are to create a shared library.
|
|
|
|
# SHLIB_LINK will be defined only if we are to create a link to it.
|
|
|
|
# INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive.
|
|
|
|
.if defined(NOPIC)
|
|
|
|
.undef SHLIB_NAME
|
|
|
|
.undef INSTALL_PIC_ARCHIVE
|
|
|
|
.else
|
2002-07-03 16:22:43 +00:00
|
|
|
.if !defined(SHLIB_NAME) && defined(LIB) && defined(SHLIB_MAJOR)
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
SHLIB_NAME= lib${LIB}.so.${SHLIB_MAJOR}
|
2002-07-18 17:44:20 +00:00
|
|
|
.endif
|
2002-07-19 18:40:13 +00:00
|
|
|
.if defined(SHLIB_NAME) && ${SHLIB_NAME:M*.so.*}
|
2002-07-18 17:44:20 +00:00
|
|
|
SHLIB_LINK?= ${SHLIB_NAME:R}
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
.endif
|
|
|
|
SONAME?= ${SHLIB_NAME}
|
1997-09-05 11:45:15 +00:00
|
|
|
.endif
|
|
|
|
|
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
|
|
|
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
|
1999-01-09 21:51:00 +00:00
|
|
|
# .So used for PIC object files
|
1994-05-30 19:09:18 +00:00
|
|
|
.SUFFIXES:
|
2002-04-19 18:01:03 +00:00
|
|
|
.SUFFIXES: .out .o .po .So .S .s .asm .c .cc .cpp .cxx .m .C .f .y .l .ln
|
2002-03-17 10:05:57 +00:00
|
|
|
|
2002-05-13 10:53:24 +00:00
|
|
|
.if !defined(PICFLAG)
|
|
|
|
.if ${MACHINE_ARCH} == "sparc64"
|
|
|
|
PICFLAG=-fPIC
|
|
|
|
.else
|
|
|
|
PICFLAG=-fpic
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2002-03-17 10:05:57 +00:00
|
|
|
.c.ln:
|
|
|
|
${LINT} ${LINTOBJFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC} || \
|
2002-03-18 09:35:45 +00:00
|
|
|
touch ${.TARGET}
|
2002-03-17 10:05:57 +00:00
|
|
|
|
|
|
|
.cc.ln .C.ln .cpp.ln .cxx.ln:
|
2002-03-18 09:35:45 +00:00
|
|
|
${LINT} ${LINTOBJFLAGS} ${CXXFLAGS:M-[DIU]*} ${.IMPSRC} || \
|
|
|
|
touch ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.c.o:
|
1994-08-04 21:09:27 +00:00
|
|
|
${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.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}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
1999-01-09 21:51:00 +00:00
|
|
|
.c.So:
|
1994-08-04 21:09:27 +00:00
|
|
|
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1998-06-05 18:38:55 +00:00
|
|
|
.cc.o .C.o .cpp.o .cxx.o:
|
1994-08-04 21:09:27 +00:00
|
|
|
${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1998-06-05 18:38:55 +00:00
|
|
|
.cc.po .C.po .cpp.po .cxx.po:
|
1997-04-09 20:31:15 +00:00
|
|
|
${CXX} -pg ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1999-01-09 21:51:00 +00:00
|
|
|
.cc.So .C.So .cpp.So .cxx.So:
|
1994-08-04 21:09:27 +00:00
|
|
|
${CXX} ${PICFLAG} -DPIC ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.f.o:
|
|
|
|
${FC} ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.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}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1999-01-09 21:51:00 +00:00
|
|
|
.f.So:
|
1994-08-04 21:09:27 +00:00
|
|
|
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1998-05-15 09:30:13 +00:00
|
|
|
.m.o:
|
|
|
|
${OBJC} ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1998-05-15 09:30:13 +00:00
|
|
|
|
|
|
|
.m.po:
|
|
|
|
${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1998-05-15 09:30:13 +00:00
|
|
|
|
1999-01-09 21:51:00 +00:00
|
|
|
.m.So:
|
1998-05-15 09:30:13 +00:00
|
|
|
${OBJC} ${PICFLAG} -DPIC ${OBJCFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1998-05-15 09:30:13 +00:00
|
|
|
|
2002-04-22 08:56:34 +00:00
|
|
|
.s.o .asm.o:
|
2002-05-22 11:03:35 +00:00
|
|
|
${CC} -x assembler-with-cpp ${CFLAGS} ${AINC} -c \
|
1996-08-11 12:24:44 +00:00
|
|
|
${.IMPSRC} -o ${.TARGET}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-22 08:56:34 +00:00
|
|
|
.s.po .asm.po:
|
2002-05-22 11:03:35 +00:00
|
|
|
${CC} -x assembler-with-cpp -DPROF ${CFLAGS} ${AINC} -c \
|
1996-08-11 12:24:44 +00:00
|
|
|
${.IMPSRC} -o ${.TARGET}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-22 08:56:34 +00:00
|
|
|
.s.So .asm.So:
|
2002-05-22 11:03:35 +00:00
|
|
|
${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \
|
2002-04-21 17:26:16 +00:00
|
|
|
${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.S.o:
|
2002-05-22 11:03:35 +00:00
|
|
|
${CC} ${CFLAGS} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.S.po:
|
2002-05-22 11:03:35 +00:00
|
|
|
${CC} -DPROF ${CFLAGS} ${AINC} -c ${.IMPSRC} -o ${.TARGET}
|
2002-05-09 16:43:07 +00:00
|
|
|
@${LD} ${LDFLAGS} -o ${.TARGET}.tmp -X -r ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1999-01-09 21:51:00 +00:00
|
|
|
.S.So:
|
2002-05-22 11:03:35 +00:00
|
|
|
${CC} ${PICFLAG} -DPIC ${CFLAGS} ${AINC} -c ${.IMPSRC} \
|
2002-04-21 17:26:16 +00:00
|
|
|
-o ${.TARGET}
|
1998-08-08 13:11:44 +00:00
|
|
|
@${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
|
|
|
|
@mv ${.TARGET}.tmp ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2002-05-13 10:53:24 +00:00
|
|
|
all: objwarn
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
|
|
|
|
OBJS+= ${SRCS:N*.h:R:S/$/.o/}
|
|
|
|
.endif
|
|
|
|
|
2002-05-13 10:53:24 +00:00
|
|
|
.if defined(LIB) && !empty(LIB)
|
|
|
|
_LIBS= lib${LIB}.a
|
2002-04-20 08:41:55 +00:00
|
|
|
|
2002-05-13 10:53:24 +00:00
|
|
|
lib${LIB}.a: ${OBJS} ${STATICOBJS}
|
|
|
|
@${ECHO} building static ${LIB} library
|
|
|
|
@rm -f ${.TARGET}
|
|
|
|
@${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
|
|
|
|
${RANLIB} ${.TARGET}
|
2002-07-03 16:22:43 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2002-05-13 10:53:24 +00:00
|
|
|
.if !defined(INTERNALLIB)
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-07-03 16:22:43 +00:00
|
|
|
.if !defined(NOPROFILE) && defined(LIB) && !empty(LIB)
|
2002-05-13 10:53:24 +00:00
|
|
|
_LIBS+= lib${LIB}_p.a
|
|
|
|
POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
|
|
|
|
|
|
|
|
lib${LIB}_p.a: ${POBJS}
|
1994-08-28 15:37:40 +00:00
|
|
|
@${ECHO} building profiled ${LIB} library
|
2002-05-13 10:53:24 +00:00
|
|
|
@rm -f ${.TARGET}
|
|
|
|
@${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
|
|
|
|
${RANLIB} ${.TARGET}
|
1994-10-25 17:55:25 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2003-04-27 21:44:52 +00:00
|
|
|
.if !defined(NOSHLIBS)
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(SHLIB_NAME) || \
|
|
|
|
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
2002-05-13 10:53:24 +00:00
|
|
|
SOBJS+= ${OBJS:.o=.So}
|
2002-07-03 16:22:43 +00:00
|
|
|
.endif
|
2002-05-13 10:53:24 +00:00
|
|
|
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
.if defined(SHLIB_NAME)
|
2002-05-13 10:53:24 +00:00
|
|
|
_LIBS+= ${SHLIB_NAME}
|
2003-04-27 21:44:52 +00:00
|
|
|
.endif
|
2002-05-13 10:53:24 +00:00
|
|
|
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
${SHLIB_NAME}: ${SOBJS}
|
|
|
|
@${ECHO} building shared library ${SHLIB_NAME}
|
2002-05-13 10:53:24 +00:00
|
|
|
@rm -f ${.TARGET} ${SHLIB_LINK}
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
.if defined(SHLIB_LINK)
|
2002-05-13 10:53:24 +00:00
|
|
|
@ln -fs ${.TARGET} ${SHLIB_LINK}
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
.endif
|
2002-05-10 09:32:39 +00:00
|
|
|
@${CC} ${LDFLAGS} -shared -Wl,-x \
|
2002-05-13 10:53:24 +00:00
|
|
|
-o ${.TARGET} -Wl,-soname,${SONAME} \
|
Obviate the need to set the COMPILER_PATH and LIBRARY_PATH in Makefile.inc1
to pick up the correct cross-tools (the compiler executables and binutils)
and special linker files (crt*.o). This is now controlled by a single knob,
TOOLS_PREFIX, when building cross-tools.
Fixed regression in Makefile.inc1,v 1.203 (-nostdinc). This clobbered target
architecture's CFLAGS with building host's CPUTYPE setting in /etc/make.conf,
and had a nice but nasty side effect of exposing some (normally hidden) bugs
in system headers.
(Attempt to move the "-nostdinc -I..." part of CFLAGS into the new CINCLUDES
(modeled after a similar CXXINCLUDES) eventually failed because hard-coding
${WORLDTMP}/usr/include to be the first in the include list does not always
work, e.g. lib/libbind.)
Compensate the -nostdinc removal by making cpp(1) built in the cross-tools
stage to not look for <> header files in the building host's /usr/include
(already committed as gnu/usr.bin/cc/cc_tools/freebsd-native.h, revisions
1.10-1.12, STANDARD_INCLUDE_DIR).
: $ /usr/obj/usr/src/i386/usr/bin/cpp -v /dev/null
:
: Before:
:
: #include <...> search starts here:
: /usr/obj/usr/src/i386/usr/include
: /usr/include
: End of search list.
:
: After:
:
: #include <...> search starts here:
: /usr/obj/usr/src/i386/usr/include
: /usr/obj/usr/src/i386/usr/include
(Disabling the use of GCC_INCLUDE_DIR in the FREEBSD_NATIVE case would fix
the duplicate above.)
Get rid of the (now unneeded) -I${DESTDIR}/usr/include magic in bsd.prog.mk
and bsd.lib.mk. Finish the removal of LDDESTDIR in bsd.lib.mk,v 1.55 -- we
no longer have users of it.
The required changes to gcc were already committed as contrib/gcc.295/gcc.c,
revisions 1.23 and 1.24.
Basically, this allows for the changes above plus makes gcc(1) persistent
about path configuration, whether it's configured as a native or a cross
compiler:
: $ /usr/obj/usr/src/i386/usr/bin/cc -print-search-dirs
: install: /usr/obj/usr/src/i386/usr/libexec/(null)
: programs: /usr/obj/usr/src/i386/usr/libexec/elf/:/usr/obj/usr/src/i386/usr/libexec/
: libraries: /usr/obj/usr/src/i386/usr/lib/
:
: $ /usr/obj/alpha/usr/src/i386/usr/bin/cc -print-search-dirs
: install: /usr/obj/alpha/usr/src/i386/usr/libexec/(null)
: programs: /usr/obj/alpha/usr/src/i386/usr/libexec/elf/:/usr/obj/alpha/usr/src/i386/usr/libexec/
: libraries: /usr/obj/alpha/usr/src/i386/usr/lib/
Reviewed by: bde, obrien
2002-02-21 10:23:41 +00:00
|
|
|
`lorder ${SOBJS} | tsort -q` ${LDADD}
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
2002-05-13 10:53:24 +00:00
|
|
|
_LIBS+= lib${LIB}_pic.a
|
|
|
|
|
|
|
|
lib${LIB}_pic.a: ${SOBJS}
|
1994-08-28 15:37:40 +00:00
|
|
|
@${ECHO} building special pic ${LIB} library
|
2002-05-13 10:53:24 +00:00
|
|
|
@rm -f ${.TARGET}
|
|
|
|
@${AR} cq ${.TARGET} ${SOBJS} ${ARADD}
|
|
|
|
${RANLIB} ${.TARGET}
|
1994-10-25 17:55:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-09-20 19:32:51 +00:00
|
|
|
.if defined(WANT_LINT) && !defined(NOLINT) && defined(LIB) && !empty(LIB)
|
2002-05-13 10:53:24 +00:00
|
|
|
LINTLIB= llib-l${LIB}.ln
|
|
|
|
_LIBS+= ${LINTLIB}
|
|
|
|
LINTOBJS+= ${SRCS:M*.c:.c=.ln}
|
|
|
|
|
2002-03-17 10:05:57 +00:00
|
|
|
${LINTLIB}: ${LINTOBJS}
|
2002-05-13 10:53:24 +00:00
|
|
|
@${ECHO} building lint library ${.TARGET}
|
|
|
|
@rm -f ${.TARGET}
|
2002-03-17 10:05:57 +00:00
|
|
|
${LINT} ${LINTLIBFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
|
1996-06-17 15:59:52 +00:00
|
|
|
.endif
|
2002-05-13 10:53:24 +00:00
|
|
|
|
|
|
|
.endif !defined(INTERNALLIB)
|
|
|
|
|
|
|
|
all: ${_LIBS}
|
|
|
|
|
|
|
|
.if !defined(NOMAN)
|
|
|
|
all: _manpages
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
1998-03-07 13:13:41 +00:00
|
|
|
_EXTRADEPEND:
|
1997-04-09 16:10:27 +00:00
|
|
|
@TMP=_depend$$$$; \
|
1999-01-09 21:51:00 +00:00
|
|
|
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.So:/' < ${DEPENDFILE} \
|
1997-04-09 16:10:27 +00:00
|
|
|
> $$TMP; \
|
|
|
|
mv $$TMP ${DEPENDFILE}
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
.if !defined(NOEXTRADEPEND) && defined(SHLIB_NAME)
|
1997-12-17 13:36:44 +00:00
|
|
|
.if defined(DPADD) && !empty(DPADD)
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
echo ${SHLIB_NAME}: ${DPADD} >> ${DEPENDFILE}
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
|
|
|
.if !target(install)
|
|
|
|
|
1999-06-24 22:50:24 +00:00
|
|
|
.if defined(PRECIOUSLIB) && !defined(NOFSCHG)
|
1994-08-26 18:58:10 +00:00
|
|
|
SHLINSTALLFLAGS+= -fschg
|
|
|
|
.endif
|
|
|
|
|
1999-07-31 20:27:33 +00:00
|
|
|
_INSTALLFLAGS:= ${INSTALLFLAGS}
|
|
|
|
.for ie in ${INSTALLFLAGS_EDIT}
|
|
|
|
_INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
|
|
|
|
.endfor
|
2000-02-03 09:36:17 +00:00
|
|
|
_SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS}
|
1999-07-31 20:27:33 +00:00
|
|
|
.for ie in ${INSTALLFLAGS_EDIT}
|
|
|
|
_SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}}
|
|
|
|
.endfor
|
|
|
|
|
2002-07-03 16:22:43 +00:00
|
|
|
.if !defined(INTERNALLIB)
|
2002-04-23 09:03:56 +00:00
|
|
|
realinstall: _libinstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _libinstall
|
2002-04-23 09:03:56 +00:00
|
|
|
_libinstall:
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(LIB) && !empty(LIB) && !defined(NOINSTALLLIB)
|
2002-03-22 20:28:16 +00:00
|
|
|
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1999-07-31 20:27:33 +00:00
|
|
|
${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${LIBDIR}
|
2002-05-13 10:53:24 +00:00
|
|
|
.endif
|
2002-07-03 16:22:43 +00:00
|
|
|
.if !defined(NOPROFILE) && defined(LIB) && !empty(LIB)
|
2002-03-22 20:28:16 +00:00
|
|
|
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1999-07-31 20:27:33 +00:00
|
|
|
${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${LIBDIR}
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2003-04-27 21:44:52 +00:00
|
|
|
.if !defined(NOSHLIBS) && defined(SHLIB_NAME)
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1999-07-31 20:27:33 +00:00
|
|
|
${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
|
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
1999-01-20 21:42:40 +00:00
|
|
|
${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}
|
|
|
|
.if defined(SHLIB_LINK)
|
2002-05-13 10:53:24 +00:00
|
|
|
ln -fs ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK}
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1999-07-31 20:27:33 +00:00
|
|
|
${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
2002-09-20 19:32:51 +00:00
|
|
|
.if defined(WANT_LINT) && !defined(NOLINT) && defined(LIB) && !empty(LIB)
|
2002-07-29 09:40:17 +00:00
|
|
|
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
2002-05-12 16:01:00 +00:00
|
|
|
${_INSTALLFLAGS} ${LINTLIB} ${DESTDIR}${LINTLIBDIR}
|
|
|
|
.endif
|
2002-07-03 16:22:43 +00:00
|
|
|
.endif !defined(INTERNALLIB)
|
2002-05-12 16:01:00 +00:00
|
|
|
|
2002-06-03 14:49:34 +00:00
|
|
|
.include <bsd.files.mk>
|
2002-05-15 16:19:54 +00:00
|
|
|
.include <bsd.incs.mk>
|
2002-07-02 12:16:54 +00:00
|
|
|
.include <bsd.links.mk>
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2002-04-23 09:03:56 +00:00
|
|
|
.if !defined(NOMAN)
|
2002-05-07 15:42:56 +00:00
|
|
|
realinstall: _maninstall
|
2002-07-03 12:28:03 +00:00
|
|
|
.ORDER: beforeinstall _maninstall
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2002-05-07 15:27:56 +00:00
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !target(lint)
|
2002-04-23 09:03:56 +00:00
|
|
|
lint: ${SRCS:M*.c}
|
2002-09-20 19:32:51 +00:00
|
|
|
${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.ALLSRC}
|
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>
|
2001-03-27 08:43:28 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
|
|
|
.include <bsd.dep.mk>
|
1998-03-06 08:08:36 +00:00
|
|
|
|
2002-04-07 14:58:12 +00:00
|
|
|
.if !exists(${.OBJDIR}/${DEPENDFILE})
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(LIB) && !empty(LIB)
|
|
|
|
${OBJS} ${STATICOBJS} ${POBJS}: ${SRCS:M*.h}
|
|
|
|
.endif
|
|
|
|
.if defined(SHLIB_NAME) || \
|
|
|
|
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
|
|
|
${SOBJS}: ${SRCS:M*.h}
|
1998-03-06 08:08:36 +00:00
|
|
|
.endif
|
2002-05-13 10:53:24 +00:00
|
|
|
.endif
|
1998-03-06 08:08:36 +00:00
|
|
|
|
2002-07-21 21:22:45 +00:00
|
|
|
.if !target(clean)
|
|
|
|
clean:
|
|
|
|
.if defined(CLEANFILES) && !empty(CLEANFILES)
|
|
|
|
rm -f ${CLEANFILES}
|
|
|
|
.endif
|
|
|
|
.if defined(LIB) && !empty(LIB)
|
|
|
|
rm -f a.out ${OBJS} ${OBJS:S/$/.tmp/} ${STATICOBJS}
|
|
|
|
.endif
|
|
|
|
.if !defined(INTERNALLIB)
|
|
|
|
.if !defined(NOPROFILE) && defined(LIB) && !empty(LIB)
|
|
|
|
rm -f ${POBJS} ${POBJS:S/$/.tmp/}
|
|
|
|
.endif
|
|
|
|
.if defined(SHLIB_NAME) || \
|
|
|
|
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
|
|
|
rm -f ${SOBJS} ${SOBJS:.So=.so} ${SOBJS:S/$/.tmp/}
|
|
|
|
.endif
|
|
|
|
.if defined(SHLIB_NAME)
|
|
|
|
.if defined(SHLIB_LINK)
|
|
|
|
rm -f ${SHLIB_LINK}
|
|
|
|
.endif
|
|
|
|
.if defined(LIB) && !empty(LIB)
|
|
|
|
rm -f lib${LIB}.so.* lib${LIB}.so
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.if defined(WANT_LINT) && defined(LIB) && !empty(LIB)
|
|
|
|
rm -f ${LINTOBJS}
|
|
|
|
.endif
|
|
|
|
.endif !defined(INTERNALLIB)
|
|
|
|
.if defined(_LIBS) && !empty(_LIBS)
|
|
|
|
rm -f ${_LIBS}
|
|
|
|
.endif
|
|
|
|
.if defined(CLEANDIRS) && !empty(CLEANDIRS)
|
|
|
|
rm -rf ${CLEANDIRS}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
.include <bsd.obj.mk>
|
2001-05-19 23:18:21 +00:00
|
|
|
|
|
|
|
.include <bsd.sys.mk>
|