From owner-svn-src-head@FreeBSD.ORG Thu Dec 1 06:11:29 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64163106566B; Thu, 1 Dec 2011 06:11:29 +0000 (UTC) (envelope-from jbeich@tormail.net) Received: from server2.hudsonvalleyhost.com (server2.hudsonvalleyhost.com [66.7.195.77]) by mx1.freebsd.org (Postfix) with ESMTP id 083678FC12; Thu, 1 Dec 2011 06:11:27 +0000 (UTC) Received: from ec2-46-137-172-133.eu-west-1.compute.amazonaws.com ([46.137.172.133]:41221 helo=internal.tormail.net) by server2.hudsonvalleyhost.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.69) (envelope-from ) id 1RVzBN-001BZb-Hu; Thu, 01 Dec 2011 00:27:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tormail.net; s=tm; h=Message-Id:X-TorMail-User:Content-Type:MIME-Version:Date:References:In-Reply-To:Subject:Cc:To:From; bh=Obv5y+H6ndgJe5FCC4aH0cfK9xgpLNSfjc1elH/Vxac=; b=LG4lSZIzAy/K7NozbUD5+uHSSwbs9tiBlYUmaAp8FmnnIo9b111vGpIiY0YOIdFgshTzg/PXU/2M7RJeVWKYDo+aVaWD6R7t2kmjn+K534lwJgZcp1AqMo1HhSmbxzpsYuBLloUBWiGOKy75L8PqnOiXm4KdjjAihcKFuB377Yg=; Received: from jbeich by internal.tormail.net with local (Exim 4.63) (envelope-from ) id 1RVz9v-000LKd-TK; Thu, 01 Dec 2011 05:26:16 +0000 From: Jan Beich To: Max Khon In-Reply-To: (Max Khon's message of "Thu, 1 Dec 2011 11:05:55 +0700") References: <201111301807.pAUI7cXI008371@svn.freebsd.org> <20111201001646.GA49249@freebsd.org> Date: Thu, 01 Dec 2011 13:25:23 +0800 MIME-Version: 1.0 Content-Type: text/plain X-TorMail-User: jbeich Message-Id: <1RVz9v-000LKd-TK@internal.tormail.net> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server2.hudsonvalleyhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tormail.net X-Source: X-Source-Args: X-Source-Dir: Cc: svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228157 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2011 06:11:29 -0000 Max Khon writes: > On Thu, Dec 1, 2011 at 7:16 AM, Alexander Best 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,