mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
build: replace $(BASEDIR) and use $(srctree)
$(srctree) is a better description for the source directory than $(BASEDIR) that has been used for both source and build directory (which where the same). This adds $(srctree) to a few path where make's VPATH=$(srctree) won't apply. And replace $(BASEDIR) by $(srctree). Introduce "$(srcdir)" as a shortcut for "$(srctree)/$(src)" as the later is used often enough. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com> # XSM
This commit is contained in:
1 parent
915e67b75c
commit
bc8d05dd2d
12 files changed
+35
-30
No files matched your search
+2
-2
@@ -14,14 +14,14 @@ config CC_IS_GCC
|
||||
|
||||
config GCC_VERSION
|
||||
int
|
||||
default $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC))
|
||||
default $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
|
||||
|
||||
config CC_IS_CLANG
|
||||
def_bool $(success,$(CC) --version | head -n 1 | grep -q clang)
|
||||
|
||||
config CLANG_VERSION
|
||||
int
|
||||
default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC))
|
||||
default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
|
||||
|
||||
# -fvisibility=hidden reduces -fpic cost, if it's available
|
||||
config CC_HAS_VISIBILITY_ATTRIBUTE
|
||||
|
||||
+3
-4
@@ -19,8 +19,7 @@ export PYTHON ?= $(PYTHON_INTERPRETER)
|
||||
|
||||
export CHECKPOLICY ?= checkpolicy
|
||||
|
||||
export BASEDIR := $(CURDIR)
|
||||
export XEN_ROOT := $(BASEDIR)/..
|
||||
export XEN_ROOT := $(CURDIR)/..
|
||||
|
||||
abs_objtree := $(CURDIR)
|
||||
abs_srctree := $(CURDIR)
|
||||
@@ -189,7 +188,7 @@ ifeq ($(TARGET_ARCH),x86)
|
||||
t1 = $(call as-insn,$(CC),".L0: .L1: .skip (.L1 - .L0)",,-no-integrated-as)
|
||||
|
||||
# Check whether clang asm()-s support .include.
|
||||
t2 = $(call as-insn,$(CC) -I$(BASEDIR)/arch/x86/include,".include \"asm/asm-defns.h\"",,-no-integrated-as)
|
||||
t2 = $(call as-insn,$(CC) -I$(srctree)/arch/x86/include,".include \"asm/asm-defns.h\"",,-no-integrated-as)
|
||||
|
||||
# Check whether clang keeps .macro-s between asm()-s:
|
||||
# https://bugs.llvm.org/show_bug.cgi?id=36110
|
||||
@@ -326,7 +325,7 @@ ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
|
||||
|
||||
ALL_LIBS-y := lib/lib.a
|
||||
|
||||
include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk
|
||||
include $(srctree)/arch/$(TARGET_ARCH)/arch.mk
|
||||
|
||||
# define new variables to avoid the ones defined in Config.mk
|
||||
export XEN_CFLAGS := $(CFLAGS)
|
||||
|
||||
+6
-3
@@ -9,13 +9,16 @@ endif
|
||||
|
||||
src := $(obj)
|
||||
|
||||
# shortcuts
|
||||
srcdir := $(srctree)/$(src)
|
||||
|
||||
PHONY := __build
|
||||
__build:
|
||||
|
||||
-include $(objtree)/include/config/auto.conf
|
||||
|
||||
include $(XEN_ROOT)/Config.mk
|
||||
include $(BASEDIR)/scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
# Initialise some variables
|
||||
obj-y :=
|
||||
@@ -58,7 +61,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
|
||||
# binfile
|
||||
# use e.g. $(call if_changed,binfile,binary-file varname)
|
||||
quiet_cmd_binfile = BINFILE $@
|
||||
cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
|
||||
cmd_binfile = $(SHELL) $(srctree)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
|
||||
|
||||
# Figure out what we need to build from the various variables
|
||||
# ===========================================================================
|
||||
@@ -177,7 +180,7 @@ cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))
|
||||
c_flags = -MMD -MP -MF $(depfile) $(XEN_CFLAGS)
|
||||
a_flags = -MMD -MP -MF $(depfile) $(XEN_AFLAGS)
|
||||
|
||||
include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
|
||||
include $(srctree)/arch/$(TARGET_ARCH)/Rules.mk
|
||||
|
||||
c_flags += $(_c_flags)
|
||||
a_flags += $(_c_flags)
|
||||
|
||||
@@ -153,7 +153,7 @@ $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
|
||||
>$(@D)/$(@F).map
|
||||
rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
|
||||
ifeq ($(CONFIG_XEN_IBT),y)
|
||||
$(SHELL) $(BASEDIR)/tools/check-endbr.sh $@
|
||||
$(SHELL) $(srctree)/tools/check-endbr.sh $@
|
||||
endif
|
||||
|
||||
$(obj)/note.o: $(TARGET)-syms
|
||||
@@ -226,7 +226,7 @@ endif
|
||||
| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/$(@F).map
|
||||
rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
|
||||
ifeq ($(CONFIG_XEN_IBT),y)
|
||||
$(SHELL) $(BASEDIR)/tools/check-endbr.sh $@
|
||||
$(SHELL) $(srctree)/tools/check-endbr.sh $@
|
||||
endif
|
||||
else
|
||||
$(TARGET).efi: FORCE
|
||||
|
||||
@@ -78,7 +78,7 @@ ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
|
||||
efi-check := arch/x86/efi/check
|
||||
|
||||
# Check if the compiler supports the MS ABI.
|
||||
XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(efi-check).c -o $(efi-check).o,y)
|
||||
XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(srctree)/$(efi-check).c -o $(efi-check).o,y)
|
||||
|
||||
# Check if the linker supports PE.
|
||||
EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ define cmd_compile.h
|
||||
-e 's/@@version@@/$(XEN_VERSION)/g' \
|
||||
-e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
|
||||
-e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
|
||||
-e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
|
||||
-e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
|
||||
< $< > $(dot-target).tmp; \
|
||||
sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
|
||||
sed -rf $(srctree)/tools/process-banner.sed < .banner >> $(dot-target).tmp; \
|
||||
mv -f $(dot-target).tmp $@; \
|
||||
fi
|
||||
endef
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ $(obj)/config.gz: $(CONF_FILE)
|
||||
|
||||
$(obj)/config_data.o: $(obj)/config.gz
|
||||
|
||||
$(obj)/config_data.S: $(BASEDIR)/tools/binfile FORCE
|
||||
$(obj)/config_data.S: $(srctree)/tools/binfile FORCE
|
||||
$(call if_changed,binfile,$(obj)/config.gz xen_config_data)
|
||||
targets += config_data.S
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
|
||||
obj-y += libfdt.o
|
||||
nocov-y += libfdt.o
|
||||
|
||||
CFLAGS-y += -I$(BASEDIR)/include/xen/libfdt/
|
||||
CFLAGS-y += -I$(srctree)/include/xen/libfdt/
|
||||
|
||||
$(obj)/libfdt.o: $(obj)/libfdt-temp.o FORCE
|
||||
$(call if_changed,objcopy)
|
||||
|
||||
@@ -45,22 +45,22 @@ public-$(CONFIG_ARM) := $(wildcard $(src)/public/arch-arm/*.h $(src)/public/arch
|
||||
.PHONY: all
|
||||
all: $(addprefix $(obj)/,$(headers-y))
|
||||
|
||||
$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(BASEDIR)/tools/compat-build-header.py
|
||||
$(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $(patsubst $(obj)/%,%,$@) >>$@.new; \
|
||||
$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(srctree)/tools/compat-build-header.py
|
||||
$(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst $(obj)/%,%,$@) >>$@.new; \
|
||||
mv -f $@.new $@
|
||||
|
||||
$(obj)/compat/%.i: $(obj)/compat/%.c $(src)/Makefile
|
||||
$(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
|
||||
|
||||
$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(BASEDIR)/tools/compat-build-source.py
|
||||
$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(srctree)/tools/compat-build-source.py
|
||||
mkdir -p $(@D)
|
||||
$(PYTHON) $(BASEDIR)/tools/compat-build-source.py $(src)/xlat.lst <$< >$@.new
|
||||
$(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst <$< >$@.new
|
||||
mv -f $@.new $@
|
||||
|
||||
$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh $(src)/Makefile
|
||||
$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(srctree)/tools/get-fields.sh $(src)/Makefile
|
||||
export PYTHON=$(PYTHON); \
|
||||
while read what name; do \
|
||||
$(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
|
||||
$(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
|
||||
done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<)).lst >$@.new
|
||||
mv -f $@.new $@
|
||||
|
||||
@@ -70,7 +70,7 @@ $(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile
|
||||
grep -v '^[[:blank:]]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' >$@.new
|
||||
$(call move-if-changed,$@.new,$@)
|
||||
|
||||
xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(src)/xlat.lst | uniq)
|
||||
xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(srcdir)/xlat.lst | uniq)
|
||||
xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y))
|
||||
|
||||
$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/config/auto.conf $(src)/Makefile
|
||||
|
||||
@@ -40,4 +40,4 @@ $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found)
|
||||
$(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
|
||||
|
||||
# gcc version including patch level
|
||||
gcc-version := $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC))
|
||||
gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
|
||||
@@ -5,9 +5,12 @@
|
||||
|
||||
src := $(obj)
|
||||
|
||||
# shortcuts
|
||||
srcdir := $(srctree)/$(src)
|
||||
|
||||
clean::
|
||||
|
||||
include $(BASEDIR)/scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
|
||||
include $(src)/Makefile
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ CFLAGS-y += -I$(obj)/include
|
||||
|
||||
AWK = awk
|
||||
|
||||
FLASK_H_DEPEND := $(addprefix $(src)/policy/,security_classes initial_sids)
|
||||
AV_H_DEPEND = $(src)/policy/access_vectors
|
||||
FLASK_H_DEPEND := $(addprefix $(srcdir)/policy/,security_classes initial_sids)
|
||||
AV_H_DEPEND := $(srcdir)/policy/access_vectors
|
||||
|
||||
FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
|
||||
AV_H_FILES := av_perm_to_string.h av_permissions.h
|
||||
@@ -18,14 +18,14 @@ ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
|
||||
$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
|
||||
extra-y += $(ALL_H_FILES)
|
||||
|
||||
mkflask := $(src)/policy/mkflask.sh
|
||||
mkflask := $(srcdir)/policy/mkflask.sh
|
||||
quiet_cmd_mkflask = MKFLASK $@
|
||||
cmd_mkflask = $(SHELL) $(mkflask) $(AWK) $(obj)/include $(FLASK_H_DEPEND)
|
||||
|
||||
$(addprefix $(obj)/%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE
|
||||
$(call if_changed,mkflask)
|
||||
|
||||
mkaccess := $(src)/policy/mkaccess_vector.sh
|
||||
mkaccess := $(srcdir)/policy/mkaccess_vector.sh
|
||||
quiet_cmd_mkaccess = MKACCESS VECTOR $@
|
||||
cmd_mkaccess = $(SHELL) $(mkaccess) $(AWK) $(obj)/include $(AV_H_DEPEND)
|
||||
|
||||
@@ -36,7 +36,7 @@ obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
|
||||
$(obj)/flask-policy.o: $(obj)/policy.bin
|
||||
|
||||
$(obj)/flask-policy.S: BINFILE_FLAGS := -i
|
||||
$(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE
|
||||
$(obj)/flask-policy.S: $(srctree)/tools/binfile FORCE
|
||||
$(call if_changed,binfile,$(obj)/policy.bin xsm_flask_init_policy)
|
||||
targets += flask-policy.S
|
||||
|
||||
|
||||