Mon Aug 31 06:44:12 2020 UTC ()
make(1): fix copy-and-paste mistake for compiling with GCC10


(rillig)
diff -r1.96 -r1.97 src/usr.bin/make/Makefile

cvs diff -r1.96 -r1.97 src/usr.bin/make/Makefile (switch to unified diff)

--- src/usr.bin/make/Makefile 2020/08/28 20:57:54 1.96
+++ src/usr.bin/make/Makefile 2020/08/31 06:44:12 1.97
@@ -1,189 +1,189 @@ @@ -1,189 +1,189 @@
1# $NetBSD: Makefile,v 1.96 2020/08/28 20:57:54 rillig Exp $ 1# $NetBSD: Makefile,v 1.97 2020/08/31 06:44:12 rillig Exp $
2# @(#)Makefile 5.2 (Berkeley) 12/28/90 2# @(#)Makefile 5.2 (Berkeley) 12/28/90
3 3
4PROG= make 4PROG= make
5SRCS= arch.c 5SRCS= arch.c
6SRCS+= buf.c 6SRCS+= buf.c
7SRCS+= compat.c 7SRCS+= compat.c
8SRCS+= cond.c 8SRCS+= cond.c
9SRCS+= dir.c 9SRCS+= dir.c
10SRCS+= enum.c 10SRCS+= enum.c
11SRCS+= for.c 11SRCS+= for.c
12SRCS+= hash.c 12SRCS+= hash.c
13SRCS+= job.c 13SRCS+= job.c
14SRCS+= lst.c 14SRCS+= lst.c
15SRCS+= main.c 15SRCS+= main.c
16SRCS+= make.c 16SRCS+= make.c
17SRCS+= make_malloc.c 17SRCS+= make_malloc.c
18SRCS+= metachar.c 18SRCS+= metachar.c
19SRCS+= parse.c 19SRCS+= parse.c
20SRCS+= str.c 20SRCS+= str.c
21SRCS+= strlist.c 21SRCS+= strlist.c
22SRCS+= suff.c 22SRCS+= suff.c
23SRCS+= targ.c 23SRCS+= targ.c
24SRCS+= trace.c 24SRCS+= trace.c
25SRCS+= var.c 25SRCS+= var.c
26SRCS+= util.c 26SRCS+= util.c
27HDRS= buf.h 27HDRS= buf.h
28HDRS+= config.h 28HDRS+= config.h
29HDRS+= dir.h 29HDRS+= dir.h
30HDRS+= enum.h 30HDRS+= enum.h
31HDRS+= hash.h 31HDRS+= hash.h
32HDRS+= job.h 32HDRS+= job.h
33HDRS+= lst.h 33HDRS+= lst.h
34HDRS+= make.h 34HDRS+= make.h
35HDRS+= make_malloc.h 35HDRS+= make_malloc.h
36HDRS+= meta.h 36HDRS+= meta.h
37HDRS+= metachar.h 37HDRS+= metachar.h
38HDRS+= nonints.h 38HDRS+= nonints.h
39HDRS+= pathnames.h 39HDRS+= pathnames.h
40HDRS+= strlist.h 40HDRS+= strlist.h
41HDRS+= trace.h 41HDRS+= trace.h
42 42
43# Whether to generate a coverage report after running the tests. 43# Whether to generate a coverage report after running the tests.
44USE_COVERAGE?= no # works only with gcc; clang9 fails to link 44USE_COVERAGE?= no # works only with gcc; clang9 fails to link
45.if ${USE_COVERAGE} == "yes" 45.if ${USE_COVERAGE} == "yes"
46GCOV?= gcov 46GCOV?= gcov
47COPTS+= --coverage -O0 -ggdb 47COPTS+= --coverage -O0 -ggdb
48LDADD+= --coverage 48LDADD+= --coverage
49.endif 49.endif
50CLEANFILES+= *.gcda *.gcno *.gcov 50CLEANFILES+= *.gcda *.gcno *.gcov
51 51
52# Whether to compile using the Undefined Behavior Sanitizer (GCC, Clang). 52# Whether to compile using the Undefined Behavior Sanitizer (GCC, Clang).
53USE_UBSAN?= no 53USE_UBSAN?= no
54.if ${USE_UBSAN} == "yes" 54.if ${USE_UBSAN} == "yes"
55COPTS+= -fsanitize=undefined 55COPTS+= -fsanitize=undefined
56LDADD+= -fsanitize=undefined 56LDADD+= -fsanitize=undefined
57.endif 57.endif
58 58
59# Whether to compile with GCC 10 from pkgsrc, during development. 59# Whether to compile with GCC 10 from pkgsrc, during development.
60USE_GCC10?= no 60USE_GCC10?= no
61.if ${USE_GCC10} == "yes" 61.if ${USE_GCC10} == "yes"
62# CC is set further down in this file 62# CC is set further down in this file
63COPTS+= -Wno-attributes # for abs and labs 63COPTS+= -Wno-attributes # for abs and labs
64COPTS.arch.c+= -Wno-error=format-truncation 64COPTS.arch.c+= -Wno-error=format-truncation
65COPTS.dir.c+= -Wno-error=format-truncation 65COPTS.dir.c+= -Wno-error=format-truncation
66COPTS.main.c+= -Wno-error=format-truncation 66COPTS.main.c+= -Wno-error=format-truncation
67COPTS.meta.c+= -Wno-error=format-truncation 67COPTS.meta.c+= -Wno-error=format-truncation
68COPTS.parse.c+= -Wno-error=format-truncation 68COPTS.parse.c+= -Wno-error=format-truncation
69.endif 69.endif
70 70
71# Whether to compile with GCC 9 from pkgsrc, during development. 71# Whether to compile with GCC 9 from pkgsrc, during development.
72USE_GCC9?= no 72USE_GCC9?= no
73.if ${USE_GCC9} == "yes" 73.if ${USE_GCC9} == "yes"
74# CC is set further down in this file 74# CC is set further down in this file
75COPTS+= -Wno-attributes # for abs and labs 75COPTS+= -Wno-attributes # for abs and labs
76COPTS.arch.c+= -Wno-error=format-truncation 76COPTS.arch.c+= -Wno-error=format-truncation
77COPTS.dir.c+= -Wno-error=format-truncation 77COPTS.dir.c+= -Wno-error=format-truncation
78COPTS.main.c+= -Wno-error=format-truncation 78COPTS.main.c+= -Wno-error=format-truncation
79COPTS.meta.c+= -Wno-error=format-truncation 79COPTS.meta.c+= -Wno-error=format-truncation
80COPTS.parse.c+= -Wno-error=format-truncation 80COPTS.parse.c+= -Wno-error=format-truncation
81.endif 81.endif
82 82
83# Whether to compile with GCC 8 from pkgsrc, during development. 83# Whether to compile with GCC 8 from pkgsrc, during development.
84USE_GCC8?= no 84USE_GCC8?= no
85.if ${USE_GCC8} == "yes" 85.if ${USE_GCC8} == "yes"
86# CC is set further down in this file 86# CC is set further down in this file
87COPTS+= -Wno-attributes # for abs and labs 87COPTS+= -Wno-attributes # for abs and labs
88COPTS.arch.c+= -Wno-error=format-truncation 88COPTS.arch.c+= -Wno-error=format-truncation
89COPTS.dir.c+= -Wno-error=format-truncation 89COPTS.dir.c+= -Wno-error=format-truncation
90COPTS.main.c+= -Wno-error=format-truncation 90COPTS.main.c+= -Wno-error=format-truncation
91COPTS.meta.c+= -Wno-error=format-truncation 91COPTS.meta.c+= -Wno-error=format-truncation
92.endif 92.endif
93 93
94USE_META?= yes 94USE_META?= yes
95.if ${USE_META:tl} != "no" 95.if ${USE_META:tl} != "no"
96 96
97SRCS+= meta.c 97SRCS+= meta.c
98CPPFLAGS+= -DUSE_META 98CPPFLAGS+= -DUSE_META
99 99
100USE_FILEMON?= ktrace 100USE_FILEMON?= ktrace
101. if ${USE_FILEMON:tl} != "no" 101. if ${USE_FILEMON:tl} != "no"
102 102
103.PATH: ${.CURDIR}/filemon 103.PATH: ${.CURDIR}/filemon
104SRCS+= filemon_${USE_FILEMON}.c 104SRCS+= filemon_${USE_FILEMON}.c
105CPPFLAGS+= -DUSE_FILEMON 105CPPFLAGS+= -DUSE_FILEMON
106CPPFLAGS+= -DUSE_FILEMON_${USE_FILEMON:tu} 106CPPFLAGS+= -DUSE_FILEMON_${USE_FILEMON:tu}
107 107
108. if ${USE_FILEMON} == "dev" 108. if ${USE_FILEMON} == "dev"
109FILEMON_H?= /usr/include/dev/filemon/filemon.h 109FILEMON_H?= /usr/include/dev/filemon/filemon.h
110. if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h" 110. if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
111COPTS.filemon_dev.c+= \ 111COPTS.filemon_dev.c+= \
112 -DHAVE_FILEMON_H -I${FILEMON_H:H} 112 -DHAVE_FILEMON_H -I${FILEMON_H:H}
113. endif 113. endif
114. endif 114. endif
115. endif 115. endif
116.endif 116.endif
117 117
118SUBDIR.roff+= PSD.doc 118SUBDIR.roff+= PSD.doc
119.if make(obj) || make(clean) 119.if make(obj) || make(clean)
120SUBDIR+= unit-tests 120SUBDIR+= unit-tests
121.endif 121.endif
122 122
123${SRCS:M*.c:.c=.o}: ${HDRS} 123${SRCS:M*.c:.c=.o}: ${HDRS}
124 124
125.include <bsd.prog.mk> 125.include <bsd.prog.mk>
126.include <bsd.subdir.mk> 126.include <bsd.subdir.mk>
127 127
128CPPFLAGS+= -DMAKE_NATIVE 128CPPFLAGS+= -DMAKE_NATIVE
129COPTS.job.c+= -Wno-format-nonliteral 129COPTS.job.c+= -Wno-format-nonliteral
130COPTS.parse.c+= -Wno-format-nonliteral 130COPTS.parse.c+= -Wno-format-nonliteral
131COPTS.var.c+= -Wno-format-nonliteral 131COPTS.var.c+= -Wno-format-nonliteral
132 132
133.if ${USE_GCC10} == "yes" 133.if ${USE_GCC10} == "yes"
134GCC9BASE?= /usr/pkg/gcc10 134GCC10BASE?= /usr/pkg/gcc10
135CC= ${GCC10BASE}/bin/gcc 135CC= ${GCC10BASE}/bin/gcc
136GCOV= ${GCC10BASE}/bin/gcov 136GCOV= ${GCC10BASE}/bin/gcov
137.endif 137.endif
138 138
139.if ${USE_GCC9} == "yes" 139.if ${USE_GCC9} == "yes"
140GCC9BASE?= /usr/pkg/gcc9 140GCC9BASE?= /usr/pkg/gcc9
141CC= ${GCC9BASE}/bin/gcc 141CC= ${GCC9BASE}/bin/gcc
142GCOV= ${GCC9BASE}/bin/gcov 142GCOV= ${GCC9BASE}/bin/gcov
143.endif 143.endif
144 144
145.if ${USE_GCC8} == "yes" 145.if ${USE_GCC8} == "yes"
146GCC8BASE?= /usr/pkg/gcc8 146GCC8BASE?= /usr/pkg/gcc8
147CC= ${GCC8BASE}/bin/gcc 147CC= ${GCC8BASE}/bin/gcc
148GCOV= ${GCC8BASE}/bin/gcov 148GCOV= ${GCC8BASE}/bin/gcov
149.endif 149.endif
150 150
151.if defined(TOOLDIR) 151.if defined(TOOLDIR)
152# This is a native NetBSD build, use libutil rather than the local emalloc etc. 152# This is a native NetBSD build, use libutil rather than the local emalloc etc.
153CPPFLAGS+= -DUSE_EMALLOC 153CPPFLAGS+= -DUSE_EMALLOC
154LDADD+= -lutil 154LDADD+= -lutil
155DPADD+= ${LIBUTIL} 155DPADD+= ${LIBUTIL}
156.endif 156.endif
157 157
158COPTS.arch.c+= ${GCC_NO_FORMAT_TRUNCATION} 158COPTS.arch.c+= ${GCC_NO_FORMAT_TRUNCATION}
159COPTS.dir.c+= ${GCC_NO_FORMAT_TRUNCATION} 159COPTS.dir.c+= ${GCC_NO_FORMAT_TRUNCATION}
160COPTS.main.c+= ${GCC_NO_FORMAT_TRUNCATION} ${GCC_NO_STRINGOP_TRUNCATION} 160COPTS.main.c+= ${GCC_NO_FORMAT_TRUNCATION} ${GCC_NO_STRINGOP_TRUNCATION}
161COPTS.meta.c+= ${GCC_NO_FORMAT_TRUNCATION} 161COPTS.meta.c+= ${GCC_NO_FORMAT_TRUNCATION}
162COPTS.parse.c+= ${GCC_NO_FORMAT_TRUNCATION} 162COPTS.parse.c+= ${GCC_NO_FORMAT_TRUNCATION}
163 163
164COPTS+= -Wdeclaration-after-statement 164COPTS+= -Wdeclaration-after-statement
165 165
166# For -DCLEANUP and similar feature toggles. 166# For -DCLEANUP and similar feature toggles.
167CPPFLAGS+= ${USER_CPPFLAGS} 167CPPFLAGS+= ${USER_CPPFLAGS}
168# For overriding -std=gnu99 or similar options. 168# For overriding -std=gnu99 or similar options.
169CFLAGS+= ${USER_CFLAGS} 169CFLAGS+= ${USER_CFLAGS}
170 170
171# A simple unit-test driver to help catch regressions 171# A simple unit-test driver to help catch regressions
172TEST_MAKE ?= ${.OBJDIR}/${PROG:T} 172TEST_MAKE ?= ${.OBJDIR}/${PROG:T}
173test: .MAKE 173test: .MAKE
174 cd ${.CURDIR}/unit-tests \ 174 cd ${.CURDIR}/unit-tests \
175 && MAKEFLAGS= ${TEST_MAKE} -r -m / TEST_MAKE=${TEST_MAKE} ${TESTS:DTESTS=${TESTS:Q}} ${.TARGET} 175 && MAKEFLAGS= ${TEST_MAKE} -r -m / TEST_MAKE=${TEST_MAKE} ${TESTS:DTESTS=${TESTS:Q}} ${.TARGET}
176.if ${USE_COVERAGE} == yes 176.if ${USE_COVERAGE} == yes
177 ${GCOV} ${GCOV_OPTS} ${SRCS} 177 ${GCOV} ${GCOV_OPTS} ${SRCS}
178 sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov 178 sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov
179.endif 179.endif
180 180
181accept sync-mi: .MAKE 181accept sync-mi: .MAKE
182 cd ${.CURDIR}/unit-tests && ${.MAKE} ${.TARGET} 182 cd ${.CURDIR}/unit-tests && ${.MAKE} ${.TARGET}
183 183
184retest: 184retest:
185 ${.MAKE} -C ${.CURDIR}/unit-tests cleandir 185 ${.MAKE} -C ${.CURDIR}/unit-tests cleandir
186.if ${USE_COVERAGE} == yes 186.if ${USE_COVERAGE} == yes
187 rm -f *.gcov *.gcda 187 rm -f *.gcov *.gcda
188.endif 188.endif
189 ${.MAKE} test 189 ${.MAKE} test