Help with some makefile hackery

Jilles Tjoelker jilles at stack.nl
Fri Jun 25 13:30:58 UTC 2010


On Tue, Jun 22, 2010 at 11:18:43PM -0700, Patrick Mahan wrote:
> src-kern-tools:
>      cd src; ./<machine>-kernel-toolchain.sh 2>&1 | tee <logfile>

The pipeline will return the status of 'tee' which is almost always 0.
The exit status of the build script is ignored.

A simple fix is store the status in a file and refer to that afterwards.
Another fix uses a separate file descriptor to pass through the status,
like
  { st=$(
    {
      { ./kernel-toolchain.sh 2>&1 3>&- 4>&-; echo $? >&3; } | tee logfile >&4
    } 3>&1)
  } 4>&1
but this is fairly complicated.

The issue can be sidestepped entirely by sending the output to a file
only; a developer can use tail -f to follow the build if necessary.

-- 
Jilles Tjoelker


More information about the freebsd-hackers mailing list