On Mon, 24 Apr 2017 23:59:36 +0000, Kaz Kylheku wrote:
> On 2017-04-24, James <
hsle...@yahoo.com> wrote:
>> What I meant was the output was interleaved. It is not about make, but
>> about logging in parallel. For example,
>>
>> for f in `seq 1000`; do
>> (echo Printing $f `date`; sleep 3) &
>> done > output wait
>
> I would solve this problem by fixing the makefile.
>
> Decent makefiles nowadays don't display the steps, but a summary of what
> is going on which is output by make itself. That output doesn't get
> interleaved: e.g.
>
> CC foo.o
> CC bar.o
> LINK program foo.o bar.o
Short answer:
The output can still be interleaved, it typically isn't because the
entire "CC foo.o" is output as a single write call.
These days GNU make has a "-Otarget" option which causes make itself to
buffer all the output for each target and output it in a non interleaved
manner.
Qualifications:
If you are not doing a recursive make,
and your make program is single threaded (like GNU make)
and you are actually doing the outputting from make itself rather than
using an external program like "echo" as the linux kernel build system
does,
then
you can have a "Decent makefile" in the sense that Kaz is using it.