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.
|
2004-12-21 09:33:47 +00:00
|
|
|
.if defined(NO_PIC)
|
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
|
|
|
.undef SHLIB_NAME
|
|
|
|
.undef INSTALL_PIC_ARCHIVE
|
|
|
|
.else
|
2004-05-07 09:58:36 +00:00
|
|
|
.if !defined(SHLIB) && defined(LIB)
|
|
|
|
SHLIB= ${LIB}
|
|
|
|
.endif
|
|
|
|
.if !defined(SHLIB_NAME) && defined(SHLIB) && defined(SHLIB_MAJOR)
|
|
|
|
SHLIB_NAME= lib${SHLIB}.so.${SHLIB_MAJOR}
|
2002-07-18 17:44:20 +00:00
|
|
|
.endif
|
2004-01-27 23:22:15 +00:00
|
|
|
.if defined(SHLIB_NAME) && !empty(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
|
|
|
|
|
2003-08-31 15:20:17 +00:00
|
|
|
.if defined(CRUNCH_CFLAGS)
|
2003-06-29 18:16:26 +00:00
|
|
|
CFLAGS+= ${CRUNCH_CFLAGS}
|
2003-08-31 15:20:17 +00:00
|
|
|
.endif
|
2003-06-29 18:16:26 +00:00
|
|
|
|
2006-09-11 05:35:57 +00:00
|
|
|
.if ${MK_ASSERT_DEBUG} == "no"
|
|
|
|
CFLAGS+= -DNDEBUG
|
2006-09-13 23:27:21 +00:00
|
|
|
NO_WERROR=
|
2006-09-11 05:35:57 +00:00
|
|
|
.endif
|
|
|
|
|
1994-09-16 14:30:25 +00:00
|
|
|
.if defined(DEBUG_FLAGS)
|
|
|
|
CFLAGS+= ${DEBUG_FLAGS}
|
2008-05-22 01:14:43 +00:00
|
|
|
|
|
|
|
.if !defined(NO_CTF) && (${DEBUG_FLAGS:M-g} != "")
|
|
|
|
CTFFLAGS+= -g
|
|
|
|
.endif
|
1994-09-16 14:30:25 +00:00
|
|
|
.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:
|
2003-07-02 17:03:28 +00:00
|
|
|
.SUFFIXES: .out .o .po .So .S .asm .s .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
|
|
|
|
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
.if ${CC} == "icc"
|
|
|
|
PO_FLAG=-p
|
|
|
|
.else
|
|
|
|
PO_FLAG=-pg
|
|
|
|
.endif
|
|
|
|
|
1994-05-30 19:09:18 +00:00
|
|
|
.c.po:
|
2010-01-22 14:05:48 +00:00
|
|
|
${CC} ${PO_FLAG} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
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}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1998-06-05 18:38:55 +00:00
|
|
|
.cc.po .C.po .cpp.po .cxx.po:
|
2010-01-22 14:05:48 +00:00
|
|
|
${CXX} ${PO_FLAG} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.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}
|
|
|
|
|
|
|
|
.f.po:
|
2004-03-15 17:01:31 +00:00
|
|
|
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
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}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1998-05-15 09:30:13 +00:00
|
|
|
.m.po:
|
|
|
|
${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
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}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
1998-05-15 09:30:13 +00:00
|
|
|
|
2003-07-02 17:03:28 +00:00
|
|
|
.s.po .s.So:
|
2003-07-02 12:41:04 +00:00
|
|
|
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2003-07-02 17:03:28 +00:00
|
|
|
.asm.po:
|
2010-01-22 14:05:48 +00:00
|
|
|
${CC} -x assembler-with-cpp -DPROF ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
2003-07-02 17:03:28 +00:00
|
|
|
|
|
|
|
.asm.So:
|
|
|
|
${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \
|
|
|
|
-c ${.IMPSRC} -o ${.TARGET}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
2003-07-02 17:03:28 +00:00
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.S.po:
|
2010-01-22 14:05:48 +00:00
|
|
|
${CC} -DPROF ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
1999-01-09 21:51:00 +00:00
|
|
|
.S.So:
|
2003-07-01 15:15:45 +00:00
|
|
|
${CC} ${PICFLAG} -DPIC ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFCONVERT)
|
|
|
|
${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
|
|
|
|
.endif
|
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
|
|
|
|
2007-04-03 18:56:05 +00:00
|
|
|
.include <bsd.symver.mk>
|
2006-03-16 15:12:26 +00:00
|
|
|
|
2008-04-09 20:27:53 +00:00
|
|
|
# Allow libraries to specify their own version map or have it
|
2007-04-03 18:56:05 +00:00
|
|
|
# automatically generated (see bsd.symver.mk above).
|
2007-05-21 09:01:23 +00:00
|
|
|
.if ${MK_SYMVER} == "yes" && !empty(VERSION_MAP)
|
2006-03-16 15:12:26 +00:00
|
|
|
${SHLIB_NAME}: ${VERSION_MAP}
|
|
|
|
LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
|
|
|
|
.endif
|
|
|
|
|
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}
|
2006-10-25 09:43:38 +00:00
|
|
|
.if !defined(NM)
|
|
|
|
@${AR} cq ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
|
|
|
|
.else
|
|
|
|
@${AR} cq ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
|
|
|
|
.endif
|
2002-05-13 10:53:24 +00:00
|
|
|
${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
|
|
|
|
2006-03-18 21:37:05 +00:00
|
|
|
.if ${MK_PROFILE} != "no" && 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}
|
2006-10-25 09:43:38 +00:00
|
|
|
.if !defined(NM)
|
|
|
|
@${AR} cq ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
|
|
|
|
.else
|
|
|
|
@${AR} cq ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
|
|
|
|
.endif
|
2002-05-13 10:53:24 +00:00
|
|
|
${RANLIB} ${.TARGET}
|
1994-10-25 17:55:25 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
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}
|
|
|
|
|
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
|
2006-10-25 09:43:38 +00:00
|
|
|
.if !defined(NM)
|
2009-07-14 21:19:13 +00:00
|
|
|
@${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
|
2002-05-13 10:53:24 +00:00
|
|
|
-o ${.TARGET} -Wl,-soname,${SONAME} \
|
2006-10-25 09:43:38 +00:00
|
|
|
`lorder ${SOBJS} | tsort -q` ${LDADD}
|
|
|
|
.else
|
2009-07-14 21:19:13 +00:00
|
|
|
@${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \
|
2006-10-25 09:43:38 +00:00
|
|
|
-o ${.TARGET} -Wl,-soname,${SONAME} \
|
|
|
|
`NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
|
|
|
|
.endif
|
2008-05-22 01:14:43 +00:00
|
|
|
.if defined(CTFMERGE)
|
|
|
|
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
|
|
|
|
.endif
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
|
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
|
|
|
|
2004-12-21 09:33:47 +00:00
|
|
|
.if defined(WANT_LINT) && !defined(NO_LINT) && 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
|
|
|
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # !defined(INTERNALLIB)
|
2002-05-13 10:53:24 +00:00
|
|
|
|
|
|
|
all: ${_LIBS}
|
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
2002-05-13 10:53:24 +00:00
|
|
|
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}
|
2004-12-21 09:42:10 +00:00
|
|
|
.if !defined(NO_EXTRADEPEND) && 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)
|
|
|
|
|
2004-10-01 07:57:02 +00:00
|
|
|
.if defined(PRECIOUSLIB)
|
2004-12-21 09:53:14 +00:00
|
|
|
.if !defined(NO_FSCHG)
|
1994-08-26 18:58:10 +00:00
|
|
|
SHLINSTALLFLAGS+= -fschg
|
|
|
|
.endif
|
2004-10-01 07:57:02 +00:00
|
|
|
SHLINSTALLFLAGS+= -S
|
|
|
|
.endif
|
1994-08-26 18:58:10 +00:00
|
|
|
|
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:
|
2007-10-20 19:01:50 +00:00
|
|
|
.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
|
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
|
2006-03-18 21:37:05 +00:00
|
|
|
.if ${MK_PROFILE} != "no" && 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-06-10 04:47:49 +00:00
|
|
|
.if 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)
|
2003-09-07 14:15:40 +00:00
|
|
|
.if ${SHLIBDIR} == ${LIBDIR}
|
|
|
|
ln -fs ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK}
|
|
|
|
.else
|
|
|
|
ln -fs ${_SHLIBDIRPREFIX}${SHLIBDIR}/${SHLIB_NAME} \
|
2003-09-04 04:29:11 +00:00
|
|
|
${DESTDIR}${LIBDIR}/${SHLIB_LINK}
|
2003-09-07 14:15:40 +00:00
|
|
|
.if exists(${DESTDIR}${LIBDIR}/${SHLIB_NAME})
|
|
|
|
-chflags noschg ${DESTDIR}${LIBDIR}/${SHLIB_NAME}
|
|
|
|
rm -f ${DESTDIR}${LIBDIR}/${SHLIB_NAME}
|
|
|
|
.endif
|
2003-09-04 04:29:11 +00:00
|
|
|
.endif
|
1997-08-30 23:23:18 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
2006-03-17 18:54:44 +00:00
|
|
|
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
|
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
|
2004-12-21 09:33:47 +00:00
|
|
|
.if defined(WANT_LINT) && !defined(NO_LINT) && 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
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # !defined(INTERNALLIB)
|
2002-05-12 16:01:00 +00:00
|
|
|
|
2005-02-08 10:37:34 +00:00
|
|
|
.include <bsd.nls.mk>
|
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
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
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
|
|
|
|
|
2006-03-17 18:54:44 +00:00
|
|
|
.if ${MK_MAN} != "no"
|
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}
|
2004-01-17 18:51:55 +00:00
|
|
|
.for _S in ${SRCS:N*.[hly]}
|
|
|
|
${_S:R}.po: ${_S}
|
|
|
|
.endfor
|
2002-07-03 16:22:43 +00:00
|
|
|
.endif
|
|
|
|
.if defined(SHLIB_NAME) || \
|
|
|
|
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
|
|
|
${SOBJS}: ${SRCS:M*.h}
|
2004-01-17 18:51:55 +00:00
|
|
|
.for _S in ${SRCS:N*.[hly]}
|
|
|
|
${_S:R}.So: ${_S}
|
|
|
|
.endfor
|
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)
|
2006-03-18 21:37:05 +00:00
|
|
|
.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
|
2002-07-21 21:22:45 +00:00
|
|
|
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
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # !defined(INTERNALLIB)
|
2002-07-21 21:22:45 +00:00
|
|
|
.if defined(_LIBS) && !empty(_LIBS)
|
|
|
|
rm -f ${_LIBS}
|
|
|
|
.endif
|
|
|
|
.if defined(CLEANDIRS) && !empty(CLEANDIRS)
|
|
|
|
rm -rf ${CLEANDIRS}
|
|
|
|
.endif
|
2006-03-23 20:37:04 +00:00
|
|
|
.if !empty(VERSION_DEF) && !empty(SYMBOL_MAPS)
|
|
|
|
rm -f ${VERSION_MAP}
|
|
|
|
.endif
|
2002-07-21 21:22:45 +00:00
|
|
|
.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>
|