When compiling C++ sources and BUILDSEED is set, pass down

-frandom-seed with a reduced version of .ALLSRC and .TARGET
as argument.  This allows bit-identical builds of C++ files.
This commit is contained in:
joerg 2008-08-04 16:02:25 +00:00
parent ba0675032b
commit 9259cd05bd
2 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.README,v 1.216 2008/07/29 04:40:14 mrg Exp $
# $NetBSD: bsd.README,v 1.217 2008/08/04 16:02:25 joerg Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the make "include" files for the NetBSD
@ -1267,6 +1267,13 @@ AS Assembler. [as]
AFLAGS Options to ${CC} when compiling or linking .s or .S
assembly source files. []
BUILDSEED GCC uses random numbers when compiling C++ code.
If this option is present, seed the random number
generator based on the value, source file names and
the output file name to make builds more deterministic.
Additional information is available in the GCC
documentation of -frandom-seed.
CC C compiler. [cc]
CFLAGS Options to ${CC}. [Usually -O or -O2]

View File

@ -1,4 +1,4 @@
# $NetBSD: sys.mk,v 1.97 2008/05/06 22:19:11 uwe Exp $
# $NetBSD: sys.mk,v 1.98 2008/08/04 16:02:25 joerg Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run NetBSD.
@ -51,7 +51,13 @@ LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-std=gnu99}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
__ALLSRC1= ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
__ALLSRC2= ${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}
__ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}}
_CXXSEED?= ${BUILDSEED:D-frandom-seed=${BUILDSEED:Q}/${__ALLSRC3:O:Q}/${.TARGET:Q}}
COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}