Help with some makefile hackery

perryh at pluto.rain.com perryh at pluto.rain.com
Sat Jun 26 07:40:59 UTC 2010


Patrick Mahan <mahan at mahan.org> wrote:

> Maybe I should do this instead?
>
> src-kernel: src-kernel-tools
> 	cd src; ./amd64-kernel.sh 2>&1 > build_amd64_kernel.log; \
> 		tail -f build_amd64_kernel.log
>
> It is not too clear if the status is the last one in a compound
> command.

Someone already noted that this will not run tail until after the
build finishes; then you'll see the last 10 lines of the log and
make will stop until something (like kill) causes tail to exit.
Another problem arises from the order of the redirections:  only
the script's normal output will go to the logfile; errors will go
to make's standard output.

This should do more or less what I think you're trying for:

src-kernel: src-kernel-tools
	touch src/build_amd64_kernel.log
	tail -f src/build_amd64_kernel.log &
	cd src; ./amd64-kernel.sh > build_amd64_kernel.log 2>&1

IOW start tail in the background, after ensuring that the logfile
exists so tail doesn't immediately exit with an error.  Note that
this does not solve the problem of somehow getting rid of the tail
process after the build finishes.


More information about the freebsd-hackers mailing list