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
|
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
|
|
|
|
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:
|
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:
|
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
|
|
|
${CC} ${PO_FLAG} ${CFLAGS} -c ${.IMPSRC} -o ${.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}
|
|
|
|
|
1998-06-05 18:38:55 +00:00
|
|
|
.cc.po .C.po .cpp.po .cxx.po:
|
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
|
|
|
${CXX} ${PO_FLAG} ${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}
|
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}
|
|
|
|
|
1998-05-15 09:30:13 +00:00
|
|
|
.m.po:
|
|
|
|
${OBJC} ${OBJCFLAGS} -pg -c ${.IMPSRC} -o ${.TARGET}
|
|
|
|
|
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}
|
|
|
|
|
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}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2003-07-02 17:03:28 +00:00
|
|
|
.asm.po:
|
|
|
|
${CC} -x assembler-with-cpp -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
|
|
|
|
|
|
|
.asm.So:
|
|
|
|
${CC} -x assembler-with-cpp ${PICFLAG} -DPIC ${CFLAGS} \
|
|
|
|
-c ${.IMPSRC} -o ${.TARGET}
|
|
|
|
|
1994-08-04 21:09:27 +00:00
|
|
|
.S.po:
|
2003-07-01 15:15:45 +00:00
|
|
|
${CC} -DPROF ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
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}
|
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
|
|
|
|
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
|
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
|
|
|
|
2004-03-14 01:29:05 +00:00
|
|
|
.endif !defined(INTERNALLIB)
|
2002-05-13 10:53:24 +00:00
|
|
|
|
|
|
|
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-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
|
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}
|
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)
|
|
|
|
.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>
|