aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2020-03-11 13:37:22 +1100
committerAlexey Kardashevskiy <aik@ozlabs.ru>2020-05-13 11:25:23 +1000
commit283d88c46c1d4d2ae65f0a3eaf582d0c124d37db (patch)
tree470228304d0c758951ff1871c18bc16332be75db
parent8e012d6fddb62be833d746cef3f03e6c8beecde0 (diff)
downloadSLOF-283d88c46c1d4d2ae65f0a3eaf582d0c124d37db.zip
SLOF-283d88c46c1d4d2ae65f0a3eaf582d0c124d37db.tar.gz
SLOF-283d88c46c1d4d2ae65f0a3eaf582d0c124d37db.tar.bz2
make: Define default rule for .c when V=1 or V=2
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@ozlabs.ru>
-rw-r--r--make.rules5
1 files changed, 4 insertions, 1 deletions
diff --git a/make.rules b/make.rules
index acbc8ab..3dfbb5b 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
-