| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: Makefile,v 1.118 2021/12/12 10:33:03 rillig Exp $ | | 1 | # $NetBSD: Makefile,v 1.119 2021/12/12 10:53:37 rillig Exp $ |
2 | # @(#)Makefile 5.2 (Berkeley) 12/28/90 | | 2 | # @(#)Makefile 5.2 (Berkeley) 12/28/90 |
3 | | | 3 | |
4 | PROG= make | | 4 | PROG= make |
5 | SRCS= arch.c | | 5 | SRCS= arch.c |
6 | SRCS+= buf.c | | 6 | SRCS+= buf.c |
7 | SRCS+= compat.c | | 7 | SRCS+= compat.c |
8 | SRCS+= cond.c | | 8 | SRCS+= cond.c |
9 | SRCS+= dir.c | | 9 | SRCS+= dir.c |
10 | SRCS+= for.c | | 10 | SRCS+= for.c |
11 | SRCS+= hash.c | | 11 | SRCS+= hash.c |
12 | SRCS+= job.c | | 12 | SRCS+= job.c |
13 | SRCS+= lst.c | | 13 | SRCS+= lst.c |
14 | SRCS+= main.c | | 14 | SRCS+= main.c |
| @@ -24,28 +24,29 @@ SRCS+= var.c | | | @@ -24,28 +24,29 @@ SRCS+= var.c |
24 | SRCS+= util.c | | 24 | SRCS+= util.c |
25 | | | 25 | |
26 | # Whether to generate a coverage report after running the tests. | | 26 | # Whether to generate a coverage report after running the tests. |
27 | USE_COVERAGE?= no # works only with gcc; clang9 fails to link | | 27 | USE_COVERAGE?= no # works only with gcc; clang9 fails to link |
28 | .if ${USE_COVERAGE} == "yes" | | 28 | .if ${USE_COVERAGE} == "yes" |
29 | GCOV?= gcov | | 29 | GCOV?= gcov |
30 | COPTS+= --coverage -O0 -ggdb | | 30 | COPTS+= --coverage -O0 -ggdb |
31 | GCOV_PERL= if (/^File '(?:.*\/)?(\S+)'/) { | | 31 | GCOV_PERL= if (/^File '(?:.*\/)?(\S+)'/) { |
32 | GCOV_PERL+= $$file = $$1; $$func = ""; | | 32 | GCOV_PERL+= $$file = $$1; $$func = ""; |
33 | GCOV_PERL+= } elsif (/^Function '(\S+)'/) { | | 33 | GCOV_PERL+= } elsif (/^Function '(\S+)'/) { |
34 | GCOV_PERL+= $$func = $$1; | | 34 | GCOV_PERL+= $$func = $$1; |
35 | GCOV_PERL+= } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/ && defined($$file)) { | | 35 | GCOV_PERL+= } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/ && defined($$file)) { |
36 | GCOV_PERL+= my ($$percent, $$lines) = ($$1, $$2); | | 36 | GCOV_PERL+= my ($$percent, $$lines) = ($$1, $$2); |
37 | GCOV_PERL+= my $$uncovered = $$file =~ /\.h$$/ | | 37 | GCOV_PERL+= my $$uncovered = |
38 | GCOV_PERL+= ? '?' | | 38 | GCOV_PERL+= $$percent eq '100.00' ? '0' |
| | | 39 | GCOV_PERL+= : $$file =~ /\.h$$/ ? '?' |
39 | GCOV_PERL+= : `grep -c '\#\#\#\#\#:' < \$$(basename $$file.gcov)`; | | 40 | GCOV_PERL+= : `grep -c '\#\#\#\#\#:' < \$$(basename $$file.gcov)`; |
40 | GCOV_PERL+= chomp($$uncovered); | | 41 | GCOV_PERL+= chomp($$uncovered); |
41 | GCOV_PERL+= printf("%7.2f %4s/%4d %s%s\n", | | 42 | GCOV_PERL+= printf("%7.2f %4s/%4d %s%s\n", |
42 | GCOV_PERL+= $$percent, $$uncovered, $$lines, $$file, $$func); | | 43 | GCOV_PERL+= $$percent, $$uncovered, $$lines, $$file, $$func); |
43 | GCOV_PERL+= $$file = undef; | | 44 | GCOV_PERL+= $$file = undef; |
44 | GCOV_PERL+= } | | 45 | GCOV_PERL+= } |
45 | LDADD+= --coverage | | 46 | LDADD+= --coverage |
46 | .endif | | 47 | .endif |
47 | CLEANFILES+= *.gcda *.gcno *.gcov | | 48 | CLEANFILES+= *.gcda *.gcno *.gcov |
48 | | | 49 | |
49 | # Whether to compile using the Undefined Behavior Sanitizer (GCC, Clang). | | 50 | # Whether to compile using the Undefined Behavior Sanitizer (GCC, Clang). |
50 | USE_UBSAN?= no | | 51 | USE_UBSAN?= no |
51 | .if ${USE_UBSAN} == "yes" | | 52 | .if ${USE_UBSAN} == "yes" |