From patchwork Wed Mar 11 02:37:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 1252540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48cbj81MXmz9sPg for ; Wed, 11 Mar 2020 13:37:48 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.ru Received: from lists.ozlabs.org (unknown [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48cbj7727RzDqPg for ; Wed, 11 Mar 2020 13:37:47 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.ru (client-ip=107.174.27.60; helo=ozlabs.ru; envelope-from=aik@ozlabs.ru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.ru Received: from ozlabs.ru (unknown [107.174.27.60]) by lists.ozlabs.org (Postfix) with ESMTP id 48cbj22RtMzDqNm for ; Wed, 11 Mar 2020 13:37:30 +1100 (AEDT) Received: from fstn1-p1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 6651EAE80017; Tue, 10 Mar 2020 22:35:43 -0400 (EDT) From: Alexey Kardashevskiy To: slof@lists.ozlabs.org Date: Wed, 11 Mar 2020 13:37:22 +1100 Message-Id: <20200311023722.97494-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.17.1 Subject: [SLOF] [PATCH slof] make: Define default rule for .c when V=1 or V=2 X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" The default .o:.c rule passes a short file name to gcc to when doing "make -C ", we do this a lot for all the libraries. The file names printed in gcc errors are relative to and this prevents vim from navigating through errors. This passes the full file name to gcc to make it print errors with absolute path so vim can navigate through errors nicely. This makes it optional when V=1 or V=2 is passed. Signed-off-by: Alexey Kardashevskiy --- Or there is a better way of doing this? I find it very annoying to work with ./lib/xxxx as we chdir a lot and gcc does not have a flag to print full file names. --- make.rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/make.rules b/make.rules index acbc8ab8ff5c..3dfbb5b136c2 100644 --- a/make.rules +++ b/make.rules @@ -49,6 +49,10 @@ ifeq ($(V),0) Q := @ MAKEFLAGS += --silent MAKE += -s +else +CURDIR=$(shell pwd) +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $(CURDIR)/$< endif ifeq ($(V),1) @@ -78,4 +82,3 @@ CFLAGS ?= -g -O2 -fno-builtin -ffreestanding -nostdinc -msoft-float \ -fno-stack-protector -fno-asynchronous-unwind-tables $(WARNFLAGS) export CC AS LD CLEAN OBJCOPY OBJDUMP STRIP AR RANLIB CFLAGS -