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 <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
e726fe7d60
commit
076d247142
2
Makefile
2
Makefile
@ -24,7 +24,7 @@ configure: ;
|
|||||||
.PHONY: all clean cscope distclean dvi html info install install-doc \
|
.PHONY: all clean cscope distclean dvi html info install install-doc \
|
||||||
recurse-all speed tar tarbin test build-all
|
recurse-all speed tar tarbin test build-all
|
||||||
|
|
||||||
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
|
$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
|
||||||
|
|
||||||
LIBS+=-lz $(LIBS_TOOLS)
|
LIBS+=-lz $(LIBS_TOOLS)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ include $(SRC_PATH)/rules.mak
|
|||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
|
$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
|
||||||
|
|
||||||
QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
|
QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ include $(HWDIR)/config.mak
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
|
TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
|
||||||
VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
|
$(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
|
||||||
QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
|
QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
|
||||||
|
|
||||||
include $(SRC_PATH)/Makefile.objs
|
include $(SRC_PATH)/Makefile.objs
|
||||||
@ -91,7 +91,8 @@ signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
|
|||||||
|
|
||||||
ifdef CONFIG_LINUX_USER
|
ifdef CONFIG_LINUX_USER
|
||||||
|
|
||||||
VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
|
$(call set-vpath, $(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR))
|
||||||
|
|
||||||
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
|
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
|
||||||
obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \
|
obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \
|
||||||
elfload.o linuxload.o uaccess.o gdbstub.o
|
elfload.o linuxload.o uaccess.o gdbstub.o
|
||||||
@ -122,7 +123,8 @@ endif #CONFIG_LINUX_USER
|
|||||||
|
|
||||||
ifdef CONFIG_DARWIN_USER
|
ifdef CONFIG_DARWIN_USER
|
||||||
|
|
||||||
VPATH+=:$(SRC_PATH)/darwin-user
|
$(call set-vpath, $(SRC_PATH)/darwin-user)
|
||||||
|
|
||||||
QEMU_CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
|
QEMU_CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
|
||||||
|
|
||||||
# Leave some space for the regular program loading zone
|
# Leave some space for the regular program loading zone
|
||||||
@ -147,7 +149,8 @@ endif #CONFIG_DARWIN_USER
|
|||||||
|
|
||||||
ifdef CONFIG_BSD_USER
|
ifdef CONFIG_BSD_USER
|
||||||
|
|
||||||
VPATH+=:$(SRC_PATH)/bsd-user
|
$(call set-vpath, $(SRC_PATH)/bsd-user)
|
||||||
|
|
||||||
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
|
QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
|
||||||
|
|
||||||
obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
|
obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
|
||||||
|
@ -6,11 +6,7 @@ include $(SRC_PATH)/rules.mak
|
|||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
# Do not take %.o from $(SRC_PATH), only %.c and %.h
|
$(call set-vpath, $(SRC_PATH))
|
||||||
# All %.o for user targets should be built with -fpie, when
|
|
||||||
# configured with --enable-user-pie, so we don't want to
|
|
||||||
# take %.o from $(SRC_PATH), since they built without -fpie
|
|
||||||
vpath %.c %.h $(SRC_PATH)
|
|
||||||
|
|
||||||
QEMU_CFLAGS+=-I..
|
QEMU_CFLAGS+=-I..
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ all: build-all
|
|||||||
include ../../config-host.mak
|
include ../../config-host.mak
|
||||||
include $(SRC_PATH)/rules.mak
|
include $(SRC_PATH)/rules.mak
|
||||||
|
|
||||||
VPATH=$(SRC_PATH)/pc-bios/optionrom
|
$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
|
||||||
|
|
||||||
.PHONY : all clean build-all
|
.PHONY : all clean build-all
|
||||||
|
|
||||||
CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
|
CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
|
||||||
|
@ -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 \
|
cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
|
||||||
>/dev/null 2>&1 && echo OK), $2, $3)
|
>/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
|
# Generate timestamp files for .h include files
|
||||||
|
|
||||||
%.h: %.h-timestamp
|
%.h: %.h-timestamp
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
-include ../config-host.mak
|
-include ../config-host.mak
|
||||||
VPATH=$(SRC_PATH)/tests
|
|
||||||
|
$(call set-vpath, $(SRC_PATH)/tests)
|
||||||
|
|
||||||
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
|
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
|
||||||
#CFLAGS+=-msse2
|
#CFLAGS+=-msse2
|
||||||
|
Loading…
Reference in New Issue
Block a user