[SLOF] [PATCH slof] make: Define default rule for .c when V=1 or V=2

Alexey Kardashevskiy aik at ozlabs.ru
Tue Mar 31 10:28:17 AEDT 2020



On 11/03/2020 13:37, Alexey Kardashevskiy wrote:
> The default .o:.c rule passes a short file name to gcc to when doing
> "make -C <dir>", we do this a lot for all the libraries.
> The file names printed in gcc errors are relative to <dir> 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 <aik at ozlabs.ru>
> ---
> 
> 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.
> 

Ok, I'll push it out when qemu 5.1 starts.


> 
> ---
>  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
> -
> 

-- 
Alexey


More information about the SLOF mailing list