[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 1/3] build: `distclean`, `properclean` independent of a configuration



Makes the targets `distclean` and `properclean` independent to the
presence of a configuration. Before this commit, these targets were
only installed when a `.config` file could be loaded by the build
system. Since these targets use some functions declared in
`support/build/Makefile.rules`, we include this file at an earlier
point.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 Makefile | 46 ++++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile
index 96be2db..1250436 100644
--- a/Makefile
+++ b/Makefile
@@ -142,7 +142,7 @@ export DATE := $(shell date +%Y%m%d)
 null_targets           := print-version help
 noconfig_targets       := menuconfig nconfig gconfig xconfig config oldconfig 
randconfig \
                           defconfig %_defconfig allyesconfig allnoconfig 
silentoldconfig release \
-                          olddefconfig $(null_targets)
+                          olddefconfig properclean distclean $(null_targets)
 
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
@@ -168,10 +168,20 @@ SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
         else if [ -x /bin/bash ]; then echo /bin/bash; \
         else echo sh; fi; fi)
 
+# basic tools
+RM    := rm -f
+MV    := mv -f
+CP    := cp -f
+MKDIR := mkdir
+TOUCH := touch
+
 # kconfig uses CONFIG_SHELL
 CONFIG_SHELL := $(SHELL)
 export SHELL CONFIG_SHELL Q KBUILD_VERBOSE
 
+# Include common Makefile helpers early
+include $(CONFIG_UK_BASE)/support/build/Makefile.rules
+
 
################################################################################
 # .config
 
################################################################################
@@ -298,6 +308,20 @@ export HOSTARCH := $(shell LC_ALL=C $(HOSTCC_NOCCACHE) -v 
2>&1 | \
 export HOSTAR HOSTAS HOSTCC HOSTCC_VERSION HOSTCXX HOSTLD HOSTARCH
 export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
+################################################################################
+# Clean targets that do not have any dependency on a configuration
+################################################################################
+# Declare them before we depend on having .config
+properclean:
+       $(call verbose_cmd,RM,build/,$(RM) -r \
+               $(BUILD_DIR))
+
+distclean: properclean
+       $(call verbose_cmd,RM,config,$(RM) \
+               $(UK_CONFIG) $(UK_CONFIG).old $(CONFIG_DIR)/..config.tmp \
+               $(CONFIG_DIR)/.auto.deps)
+
+.PHONY: distclean properclean
 
 
################################################################################
 # Unikraft Architecture
@@ -409,10 +433,6 @@ STRIP              := $(CONFIG_CROSS_COMPILE)strip
 OBJCOPY                := $(CONFIG_CROSS_COMPILE)objcopy
 OBJDUMP                := $(CONFIG_CROSS_COMPILE)objdump
 AR             := ar
-MV             := mv -f
-RM             := rm -f
-CP             := cp -f
-MKDIR          := mkdir
 CAT            := cat
 SED            := sed
 AWK            := awk
@@ -421,7 +441,6 @@ GZIP                := gzip
 TAR            := tar
 UNZIP          := unzip -qq -u
 WGET           := wget
-TOUCH          := touch
 # Time requires the full path so that subarguments are handled correctly
 TIME           := $(shell which time)
 LIFTOFF                := liftoff -e -s
@@ -437,9 +456,6 @@ ASFLAGS             += -DCC_VERSION=$(CC_VERSION)
 CFLAGS         += -DCC_VERSION=$(CC_VERSION)
 CXXFLAGS       += -DCC_VERSION=$(CC_VERSION)
 
-# Common Makefile definitions we need for building Unikraft
-include $(CONFIG_UK_BASE)/support/build/Makefile.rules
-
 # ensure $(BUILD_DIR)/include and $(BUILD_DIR)/include/uk exists
 $(call mk_sub_build_dir,include)
 $(call mk_sub_build_dir,include/uk)
@@ -534,20 +550,10 @@ libs: menuconfig
 
 images: menuconfig
 
-clean:
+clean: menuconfig
 
 endif
 
-.PHONY: distclean properclean
-properclean:
-       $(call verbose_cmd,RM,build/,$(RM) -r \
-               $(BUILD_DIR))
-
-distclean: properclean
-       $(call verbose_cmd,RM,config,$(RM) \
-               $(UK_CONFIG) $(UK_CONFIG).old $(CONFIG_DIR)/..config.tmp \
-               $(CONFIG_DIR)/.auto.deps)
-
 .PHONY: print-vars print-libs help outputmakefile list-defconfigs
 
 # Configuration
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.