From 076d247142c1ff1e4d618557fc0acc62f6eb2a7c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 21 Dec 2009 10:06:55 +0100 Subject: Use vpath directive The vpath directive has two advantages over the VPATH variable: 1) it allows to skip searching of .o files; 2) the default semantics are to append to the vpath, so there is no confusion between "VPATH=xyz" and "VPATH+=xyz". Since "vpath %.c %.h PATH" is not valid, I'm introducing a wrapper macro to append one or more directories to the vpath. Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- rules.mak | 2 ++ 1 file changed, 2 insertions(+) (limited to 'rules.mak') diff --git a/rules.mak b/rules.mak index 9bcf9af..094dc09 100644 --- a/rules.mak +++ b/rules.mak @@ -39,6 +39,8 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \ >/dev/null 2>&1 && echo OK), $2, $3) +set-vpath = $(if $1,$(foreach PATTERN,%.c %.h %.S, $(eval vpath $(PATTERN) $1))) + # Generate timestamp files for .h include files %.h: %.h-timestamp -- cgit v1.1