job-output-long-lines.mk revision 1.2
190071Ssobomax# $NetBSD: job-output-long-lines.mk,v 1.2 2020/09/29 18:16:24 rillig Exp $
290071Ssobomax#
390071Ssobomax# The jobs may produce long lines of output.  A practical case are the echoed
4168053Sdelphij# command lines from compiler invocations, with their many -D options.
590071Ssobomax#
690071Ssobomax# Each of these lines must be written atomically to the actual output.
790071Ssobomax# The markers for switching jobs must always be written at the beginning of
8177423Sdelphij# the line, to make them clearly visible in large log files.
9177423Sdelphij# 
1090071Ssobomax# As of 2020-09-27, the default job buffer size is 1024.  When a job produces
1190071Ssobomax# output lines that are longer than this buffer size, these output pieces are
12146297Sobrien# not terminated by a newline.  Because of this missing newline, the job
13146297Sobrien# markers "--- job-a ---" and "--- job-b ---" are not always written at the
14167983Sdelphij# beginning of a line, even though this is expected by anyone reading the log
15167983Sdelphij# files.
16146297Sobrien
17146297Sobrien.MAKEFLAGS: -j2
18146297Sobrien
19146297Sobrien100:=	${:U1:S,1,2222222222,g:S,2,3333333333,g}
20146297Sobrien10000:=	${100:S,3,4444444444,g:S,4,xxxxxxxxxx,g}
21146297Sobrien
22146297Sobrienall: job-a job-b
23146297Sobrien
24146297Sobrienjob-a:
2590071Ssobomax.for i in ${:U:range=100}
26146297Sobrien	@echo ${10000:S,x,a,g}
27146297Sobrien.endfor
28
29job-b:
30.for i in ${:U:range=100}
31	@echo ${10000:S,x,b,g}
32.endfor
33