make(1): allow optional compilation with GCC 10, use gcov from GCC
This commit is contained in:
parent
ee1eefc8ec
commit
6910f1eeb2
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: Makefile,v 1.86 2020/08/10 18:40:24 rillig Exp $
|
# $NetBSD: Makefile,v 1.87 2020/08/12 18:48:36 rillig Exp $
|
||||||
# @(#)Makefile 5.2 (Berkeley) 12/28/90
|
# @(#)Makefile 5.2 (Berkeley) 12/28/90
|
||||||
|
|
||||||
PROG= make
|
PROG= make
|
||||||
@ -44,7 +44,8 @@ HDRS+= trace.h
|
|||||||
# Whether to generate a coverage report after running the tests.
|
# Whether to generate a coverage report after running the tests.
|
||||||
USE_COVERAGE?= no # works only with gcc; clang9 fails to link
|
USE_COVERAGE?= no # works only with gcc; clang9 fails to link
|
||||||
.if ${USE_COVERAGE} == "yes"
|
.if ${USE_COVERAGE} == "yes"
|
||||||
COPTS+= --coverage -O0 -ggdb
|
GCOV?= gcov
|
||||||
|
COPTS+= --coverage -O2 -ggdb
|
||||||
LDADD+= --coverage
|
LDADD+= --coverage
|
||||||
.endif
|
.endif
|
||||||
CLEANFILES+= *.gcda *.gcno *.gcov
|
CLEANFILES+= *.gcda *.gcno *.gcov
|
||||||
@ -56,6 +57,18 @@ COPTS+= -fsanitize=undefined
|
|||||||
LDADD+= -fsanitize=undefined
|
LDADD+= -fsanitize=undefined
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# Whether to compile with GCC 10 from pkgsrc, during development.
|
||||||
|
USE_GCC10?= no
|
||||||
|
.if ${USE_GCC10} == "yes"
|
||||||
|
# CC is set further down in this file
|
||||||
|
COPTS+= -Wno-attributes # for abs and labs
|
||||||
|
COPTS.arch.c+= -Wno-error=format-truncation
|
||||||
|
COPTS.dir.c+= -Wno-error=format-truncation
|
||||||
|
COPTS.main.c+= -Wno-error=format-truncation
|
||||||
|
COPTS.meta.c+= -Wno-error=format-truncation
|
||||||
|
COPTS.parse.c+= -Wno-error=format-truncation
|
||||||
|
.endif
|
||||||
|
|
||||||
# Whether to compile with GCC 9 from pkgsrc, during development.
|
# Whether to compile with GCC 9 from pkgsrc, during development.
|
||||||
USE_GCC9?= no
|
USE_GCC9?= no
|
||||||
.if ${USE_GCC9} == "yes"
|
.if ${USE_GCC9} == "yes"
|
||||||
@ -68,6 +81,17 @@ COPTS.meta.c+= -Wno-error=format-truncation
|
|||||||
COPTS.parse.c+= -Wno-error=format-truncation
|
COPTS.parse.c+= -Wno-error=format-truncation
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
# Whether to compile with GCC 8 from pkgsrc, during development.
|
||||||
|
USE_GCC8?= no
|
||||||
|
.if ${USE_GCC8} == "yes"
|
||||||
|
# CC is set further down in this file
|
||||||
|
COPTS+= -Wno-attributes # for abs and labs
|
||||||
|
COPTS.arch.c+= -Wno-error=format-truncation
|
||||||
|
COPTS.dir.c+= -Wno-error=format-truncation
|
||||||
|
COPTS.main.c+= -Wno-error=format-truncation
|
||||||
|
COPTS.meta.c+= -Wno-error=format-truncation
|
||||||
|
.endif
|
||||||
|
|
||||||
USE_META?= yes
|
USE_META?= yes
|
||||||
.if ${USE_META:tl} != "no"
|
.if ${USE_META:tl} != "no"
|
||||||
|
|
||||||
@ -108,8 +132,22 @@ COPTS.job.c+= -Wno-format-nonliteral
|
|||||||
COPTS.parse.c+= -Wno-format-nonliteral
|
COPTS.parse.c+= -Wno-format-nonliteral
|
||||||
COPTS.var.c+= -Wno-format-nonliteral
|
COPTS.var.c+= -Wno-format-nonliteral
|
||||||
|
|
||||||
|
.if ${USE_GCC10} == "yes"
|
||||||
|
GCC9BASE?= /usr/pkg/gcc10
|
||||||
|
CC= ${GCC10BASE}/bin/gcc
|
||||||
|
GCOV= ${GCC10BASE}/bin/gcov
|
||||||
|
.endif
|
||||||
|
|
||||||
.if ${USE_GCC9} == "yes"
|
.if ${USE_GCC9} == "yes"
|
||||||
CC= /usr/pkg/gcc9/bin/gcc
|
GCC9BASE?= /usr/pkg/gcc9
|
||||||
|
CC= ${GCC9BASE}/bin/gcc
|
||||||
|
GCOV= ${GCC9BASE}/bin/gcov
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.if ${USE_GCC8} == "yes"
|
||||||
|
GCC8BASE?= /usr/pkg/gcc8
|
||||||
|
CC= ${GCC8BASE}/bin/gcc
|
||||||
|
GCOV= ${GCC8BASE}/bin/gcov
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if defined(TOOLDIR)
|
.if defined(TOOLDIR)
|
||||||
@ -132,7 +170,7 @@ test: .MAKE
|
|||||||
cd ${.CURDIR}/unit-tests \
|
cd ${.CURDIR}/unit-tests \
|
||||||
&& MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
|
&& MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
|
||||||
.if ${USE_COVERAGE} == yes
|
.if ${USE_COVERAGE} == yes
|
||||||
gcov ${GCOV_OPTS} ${SRCS}
|
${GCOV} ${GCOV_OPTS} ${SRCS}
|
||||||
sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov
|
sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user