Max Khon <f...@freebsd.org> writes: > On Thu, Dec 1, 2011 at 7:16 AM, Alexander Best <arun...@freebsd.org> wrote: >> it would also be nice, if at some point, somebody could dive into the code >> to >> see why 'make buildkernel' will let clang produce coloured output, but >> 'make -j(N>1) buildkernel' doesn't (and why adding a -B switch to that >> command >> fixes it). >> > > This one is simple: job make (-jX) runs commands with stdin/stdout/stderr > redirected to pipes. > -B turns on compat mode for job make. > > This can be demonstrated by running make with -jX or -jX -B with the > following Makefile: > --- cut here --- > all: > @if [ -t 1 ]; then echo "stdout is a tty"; else echo "stdout is not > a tty"; fi > --- cut here --- > > If you really want to see colored output in -jX case you should teach clang > to output ANSI color sequences not only in isatty(1) case, but also > when MAKE_JOBS_FIFO environment variable is present (it is set when make > runs in job mode).
Any way to distinguish between `make -jX' connected to tty and `make -jX' redirected to a file then? Otherwise, inconsistent coloring is still there, e.g. $ make >&build.log $ make -j8 >&build.log Index: contrib/llvm/tools/clang/lib/Driver/Tools.cpp =================================================================== --- contrib/llvm/tools/clang/lib/Driver/Tools.cpp (revision 228149) +++ contrib/llvm/tools/clang/lib/Driver/Tools.cpp (working copy) @@ -2115,7 +2115,8 @@ void Clang::ConstructJob(Compilation &C, const Job // them. if (Args.hasFlag(options::OPT_fcolor_diagnostics, options::OPT_fno_color_diagnostics, - llvm::sys::Process::StandardErrHasColors())) + llvm::sys::Process::StandardErrHasColors() || + ::getenv("MAKE_JOBS_FIFO"))) CmdArgs.push_back("-fcolor-diagnostics"); if (!Args.hasFlag(options::OPT_fshow_source_location, _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"