开发者

make output redirection

I want to redirect the output and error stre开发者_如何学运维am of make command to file.

The following command

make 1>&2 ~/tmp/build.log

throws the following error

make: Nothing to be done for `/Users/m/tmp/build.log'.

EDIT:-

Tried

make 2>&1 ~/tmp/build.log

and

make ~/tmp/build.log 2>&1

which gave the same above error message.

I am using mac-leopard os

$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
Copyright (C) 2007 Free Software Foundation, Inc.
Tietos-iMac-2:qt-build ptools$ sh --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
Copyright (C) 2007 Free Software Foundation, Inc.


Should be

make 2>&1 > ~/tmp/build.log


you can also just do:

make &> build.log

"&>" means send stdout and stderr to this file


Realize that this is a bit old, but here's one for posterity.

I often find it useful to pipe the stderr to a file:

make > error.log 2>&1

You can then open up the file in vim while passing the -q flag, this will allow you to rattle forward and backward along the list of errors.

vim -q error.log
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜