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
|
|
|
|
2016-04-15 18:43:54 +00:00
|
|
|
.if defined(LIB_CXX) || defined(SHLIB_CXX)
|
2015-03-17 15:16:36 +00:00
|
|
|
_LD= ${CXX}
|
|
|
|
.else
|
|
|
|
_LD= ${CC}
|
|
|
|
.endif
|
2016-04-15 18:43:54 +00:00
|
|
|
.if defined(LIB_CXX)
|
|
|
|
LIB= ${LIB_CXX}
|
|
|
|
.endif
|
|
|
|
.if defined(SHLIB_CXX)
|
|
|
|
SHLIB= ${SHLIB_CXX}
|
|
|
|
.endif
|
2015-03-17 15:16:36 +00:00
|
|
|
|
2015-05-04 16:28:54 +00:00
|
|
|
LIB_PRIVATE= ${PRIVATELIB:Dprivate}
|
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)
|
2015-05-04 16:28:54 +00:00
|
|
|
SHLIB_NAME= lib${LIB_PRIVATE}${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
|
|
|
|
2014-11-08 18:16:39 +00:00
|
|
|
.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
|
2008-05-22 01:14:43 +00:00
|
|
|
CTFFLAGS+= -g
|
|
|
|
.endif
|
2012-12-14 18:30:01 +00:00
|
|
|
.else
|
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
|
|
|
|
2015-03-18 11:05:49 +00:00
|
|
|
.if ${SHLIBDIR:M*lib32*}
|
|
|
|
TAGS+= lib32
|
|
|
|
.endif
|
|
|
|
|
2015-02-13 00:16:05 +00:00
|
|
|
.if defined(NO_ROOT)
|
|
|
|
.if !defined(TAGS) || ! ${TAGS:Mpackage=*}
|
2015-03-04 23:01:03 +00:00
|
|
|
TAGS+= package=${PACKAGE:Uruntime}
|
2015-02-13 00:16:05 +00:00
|
|
|
.endif
|
|
|
|
TAG_ARGS= -T ${TAGS:[*]:S/ /,/g}
|
|
|
|
.endif
|
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \
|
|
|
|
empty(DEBUG_FLAGS:M-gdwarf*)
|
2017-08-23 23:30:25 +00:00
|
|
|
CFLAGS+= ${DEBUG_FILES_CFLAGS}
|
|
|
|
CXXFLAGS+= ${DEBUG_FILES_CFLAGS}
|
2013-06-07 21:40:02 +00:00
|
|
|
CTFFLAGS+= -g
|
|
|
|
.endif
|
|
|
|
|
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
|
2016-09-24 15:11:27 +00:00
|
|
|
# .pico used for PIC object files
|
2016-11-01 21:27:42 +00:00
|
|
|
.SUFFIXES: .out .o .bc .ll .po .pico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln
|
2002-03-17 10:05:57 +00:00
|
|
|
|
2002-05-13 10:53:24 +00:00
|
|
|
.if !defined(PICFLAG)
|
2010-08-23 22:24:11 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "sparc64"
|
2002-05-13 10:53:24 +00:00
|
|
|
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
|
|
|
PO_FLAG=-pg
|
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
.c.po:
|
2011-11-21 16:35:57 +00:00
|
|
|
${CC} ${PO_FLAG} ${STATIC_CFLAGS} ${PO_CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2016-09-24 15:11:27 +00:00
|
|
|
.c.pico:
|
2017-08-27 17:08:08 +00:00
|
|
|
${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
.cc.po .C.po .cpp.po .cxx.po:
|
2011-11-21 16:35:57 +00:00
|
|
|
${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-09-24 15:11:27 +00:00
|
|
|
.cc.pico .C.pico .cpp.pico .cxx.pico:
|
2017-08-27 17:08:08 +00:00
|
|
|
${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
.f.po:
|
2004-03-15 17:01:31 +00:00
|
|
|
${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-09-24 15:11:27 +00:00
|
|
|
.f.pico:
|
1994-08-04 21:09:27 +00:00
|
|
|
${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-09-24 15:11:27 +00:00
|
|
|
.s.po .s.pico:
|
2003-07-02 12:41:04 +00:00
|
|
|
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
.asm.po:
|
Add built-in ccache build support via WITH_CCACHE_BUILD option.
ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.
This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.
The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.
Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.
CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.
The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.
Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.
distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.
The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).
Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.
buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30
PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes
2015-11-08 00:50:18 +00:00
|
|
|
${CC:N${CCACHE_BIN}} -x assembler-with-cpp -DPROF ${PO_CFLAGS} \
|
|
|
|
${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
2003-07-02 17:03:28 +00:00
|
|
|
|
2016-09-24 15:11:27 +00:00
|
|
|
.asm.pico:
|
Add built-in ccache build support via WITH_CCACHE_BUILD option.
ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.
This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.
The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.
Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.
CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.
The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.
Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.
distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.
The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).
Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.
buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30
PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes
2015-11-08 00:50:18 +00:00
|
|
|
${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \
|
|
|
|
${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
2003-07-02 17:03:28 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
.S.po:
|
Add built-in ccache build support via WITH_CCACHE_BUILD option.
ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.
This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.
The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.
Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.
CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.
The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.
Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.
distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.
The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).
Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.
buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30
PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes
2015-11-08 00:50:18 +00:00
|
|
|
${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \
|
|
|
|
-o ${.TARGET}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-09-24 15:11:27 +00:00
|
|
|
.S.pico:
|
Add built-in ccache build support via WITH_CCACHE_BUILD option.
ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.
This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.
The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.
Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.
CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.
The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.
Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.
distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.
The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).
Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.
buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30
PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes
2015-11-08 00:50:18 +00:00
|
|
|
${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \
|
|
|
|
-c ${.IMPSRC} -o ${.TARGET}
|
2011-11-29 16:34:44 +00:00
|
|
|
${CTFCONVERT_CMD}
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2013-09-08 09:40:23 +00:00
|
|
|
_LIBDIR:=${LIBDIR}
|
|
|
|
_SHLIBDIR:=${SHLIBDIR}
|
|
|
|
|
2013-02-20 20:42:56 +00:00
|
|
|
.if defined(SHLIB_NAME)
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
SHLIB_NAME_FULL=${SHLIB_NAME}.full
|
|
|
|
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
|
2013-09-08 09:40:23 +00:00
|
|
|
.if ${_SHLIBDIR} == "/boot" ||\
|
2013-06-07 21:40:02 +00:00
|
|
|
${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\
|
2015-10-16 05:06:43 +00:00
|
|
|
${SHLIBDIR:C%/usr/(tests/)?lib(32|exec)?(/.*)?%/usr/lib%} == "/usr/lib"
|
2013-09-08 09:40:23 +00:00
|
|
|
DEBUGFILEDIR=${DEBUGDIR}${_SHLIBDIR}
|
2013-06-07 21:40:02 +00:00
|
|
|
.else
|
2013-09-08 09:40:23 +00:00
|
|
|
DEBUGFILEDIR=${_SHLIBDIR}/.debug
|
2016-03-03 18:08:58 +00:00
|
|
|
.endif
|
|
|
|
.if !exists(${DESTDIR}${DEBUGFILEDIR})
|
2013-06-07 21:40:02 +00:00
|
|
|
DEBUGMKDIR=
|
|
|
|
.endif
|
2013-02-20 20:42:56 +00:00
|
|
|
.else
|
|
|
|
SHLIB_NAME_FULL=${SHLIB_NAME}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
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)
|
2013-02-20 20:42:56 +00:00
|
|
|
${SHLIB_NAME_FULL}: ${VERSION_MAP}
|
2006-03-16 15:12:26 +00:00
|
|
|
LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
|
|
|
|
.endif
|
|
|
|
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
|
2017-09-16 05:42:27 +00:00
|
|
|
OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/}
|
2017-10-18 00:33:20 +00:00
|
|
|
BCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g}
|
|
|
|
LLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g}
|
|
|
|
CLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS}
|
2002-07-03 16:22:43 +00:00
|
|
|
.endif
|
|
|
|
|
2002-05-13 10:53:24 +00:00
|
|
|
.if defined(LIB) && !empty(LIB)
|
2015-05-04 16:28:54 +00:00
|
|
|
_LIBS= lib${LIB_PRIVATE}${LIB}.a
|
2002-04-20 08:41:55 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS}
|
2002-05-13 10:53:24 +00:00
|
|
|
@${ECHO} building static ${LIB} library
|
|
|
|
@rm -f ${.TARGET}
|
2016-10-18 01:42:42 +00:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \
|
|
|
|
${LORDER} ${OBJS} ${STATICOBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD}
|
2014-04-12 12:44:09 +00:00
|
|
|
${RANLIB} ${RANLIBFLAGS} ${.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)
|
2015-05-04 16:28:54 +00:00
|
|
|
_LIBS+= lib${LIB_PRIVATE}${LIB}_p.a
|
2002-05-13 10:53:24 +00:00
|
|
|
POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
|
2015-12-07 16:08:22 +00:00
|
|
|
DEPENDOBJS+= ${POBJS}
|
2015-09-22 05:05:53 +00:00
|
|
|
CLEANFILES+= ${POBJS}
|
2002-05-13 10:53:24 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
lib${LIB_PRIVATE}${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}
|
2016-10-18 01:42:42 +00:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \
|
|
|
|
${LORDER} ${POBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD}
|
2014-04-12 12:44:09 +00:00
|
|
|
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
|
1994-10-25 17:55:25 +00:00
|
|
|
.endif
|
1994-08-04 21:09:27 +00:00
|
|
|
|
2016-11-01 21:27:42 +00:00
|
|
|
.if defined(LLVM_LINK)
|
|
|
|
lib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS}
|
|
|
|
${LLVM_LINK} -o ${.TARGET} ${BCOBJS}
|
|
|
|
|
|
|
|
lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS}
|
|
|
|
${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS}
|
2017-10-17 16:29:50 +00:00
|
|
|
|
|
|
|
CLEANFILES+= lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll
|
2016-11-01 21:27:42 +00:00
|
|
|
.endif
|
|
|
|
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(SHLIB_NAME) || \
|
|
|
|
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
2016-09-24 15:11:27 +00:00
|
|
|
SOBJS+= ${OBJS:.o=.pico}
|
2015-12-07 16:08:22 +00:00
|
|
|
DEPENDOBJS+= ${SOBJS}
|
2015-09-22 05:05:53 +00:00
|
|
|
CLEANFILES+= ${SOBJS}
|
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}
|
|
|
|
|
2016-03-04 22:37:00 +00:00
|
|
|
SOLINKOPTS+= -shared -Wl,-x
|
2014-12-23 10:43:35 +00:00
|
|
|
.if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no"
|
|
|
|
SOLINKOPTS+= -Wl,--no-fatal-warnings
|
|
|
|
.else
|
|
|
|
SOLINKOPTS+= -Wl,--fatal-warnings
|
|
|
|
.endif
|
|
|
|
SOLINKOPTS+= -Wl,--warn-shared-textrel
|
2011-12-06 11:28:17 +00:00
|
|
|
|
2010-09-10 16:21:09 +00:00
|
|
|
.if target(beforelinking)
|
2012-12-31 21:54:43 +00:00
|
|
|
beforelinking: ${SOBJS}
|
|
|
|
${SHLIB_NAME_FULL}: beforelinking
|
2012-12-15 00:03:35 +00:00
|
|
|
.endif
|
2014-05-16 14:51:19 +00:00
|
|
|
|
|
|
|
.if defined(SHLIB_LINK)
|
|
|
|
.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT})
|
2016-06-03 19:25:36 +00:00
|
|
|
${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT}
|
2016-03-25 19:12:38 +00:00
|
|
|
sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \
|
|
|
|
-e 's,@@LIBDIR@@,${_LIBDIR},g' \
|
2014-05-16 14:51:19 +00:00
|
|
|
${.ALLSRC} > ${.TARGET}
|
|
|
|
|
|
|
|
${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld
|
2015-09-22 05:05:53 +00:00
|
|
|
CLEANFILES+= ${SHLIB_LINK:R}.ld
|
2014-05-16 14:51:19 +00:00
|
|
|
.endif
|
2015-09-22 05:05:53 +00:00
|
|
|
CLEANFILES+= ${SHLIB_LINK}
|
2014-05-16 14:51:19 +00:00
|
|
|
.endif
|
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
${SHLIB_NAME_FULL}: ${SOBJS}
|
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} building shared library ${SHLIB_NAME}
|
2012-12-15 00:03:35 +00:00
|
|
|
@rm -f ${SHLIB_NAME} ${SHLIB_LINK}
|
2016-06-14 16:19:44 +00:00
|
|
|
.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no"
|
2015-02-13 00:16:05 +00:00
|
|
|
@${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${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
|
Add built-in ccache build support via WITH_CCACHE_BUILD option.
ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.
This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.
The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.
Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.
CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.
The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.
Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.
distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.
The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).
Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.
buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30
PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes
2015-11-08 00:50:18 +00:00
|
|
|
${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
|
2006-10-25 09:43:38 +00:00
|
|
|
-o ${.TARGET} -Wl,-soname,${SONAME} \
|
2016-10-18 01:42:42 +00:00
|
|
|
`NM='${NM}' NMFLAGS='${NMFLAGS}' ${LORDER} ${SOBJS} | \
|
|
|
|
${TSORT} ${TSORTFLAGS}` ${LDADD}
|
2011-11-30 18:11:49 +00:00
|
|
|
.if ${MK_CTF} != "no"
|
2011-11-29 08:38:47 +00:00
|
|
|
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
|
|
|
|
.endif
|
2012-12-15 00:03:35 +00:00
|
|
|
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
CLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
|
2016-06-03 19:25:36 +00:00
|
|
|
${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug
|
2013-06-07 21:40:02 +00:00
|
|
|
${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \
|
2012-12-31 21:54:43 +00:00
|
|
|
${SHLIB_NAME_FULL} ${.TARGET}
|
2016-06-14 16:19:44 +00:00
|
|
|
.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
|
|
|
|
@${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${SHLIB_LINK}
|
|
|
|
.endif
|
2012-12-15 00:03:35 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL}
|
2012-12-31 21:54:43 +00:00
|
|
|
${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET}
|
2012-12-15 00:03:35 +00:00
|
|
|
.endif
|
2013-03-28 04:13:52 +00:00
|
|
|
.endif #defined(SHLIB_NAME)
|
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"
|
2015-05-04 16:28:54 +00:00
|
|
|
_LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a
|
2002-05-13 10:53:24 +00:00
|
|
|
|
2016-06-03 19:25:36 +00:00
|
|
|
lib${LIB_PRIVATE}${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}
|
2015-06-02 19:05:02 +00:00
|
|
|
${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD}
|
2014-04-12 12:44:09 +00:00
|
|
|
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
|
1994-10-25 17:55:25 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # !defined(INTERNALLIB)
|
2002-05-13 10:53:24 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
.if defined(_SKIP_BUILD)
|
|
|
|
all:
|
|
|
|
.else
|
2015-09-22 05:05:53 +00:00
|
|
|
.if defined(_LIBS) && !empty(_LIBS)
|
2002-05-13 10:53:24 +00:00
|
|
|
all: ${_LIBS}
|
2015-09-22 05:05:53 +00:00
|
|
|
.endif
|
2002-05-13 10:53:24 +00:00
|
|
|
|
2015-09-18 23:25:43 +00:00
|
|
|
.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
|
2016-02-26 22:13:31 +00:00
|
|
|
all: all-man
|
1994-05-30 19:09:18 +00:00
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
.endif
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2016-11-13 00:10:56 +00:00
|
|
|
CLEANFILES+= ${_LIBS}
|
|
|
|
|
1998-03-07 13:13:41 +00:00
|
|
|
_EXTRADEPEND:
|
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)
|
2015-02-13 17:33:27 +00:00
|
|
|
echo ${SHLIB_NAME_FULL}: ${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
|
2017-08-16 05:02:31 +00:00
|
|
|
.endif
|
2017-09-08 19:20:42 +00:00
|
|
|
# Install libraries with -S to avoid risk of modifying in-use libraries when
|
|
|
|
# installing to a running system. It is safe to avoid this for NO_ROOT builds
|
|
|
|
# that are only creating an image.
|
2017-08-16 05:02:31 +00:00
|
|
|
.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT)
|
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:
|
2015-05-04 16:28:54 +00:00
|
|
|
.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
|
2015-02-13 00:16:05 +00:00
|
|
|
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
2015-10-15 22:49:56 +00:00
|
|
|
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}/
|
2002-05-13 10:53:24 +00:00
|
|
|
.endif
|
2015-05-04 16:28:54 +00:00
|
|
|
.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
|
2015-02-13 00:16:05 +00:00
|
|
|
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},profile} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
2015-10-15 22:49:56 +00:00
|
|
|
${_INSTALLFLAGS} lib${LIB_PRIVATE}${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)
|
2015-02-13 00:16:05 +00:00
|
|
|
${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
1999-07-31 20:27:33 +00:00
|
|
|
${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
|
2015-10-15 22:49:56 +00:00
|
|
|
${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/
|
2013-06-07 21:40:02 +00:00
|
|
|
.if ${MK_DEBUG_FILES} != "no"
|
|
|
|
.if defined(DEBUGMKDIR)
|
2016-01-04 19:19:48 +00:00
|
|
|
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -d ${DESTDIR}${DEBUGFILEDIR}/
|
2013-06-07 21:40:02 +00:00
|
|
|
.endif
|
2015-02-13 00:16:05 +00:00
|
|
|
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},debug} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \
|
2012-12-18 21:13:03 +00:00
|
|
|
${_INSTALLFLAGS} \
|
2015-10-15 22:49:56 +00:00
|
|
|
${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/
|
2012-12-15 00:03:35 +00:00
|
|
|
.endif
|
2015-05-04 16:28:54 +00:00
|
|
|
.if defined(SHLIB_LINK)
|
2014-05-16 14:51:19 +00:00
|
|
|
.if commands(${SHLIB_LINK:R}.ld)
|
2015-02-13 00:16:05 +00:00
|
|
|
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
2014-05-16 14:51:19 +00:00
|
|
|
${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
|
2013-09-08 09:40:23 +00:00
|
|
|
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
|
2015-12-25 11:29:18 +00:00
|
|
|
.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS}
|
|
|
|
${INSTALL_SYMLINK} ${SHLIB_LINK} ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK}
|
|
|
|
.endfor
|
2012-05-07 09:00:30 +00:00
|
|
|
.else
|
2013-09-08 09:40:23 +00:00
|
|
|
.if ${_SHLIBDIR} == ${_LIBDIR}
|
2015-03-05 20:22:28 +00:00
|
|
|
.if ${SHLIB_LINK:Mlib*}
|
2015-09-12 11:41:31 +00:00
|
|
|
${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
|
2003-09-07 14:15:40 +00:00
|
|
|
.else
|
2015-09-12 11:41:31 +00:00
|
|
|
${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
|
2013-09-08 09:40:23 +00:00
|
|
|
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
|
2015-03-05 20:22:28 +00:00
|
|
|
.endif
|
|
|
|
.else
|
|
|
|
.if ${SHLIB_LINK:Mlib*}
|
2015-10-11 15:39:37 +00:00
|
|
|
${INSTALL_RSYMLINK} ${TAG_ARGS:D${TAG_ARGS},development} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
|
|
|
|
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
|
2015-03-05 20:22:28 +00:00
|
|
|
.else
|
2015-10-11 15:39:37 +00:00
|
|
|
${INSTALL_RSYMLINK} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
|
2015-03-05 20:22:28 +00:00
|
|
|
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
|
|
|
|
.endif
|
2013-09-08 09:40:23 +00:00
|
|
|
.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME})
|
|
|
|
-chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME}
|
|
|
|
rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME}
|
2003-09-07 14:15:40 +00:00
|
|
|
.endif
|
2003-09-04 04:29:11 +00:00
|
|
|
.endif
|
2012-05-07 09:00:30 +00:00
|
|
|
.endif # SHLIB_LDSCRIPT
|
|
|
|
.endif # SHLIB_LINK
|
|
|
|
.endif # SHIB_NAME
|
2015-05-04 16:28:54 +00:00
|
|
|
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
|
2015-02-13 00:16:05 +00:00
|
|
|
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},development} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
|
2015-10-15 22:49:56 +00:00
|
|
|
${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/
|
1994-08-04 21:09:27 +00:00
|
|
|
.endif
|
2005-04-11 07:13:29 +00:00
|
|
|
.endif # !defined(INTERNALLIB)
|
2002-05-12 16:01:00 +00:00
|
|
|
|
2013-01-17 17:27:10 +00:00
|
|
|
.if !defined(LIBRARIES_ONLY)
|
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>
|
2015-10-09 21:57:42 +00:00
|
|
|
.include <bsd.confs.mk>
|
2013-01-17 17:27:10 +00:00
|
|
|
.endif
|
|
|
|
|
2002-07-02 12:16:54 +00:00
|
|
|
.include <bsd.links.mk>
|
1994-05-30 19:09:18 +00:00
|
|
|
|
2013-01-24 15:55:24 +00:00
|
|
|
.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
|
2016-02-26 22:13:31 +00:00
|
|
|
realinstall: maninstall
|
|
|
|
.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
|
|
|
|
|
2013-01-17 17:27:10 +00:00
|
|
|
.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
|
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
|
|
|
|
2002-07-03 16:22:43 +00:00
|
|
|
.if defined(LIB) && !empty(LIB)
|
2016-02-24 17:19:05 +00:00
|
|
|
OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
|
2004-01-17 18:51:55 +00:00
|
|
|
.for _S in ${SRCS:N*.[hly]}
|
2017-09-16 05:42:27 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S}
|
2004-01-17 18:51:55 +00:00
|
|
|
.endfor
|
2002-07-03 16:22:43 +00:00
|
|
|
.endif
|
|
|
|
.if defined(SHLIB_NAME) || \
|
|
|
|
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
|
2004-01-17 18:51:55 +00:00
|
|
|
.for _S in ${SRCS:N*.[hly]}
|
2017-09-16 05:42:27 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S}
|
2016-03-02 21:03:42 +00:00
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
Add limited sandbox capability to "make check"
== Rationale ==
r295380 introduced "make check" and consolidated means for running
test code in an attempt to simplify running tests. One could either
install files/libraries/programs and run "make check", or run "make check"
with an explicit CHECKDIR, e.g., `make check CHECKDIR=$(make -V.OBJDIR)``.
One criticism that was received is that "make check" should be run with
the intent of making dev->test->commit easier, which means that the target
audience's workflow should be developers. One developer pattern available
in other opensource projects is to run test code from a developer sandbox,
instead of installing to a system.
== Method ==
This approach is slightly different from the standard approach, in the sense
that it builds and installs into a deterministic directory under .OBJDIR (as I call it,
the "sandbox"), then runs "make check" against that. In the event the test
run is successful, the deterministic directory is removed to save space.
== Approach ==
bsd.lib.mk, bsd.prog.mk:
To support this functionality, a new variable `HAS_TESTS` is being added.
HAS_TESTS enables appropriate behavior with bsd.lib.mk and bsd.prog.mk, as
follows:
- Add "make check" as an available target from the directory.
- Pass down appropriate variables via ${TESTS_ENV}, i.e.,
${TESTS_LD_LIBRARY_PATH} and ${TESTS_PATH}.
One should add "HAS_TESTS" to directories containing tests in them, e.g. from
bin/sh/Makefile,
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
HAS_TESTS doesn't automatically add the tests subdirectory for flexibility
reasons.
bsd.opts.mk, src.opts.mk:
- The knob ${MK_MAKE_CHECK_USE_SANDBOX} has been added, both to explicitly
direct (internally) when to set a deterministic ${DESTDIR} and to also allow
users to disable this behavior globally, i.e., via src.conf.
- MK_TESTS has been promoted from src.opts.mk to bsd.opts.mk to leverage
syntactic sugar for having MK_TESTS be a dependency for
MK_MAKE_CHECK_USE_SANDBOX, but to also ensure that src.opts.mk isn't required
to use suite.test.mk (which is a dependency of bsd.test.mk).
suite.test.mk:
- beforecheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
from a no-op to:
-- Build.
-- Run "make hierarchy" on the sandbox dir.
-- Install the tests/files to the sandbox dir.
- aftercheck behavior (when MK_MAKE_CHECK_USE_SANDBOX is enabled) is modified
from a no-op to:
-- Remove the sandbox dir.
Again, because the dependency order set in bsd.test.mk is
beforecheck -> check -> aftercheck, "make check" will not be run unless
"beforecheck" completes successfully, and "aftercheck" will not be run unless
"beforecheck" and "check" complete successfully.
== Caveats ==
- This target must either be run with MK_INSTALL_AS_USER or as root. Otherwise
it will fail when running "make install" as the default user/group for many
makefiles when calling INSTALL is root/wheel.
- This target must be run from a suitable top-level directory. For example,
running tests from `tests/sys/fs/tmpfs` won't work, but `tests/sys/fs` will,
because `tests/sys/fs/tmpfs` relies on files installed by `tests/sys/fs`.
- Running MK_INSTALL_AS_USER may introduce determinism issues. However, using
it could identify deficiences in tests in terms of needing to be run as
root, which are not properly articulated in the test requirements.
- The doesn't negate the need for running "make installworld" and
"make checkworld", etc. Again, this just is intended to simplify the
dev->test->commit workflow.
== Cleanup done ==
- CHECKDIR is removed; one can use "MK_MAKE_CHECK_USE_SANDBOX=no" to enable
"legacy" (r295380) behavior.
MFC after: 2 months
Relnotes: yes (CHECKDIR removed; "make check" behavior changed)
Requested by: jhb
Reviewed by: arch (silence), testing (silence)
Differential Revision: D11905
2017-08-14 19:03:05 +00:00
|
|
|
.if defined(HAS_TESTS)
|
|
|
|
MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes
|
|
|
|
SUBDIR_TARGETS+= check
|
|
|
|
TESTS_LD_LIBRARY_PATH+= ${.OBJDIR}
|
|
|
|
.endif
|
|
|
|
|
2016-03-02 21:03:42 +00:00
|
|
|
.include <bsd.dep.mk>
|
2016-02-26 22:14:00 +00:00
|
|
|
.include <bsd.clang-analyze.mk>
|
1996-06-24 04:26:21 +00:00
|
|
|
.include <bsd.obj.mk>
|
2001-05-19 23:18:21 +00:00
|
|
|
.include <bsd.sys.mk>
|