]> sourceware.org Git - glibc.git/blob - stdio-common/Makefile
120d66ea9338369a7333f32e7775e1ba21b78fa2
[glibc.git] / stdio-common / Makefile
1 # Copyright (C) 1991-2022 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
13
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
17
18 #
19 # Specific makefile for stdio-common.
20 #
21 subdir := stdio-common
22
23 include ../Makeconfig
24
25 headers := stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
26
27 routines := \
28 _itoa \
29 _itowa \
30 asprintf \
31 ctermid \
32 cuserid \
33 dprintf \
34 flockfile \
35 fprintf \
36 fscanf \
37 ftrylockfile \
38 funlockfile \
39 gentempfd \
40 getline \
41 getw \
42 grouping_iterator \
43 iovfscanf \
44 isoc99_fscanf \
45 isoc99_scanf \
46 isoc99_sscanf \
47 isoc99_vfscanf \
48 isoc99_vscanf \
49 isoc99_vsscanf \
50 itoa-digits \
51 itoa-udigits \
52 itowa-digits \
53 perror \
54 printf \
55 printf-prs \
56 printf_buffer_as_file \
57 printf_buffer_done \
58 printf_buffer_flush \
59 printf_buffer_pad_1 \
60 printf_buffer_putc_1 \
61 printf_buffer_puts_1 \
62 printf_buffer_to_file \
63 printf_buffer_write \
64 printf_fp \
65 printf_fphex \
66 printf_size \
67 psiginfo \
68 psignal \
69 putw \
70 reg-modifier \
71 reg-printf \
72 reg-type \
73 remove \
74 rename \
75 renameat \
76 renameat2 \
77 scanf \
78 snprintf \
79 sprintf \
80 sscanf \
81 tempnam \
82 tempname \
83 tmpfile \
84 tmpfile64 \
85 tmpnam \
86 tmpnam_r \
87 vfprintf \
88 vfprintf-internal \
89 vfscanf \
90 vfscanf-internal \
91 vfwprintf \
92 vfwprintf-internal \
93 vfwscanf \
94 vfwscanf-internal \
95 vprintf \
96 wprintf_buffer_as_file \
97 wprintf_buffer_done \
98 wprintf_buffer_flush \
99 wprintf_buffer_pad_1 \
100 wprintf_buffer_putc_1 \
101 wprintf_buffer_puts_1 \
102 wprintf_buffer_to_file \
103 wprintf_buffer_write \
104 # routines
105
106 aux := \
107 errlist \
108 errlist-data \
109 errname \
110 fxprintf \
111 printf-parsemb \
112 printf-parsewc \
113 siglist \
114 # aux
115
116 tests := \
117 bug-vfprintf-nargs \
118 bug1 \
119 bug10 \
120 bug11 \
121 bug12 \
122 bug13 \
123 bug14 \
124 bug16 \
125 bug17 \
126 bug18 \
127 bug18a \
128 bug19 \
129 bug19a \
130 bug2 \
131 bug20 \
132 bug21 \
133 bug22 \
134 bug23 \
135 bug23-2 \
136 bug23-3 \
137 bug23-4 \
138 bug24 \
139 bug25 \
140 bug26 \
141 bug3 \
142 bug4 \
143 bug5 \
144 bug6 \
145 bug7 \
146 bug8 \
147 bug9 \
148 errnobug \
149 scanf1 \
150 scanf10 \
151 scanf11 \
152 scanf12 \
153 scanf13 \
154 scanf14 \
155 scanf14a \
156 scanf15 \
157 scanf16 \
158 scanf16a \
159 scanf17 \
160 scanf2 \
161 scanf3 \
162 scanf4 \
163 scanf5 \
164 scanf7 \
165 scanf8 \
166 scanf9 \
167 temptest \
168 test-fseek \
169 test-fwrite \
170 test-popen \
171 test-strerr \
172 test-vfprintf \
173 test_rdwr \
174 tfformat \
175 tiformat \
176 tllformat \
177 tst-bz11319 \
178 tst-bz11319-fortify2 \
179 tst-cookie \
180 tst-fdopen \
181 tst-ferror \
182 tst-fgets \
183 tst-fileno \
184 tst-fmemopen \
185 tst-fmemopen2 \
186 tst-fmemopen3 \
187 tst-fmemopen4 \
188 tst-fphex \
189 tst-fphex-wide \
190 tst-fseek \
191 tst-fwrite \
192 tst-gets \
193 tst-grouping \
194 tst-grouping2 \
195 tst-long-dbl-fphex \
196 tst-memstream-string \
197 tst-obprintf \
198 tst-perror \
199 tst-popen \
200 tst-popen2 \
201 tst-printf-binary \
202 tst-printf-bz18872 \
203 tst-printf-bz25691 \
204 tst-printf-fp-free \
205 tst-printf-fp-leak \
206 tst-printf-round \
207 tst-printfsz \
208 tst-put-error \
209 tst-renameat2 \
210 tst-rndseek \
211 tst-scanf-round \
212 tst-setvbuf1 \
213 tst-sprintf \
214 tst-sprintf-errno \
215 tst-sprintf2 \
216 tst-sprintf3 \
217 tst-sscanf \
218 tst-swprintf \
219 tst-swscanf \
220 tst-tmpnam \
221 tst-ungetc \
222 tst-unlockedio \
223 tst-vfprintf-mbs-prec \
224 tst-vfprintf-user-type \
225 tst-vfprintf-width-prec \
226 tst-vfprintf-width-prec-alloc \
227 tst-vfprintf-width-i18n \
228 tst-wc-printf \
229 tstdiomisc \
230 tstgetln \
231 tstscanf \
232 xbug \
233 # tests
234
235 generated += \
236 errlist-data-aux-shared.S \
237 errlist-data-aux.S \
238 siglist-aux-shared.S \
239 siglist-aux.S \
240 # generated
241
242 tests-internal = \
243 tst-grouping_iterator \
244 # tests-internal
245
246 test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble
247
248 ifeq ($(run-built-tests),yes)
249 tests-special += \
250 $(objpfx)tst-printf-bz18872-mem.out \
251 $(objpfx)tst-printf-bz25691-mem.out \
252 $(objpfx)tst-printf-fp-free-mem.out \
253 $(objpfx)tst-printf-fp-leak-mem.out \
254 $(objpfx)tst-printf.out \
255 $(objpfx)tst-printfsz-islongdouble.out \
256 $(objpfx)tst-setvbuf1-cmp.out \
257 $(objpfx)tst-unbputc.out \
258 $(objpfx)tst-vfprintf-width-prec-mem.out \
259 # tests-special
260
261 generated += \
262 tst-printf-bz18872-mem.out \
263 tst-printf-bz18872.c \
264 tst-printf-bz18872.mtrace \
265 tst-printf-bz25691-mem.out \
266 tst-printf-bz25691.mtrace \
267 tst-printf-fp-free-mem.out \
268 tst-printf-fp-free.mtrace \
269 tst-printf-fp-leak-mem.out \
270 tst-printf-fp-leak.mtrace \
271 tst-vfprintf-width-prec-mem.out \
272 tst-vfprintf-width-prec.mtrace \
273 # generated
274 endif # $(run-built-tests)
275
276 tests-special += $(objpfx)tst-errno-manual.out
277
278 include ../Rules
279
280 # The errlist.c is built in two phases because compiler might reorder the
281 # compat_symbol directive prior the object itself and on binutils older
282 # than 2.29 it might generate object sizes different than the expected ones.
283 $(objpfx)errlist-data-aux-shared.S: errlist-data-gen.c
284 $(make-target-directory)
285 $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
286
287 $(objpfx)errlist-data-aux.S: errlist-data-gen.c
288 $(make-target-directory)
289 $(compile-command.c) $(pie-default) $(no-stack-protector) -S
290
291 ifndef no_deps
292 -include $(objpfx)errlist-data-aux.S.d $(objpfx)errlist-data-aux-shared.S.d
293 endif
294
295 $(objpfx)errlist-data.os: $(objpfx)errlist-data-aux-shared.S
296 $(addprefix $(objpfx)errlist-data, $(object-suffixes-noshared)): \
297 $(objpfx)errlist-data-aux.S
298
299 $(objpfx)siglist-aux-shared.S: siglist-gen.c
300 $(make-target-directory)
301 $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
302
303 $(objpfx)siglist-aux.S: siglist-gen.c
304 $(make-target-directory)
305 $(compile-command.c) $(pie-default) $(no-stack-protector) -S
306
307 ifndef no_deps
308 -include $(objpfx)siglist-aux.S.d $(objpfx)siglist-aux-shared.S.d
309 endif
310
311 $(objpfx)siglist.os: $(objpfx)siglist-aux-shared.S
312 $(addprefix $(objpfx)siglist, $(object-suffixes-noshared)): \
313 $(objpfx)siglist-aux.S
314
315 ifeq ($(run-built-tests),yes)
316 LOCALES := \
317 de_DE.ISO-8859-1 \
318 de_DE.UTF-8 \
319 en_US.ISO-8859-1 \
320 hi_IN.UTF-8 \
321 ja_JP.EUC-JP \
322 ps_AF.UTF-8 \
323 tg_TJ.UTF-8 \
324 # LOCALES
325 include ../gen-locales.mk
326
327 $(objpfx)bug14.out: $(gen-locales)
328 $(objpfx)scanf13.out: $(gen-locales)
329 $(objpfx)test-vfprintf.out: $(gen-locales)
330 $(objpfx)tst-grouping.out: $(gen-locales)
331 $(objpfx)tst-grouping2.out: $(gen-locales)
332 $(objpfx)tst-grouping_iterator.out: $(gen-locales)
333 $(objpfx)tst-sprintf.out: $(gen-locales)
334 $(objpfx)tst-sscanf.out: $(gen-locales)
335 $(objpfx)tst-swprintf.out: $(gen-locales)
336 $(objpfx)tst-vfprintf-mbs-prec.out: $(gen-locales)
337 $(objpfx)tst-vfprintf-width-i18n.out: $(gen-locales)
338 endif
339
340 tst-printf-bz18872-ENV = MALLOC_TRACE=$(objpfx)tst-printf-bz18872.mtrace \
341 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
342 tst-vfprintf-width-prec-ENV = \
343 MALLOC_TRACE=$(objpfx)tst-vfprintf-width-prec.mtrace \
344 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
345 tst-printf-bz25691-ENV = \
346 MALLOC_TRACE=$(objpfx)tst-printf-bz25691.mtrace \
347 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
348 tst-printf-fp-free-ENV = \
349 MALLOC_TRACE=$(objpfx)tst-printf-fp-free.mtrace \
350 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
351 tst-printf-fp-leak-ENV = \
352 MALLOC_TRACE=$(objpfx)tst-printf-fp-leak.mtrace \
353 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
354
355 $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
356 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
357 $(evaluate-test)
358
359 $(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
360 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
361 $(evaluate-test)
362
363 $(objpfx)tst-printfsz-islongdouble.out: \
364 tst-printfsz-islongdouble.sh $(objpfx)tst-printfsz-islongdouble
365 $(SHELL) $^ '$(test-program-prefix)' $@; \
366 $(evaluate-test)
367
368 # We generate this source because it requires a printf invocation with
369 # 10K arguments.
370 $(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh
371 rm -f $@ && $(BASH) $^ > $@.new && mv $@.new $@
372
373 $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
374 $(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
375 $(evaluate-test)
376
377 errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
378
379 $(objpfx)tst-errno-manual.out: tst-errno-manual.py \
380 $(errlist-h) \
381 $(..)manual/errno.texi
382 $(PYTHON) tst-errno-manual.py -m $(..)manual/errno.texi \
383 -e $(errlist-h) > $@; \
384 $(evaluate-test)
385
386 CFLAGS-vfprintf.c += -Wno-uninitialized
387 CFLAGS-vfwprintf.c += -Wno-uninitialized
388
389 CFLAGS-tmpfile.c += -fexceptions
390 CFLAGS-tmpfile64.c += -fexceptions
391 CFLAGS-tempname.c += -fexceptions
392 CFLAGS-psignal.c += -fexceptions
393 CFLAGS-vprintf.c += -fexceptions
394 CFLAGS-cuserid.c += -fexceptions
395
396 CFLAGS-vfprintf.c += -fexceptions
397 CFLAGS-fprintf.c += -fexceptions
398 CFLAGS-printf.c += -fexceptions
399 CFLAGS-vfwprintf.c += -fexceptions
400 CFLAGS-vfscanf.c += -fexceptions
401 CFLAGS-vfwscanf.c += -fexceptions
402 CFLAGS-fscanf.c += -fexceptions
403 CFLAGS-scanf.c += -fexceptions
404 CFLAGS-isoc99_vfscanf.c += -fexceptions
405 CFLAGS-isoc99_vscanf.c += -fexceptions
406 CFLAGS-isoc99_fscanf.c += -fexceptions
407 CFLAGS-isoc99_scanf.c += -fexceptions
408
409 CFLAGS-dprintf.c += $(config-cflags-wno-ignored-attributes)
410
411 # scanf14a.c and scanf16a.c test a deprecated extension which is no
412 # longer visible under most conformance levels; see the source files
413 # for more detail.
414 CFLAGS-scanf14a.c += -std=gnu89
415 CFLAGS-scanf16a.c += -std=gnu89
416
417 CFLAGS-bug3.c += -DOBJPFX=\"$(objpfx)\"
418 CFLAGS-bug4.c += -DOBJPFX=\"$(objpfx)\"
419 CFLAGS-bug5.c += -DOBJPFX=\"$(objpfx)\"
420 CFLAGS-test-fseek.c += -DOBJPFX=\"$(objpfx)\"
421 CFLAGS-test-popen.c += -DOBJPFX=\"$(objpfx)\"
422 CFLAGS-test_rdwr.c += -DOBJPFX=\"$(objpfx)\"
423
424 # tst-gets.c tests a deprecated function.
425 CFLAGS-tst-gets.c += -Wno-deprecated-declarations
426
427 # BZ #11319 was first fixed for regular vdprintf, then reopened because
428 # the fortified version had the same bug.
429 CFLAGS-tst-bz11319-fortify2.c += -D_FORTIFY_SOURCE=2
430
431 CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf
432
433 CPPFLAGS += $(libio-mtsafe)
434
435 $(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
436 $(test-program-cmd) > $@ 2>&1; \
437 $(evaluate-test)
438
439 $(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
440 cmp $^ > $@; \
441 $(evaluate-test)
442
443 $(objpfx)tst-printf-round: $(libm)
444 $(objpfx)tst-scanf-round: $(libm)
This page took 0.05347 seconds and 4 git commands to generate.