|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v2 20/23] build: Switch build directory as CURDIR
Fixdep and other kconfig autogenerate files on fixed path. Instead of
patching the kconfig and fixdep, we make current working directory as
build directory.
Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
Config.uk | 2 +-
Makefile | 78 ++++++++++++++++++++++++------------
arch/Config.uk | 6 +--
support/scripts/configupdate | 4 +-
4 files changed, 59 insertions(+), 31 deletions(-)
diff --git a/Config.uk b/Config.uk
index 01a7ac85..772db857 100644
--- a/Config.uk
+++ b/Config.uk
@@ -26,7 +26,7 @@ config UK_DEFNAME
default "$(UK_NAME)"
menu "Architecture Selection"
- source "arch/Config.uk"
+ source "$(UK_BASE)/arch/Config.uk"
endmenu
menu "Platform Configuration"
diff --git a/Makefile b/Makefile
index 1f60ea6d..09d2579a 100644
--- a/Makefile
+++ b/Makefile
@@ -65,7 +65,7 @@ space := $(empty) $(empty)
export CDPATH :=
# Use current directory as base
-CONFIG_UK_BASE := $(CURDIR)
+CONFIG_UK_BASE ?= $(CURDIR)
override CONFIG_UK_BASE := $(realpath $(CONFIG_UK_BASE))
ifeq ($(CONFIG_UK_BASE),)
$(error "Invalid base directory (CONFIG_UK_BASE)")
@@ -109,6 +109,12 @@ $(if $(wildcard $(E)), \
)
endif
EPLAT_DIR := $(realpath $(patsubst %/,%,$(patsubst %.,%,$(EPLAT_DIR))))
+build_dir_make := 0
+ifneq ($(BUILD_DIR),$(UK_BASE))
+ build_dir_make := 1;
+else
+ sub_make_exec := 1;
+endif
# ELIB_DIR (list of external libraries)
# Retrieved from L variable from the command line (paths separated by colon)
@@ -428,6 +434,7 @@ endif
################################################################################
# Compiler and linker tools
################################################################################
+ifeq ($(sub_make_exec), 1)
ifeq ($(UK_HAVE_DOT_CONFIG),y)
# Hide troublesome environment variables from sub processes
unexport CONFIG_CROSS_COMPILE
@@ -617,19 +624,25 @@ clean: clean-libs
else # !($(UK_HAVE_DOT_CONFIG),y)
-all: menuconfig
-.PHONY: prepare image libs objs clean-libs clean
+$(filter %config,$(MAKECMDGOALS)): $(BUILD_DIR)/Makefile
+
+## ukconfig
+ukconfig: $(BUILD_DIR)/Makefile menuconfig
-fetch: menuconfig
+all: ukconfig
-prepare: menuconfig
+.PHONY: prepare image libs objs clean-libs clean ukconfig
-objs: menuconfig
+fetch: ukconfig
-libs: menuconfig
+prepare: ukconfig
-images: menuconfig
+objs: ukconfig
+
+libs: ukconfig
+
+images: ukconfig
clean-libs clean:
$(error Do not know which files to clean without having a
configuration. Did you mean 'properclean' or 'distclean'?)
@@ -700,40 +713,41 @@ iscriptconfig: $(KCONFIG_APP_IN) $(KCONFIG_ELIB_IN)
$(KCONFIG_EPLAT_IN) $(KCONFI
kmenuconfig:$(KCONFIG_DIR)/fixdep
@$(COMMON_CONFIG_ENV) $(kpython) $(CONFIGLIB)/menuconfig.py \
$(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
scriptsyncconfig: $(KCONFIG_DIR)/fixdep
@$(COMMON_CONFIG_ENV) $(kpython) $(CONFIGLIB)/genconfig.py \
--sync-deps=$(BUILD_DIR)/include/config \
--header-path=$(KCONFIG_AUTOHEADER) $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
+guiconfig: $(KCONFIG_DIR)/fixdep
@$(kpython) $(CONFIGLIB)/guiconfig.py $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
dumpvarsconfig:$(KCONFIG_DIR)/fixdep
$(Q)$(kpython) $(CONFIGLIB)/examples/dumpvars.py $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ $(COMMON_CONFIG_ENV) @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
xconfig: $(KCONFIG_DIR)/qconf
@$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
gconfig: $(KCONFIG_DIR)/gconf
@$(COMMON_CONFIG_ENV) srctree=$(CONFIG_UK_BASE) $< $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
menuconfig: $(KCONFIG_DIR)/mconf
@$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
nconfig: $(KCONFIG_DIR)/nconf
@$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
config: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
# For the config targets that automatically select options, we pass
# SKIP_LEGACY=y to disable the legacy options. However, in that case
@@ -741,34 +755,34 @@ config: $(KCONFIG_DIR)/conf
# will query them. Therefore, run an additional olddefconfig.
oldconfig: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
randconfig: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --randconfig $(CONFIG_CONFIG_IN)
@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
allyesconfig: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allyesconfig
$(CONFIG_CONFIG_IN)
@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
allnoconfig: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) SKIP_LEGACY=y $< --allnoconfig $(CONFIG_CONFIG_IN)
@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN) >/dev/null
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
syncconfig: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) $< --syncconfig $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
olddefconfig: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
defconfig: $(KCONFIG_DIR)/conf
@$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG))
$(CONFIG_CONFIG_IN)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
# Override the UK_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
%_defconfig: $(KCONFIG_DIR)/conf $(A)/configs/%_defconfig
@@ -780,7 +794,7 @@ savedefconfig: $(KCONFIG_DIR)/conf
--savedefconfig=$(if
$(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
$(CONFIG_CONFIG_IN)
@$(SED) '/UK_DEFCONFIG=/d' $(if
$(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig)
- @$(SCRIPTS_DIR)/configupdate $(UK_CONFIG) $(UK_CONFIG_OUT)
+ @$(COMMON_CONFIG_ENV) $(SCRIPTS_DIR)/configupdate $(UK_CONFIG)
$(UK_CONFIG_OUT)
.PHONY: defconfig savedefconfig silentoldconfig
@@ -859,6 +873,20 @@ print-objs:
print-srcs:
$(error Do not have a configuration. Please run one of the
configuration targets first)
endif
+else #!($(sub_make_exec),)
+export sub_make_exec:=1
+
+$(BUILD_DIR)/Makefile:
+ ln -sn $(CONFIG_UK_BASE)/Makefile $(@)
+
+$(filter-out _all $(BUILD_DIR)/Makefile sub-make distclean properclean help
$(lastword $(MAKEFILE_LIST)), \
+ $(MAKECMDGOALS)) all: sub-make
+ @:
+
+sub-make: $(BUILD_DIR)/Makefile
+ $(Q)$(MAKE) CONFIG_UK_BASE=$(CONFIG_UK_BASE) -C $(BUILD_DIR) -f
$(BUILD_DIR)/Makefile $(MAKECMDGOALS)
+
+endif
help:
@echo 'Cleaning:'
diff --git a/arch/Config.uk b/arch/Config.uk
index d091dcbd..9f21504e 100644
--- a/arch/Config.uk
+++ b/arch/Config.uk
@@ -16,13 +16,13 @@ config ARCH_ARM_32
endchoice
if (ARCH_X86_64)
- source "arch/x86/x86_64/Config.uk"
+ source "$(UK_BASE)/arch/x86/x86_64/Config.uk"
endif
if (ARCH_ARM_32)
- source "arch/arm/arm/Config.uk"
+ source "$(UK_BASE)/arch/arm/arm/Config.uk"
endif
if (ARCH_ARM_64)
- source "arch/arm/arm64/Config.uk"
+ source "$(UK_BASE)/arch/arm/arm64/Config.uk"
endif
config STACK_SIZE_PAGE_ORDER
diff --git a/support/scripts/configupdate b/support/scripts/configupdate
index ce5ce986..86b835ca 100755
--- a/support/scripts/configupdate
+++ b/support/scripts/configupdate
@@ -1,6 +1,6 @@
#!/bin/bash
-UK_CONFIG="${1:-.config}"
-UK_CONFIG_OLD="${2:-.config.old}"
+UK_CONFIG="${1:-${UK_BASE}/.config}"
+UK_CONFIG_OLD="${2:-${UK_BASE}/.config.old}"
_subconfig()
{
--
2.20.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |