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

[Minios-devel] [UNIKRAFT PATCH 4/4] build: Print including of sub-Makefiles (verbose only)



When verbose mode is enabled (make V=1), each include command is
printed. This may be helpful for debugging and studying the include
orders of sub-makefiles (e.g., Makefile.uk).

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 Makefile                     | 40 ++++++++++++++++++++++--------------
 support/build/Makefile.rules | 19 +++++++++++++++--
 2 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/Makefile b/Makefile
index f0b6048c..17708bef 100644
--- a/Makefile
+++ b/Makefile
@@ -193,6 +193,7 @@ KCONFIG_PLAT_IN       := $(KCONFIG_DIR)/plat.uk
 SCRIPTS_DIR := $(CONFIG_UK_BASE)/support/scripts
 
 # # Set and export the version string
+$(call verbose_info,Including $(CONFIG_UK_BASE)/version.mk...)
 include $(CONFIG_UK_BASE)/version.mk
 
 # Compute the full local version string so packages can use it as-is
@@ -286,6 +287,7 @@ IMAGE_LDFLAGS-y :=
 # Pull in the user's configuration file
 ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
 ifneq ("$(wildcard $(UK_CONFIG))","")
+$(call verbose_info,Including $(UK_CONFIG)...)
 -include $(UK_CONFIG)
 UK_HAVE_DOT_CONFIG := y
 endif
@@ -367,14 +369,16 @@ export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE
 
################################################################################
 # Makefile helpers
 
################################################################################
+$(call verbose_info,Including 
$(CONFIG_UK_BASE)/support/build/Makefile.rules...)
+include $(CONFIG_UK_BASE)/support/build/Makefile.rules
+
 # We need to include this file early (before any rule is defined)
 # but after we have tried to load a .config and after having our tools defined
-$(foreach M,$(strip $(wildcard $(addsuffix Makefile.rules,\
-          $(CONFIG_UK_BASE)/support/build/ $(CONFIG_UK_BASE)/lib/*/\
-          $(CONFIG_UK_BASE)/plat/*/ $(addsuffix /,$(ELIB_DIR)) $(APP_DIR)/)\
-             )),\
-               $(info Include $(M));\
-               $(eval include $(M)))
+$(foreach _M,$(wildcard $(addsuffix Makefile.rules,\
+          $(CONFIG_UK_BASE)/lib/*/ $(CONFIG_UK_BASE)/plat/*/ \
+          $(addsuffix /,$(ELIB_DIR)) $(APP_DIR)/)), \
+               $(eval $(call verbose_include,$(_M))) \
+)
 
 
################################################################################
 # Clean targets that do not have any dependency on a configuration
@@ -395,7 +399,7 @@ distclean: properclean
 # Unikraft Architecture
 
################################################################################
 # Set target archicture as set in config
-include $(CONFIG_UK_BASE)/arch/Arch.uk
+$(eval $(call verbose_include,$(CONFIG_UK_BASE)/arch/Arch.uk))
 ifeq ($(CONFIG_UK_ARCH),)
 # Set target archicture as set in environment
 ifneq ($(ARCH),)
@@ -490,7 +494,7 @@ ifneq ("$(origin CROSS_COMPILE)","undefined")
 CONFIG_CROSS_COMPILE := $(CROSS_COMPILE:"%"=%)
 endif
 
-include $(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compiler.uk
+$(eval $(call verbose_include,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY)/Compiler.uk))
 
 # Make variables (CC, etc...)
 LD             := $(CONFIG_CROSS_COMPILE)gcc
@@ -552,21 +556,24 @@ ifneq ($(CONFIG_UK_BASE),$(CONFIG_UK_APP))
 $(eval $(call _import_lib,$(CONFIG_UK_APP)));
 endif
 
-include $(CONFIG_UK_BASE)/lib/Makefile.uk # libraries
+# internal libraries
+$(eval $(call verbose_include,$(CONFIG_UK_BASE)/lib/Makefile.uk))
 
 # external libraries
 $(foreach E,$(ELIB_DIR), \
        $(eval $(call _import_lib,$(E))); \
 )
-$(eval $(call _import_lib,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY))) # architecture 
libraries
-include $(CONFIG_UK_BASE)/plat/Makefile.uk # platform libraries
+# architecture library
+$(eval $(call _import_lib,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY)))
+# internal platform libraries
+$(eval $(call verbose_include,$(CONFIG_UK_BASE)/plat/Makefile.uk))
 # external platform libraries
 # NOTE: We include them after internal platform libs so that also base 
variables
 #       provided with /plat/Makefile.uk are populated
 $(foreach E,$(EPLAT_DIR), \
        $(eval $(call _import_lib,$(E))); \
 )
-include $(CONFIG_UK_BASE)/Makefile.uk # Unikraft base
+$(eval $(call verbose_include,$(CONFIG_UK_BASE)/Makefile.uk)) # Unikraft base
 
 ifeq ($(call qstrip,$(UK_PLATS) $(UK_PLATS-y)),)
 $(warning You did not choose any target platform.)
@@ -583,10 +590,13 @@ endif
 endif
 
 # Generate build rules
-include $(CONFIG_UK_BASE)/support/build/Makefile.build
+$(eval $(call verbose_include,$(CONFIG_UK_BASE)/support/build/Makefile.build))
 
+# Include source dependencies
 ifneq ($(call qstrip,$(UK_DEPS) $(UK_DEPS-y)),)
--include $(UK_DEPS) $(UK_DEPS-y) # include header dependencies
+$(foreach _D,$(UK_DEPS) $(UK_DEPS-y),\
+ $(eval $(call verbose_include_try,$(_D))) \
+)
 endif
 
 # include Makefile for platform linking (`Linker.uk`)
@@ -627,7 +637,7 @@ all: images gdb_helpers
 # Cleanup rules
 
################################################################################
 # Generate cleaning rules
-include $(CONFIG_UK_BASE)/support/build/Makefile.clean
+$(eval $(call verbose_include,$(CONFIG_UK_BASE)/support/build/Makefile.clean))
 
 clean-libs: $(addprefix clean-,\
        $(foreach P,$(UK_PLATS) $(UK_PLATS-y),\
diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules
index e817ddcb..a13180a8 100644
--- a/support/build/Makefile.rules
+++ b/support/build/Makefile.rules
@@ -127,17 +127,32 @@ endef
 #
 ###############################################################################
 
+# Include a sub-makefile
+# verbose_include $path
+define verbose_include =
+$(call verbose_info,Including $(1)...)
+include $(1)
+endef
+
+# Try to include a sub-makefile
+# (does not fail if it does not exist)
+# verbose_include_try $path
+define verbose_include_try =
+$(call verbose_info,Trying to include $(1)...)
+-include $(1)
+endef
+
 # Import a library
 # For internally use only (Unikraft main makefile and internal libs 
Makefike.uk)
 # _import_library $path
 define _import_lib =
 _IMPORT_BASE := $(1)
-include $(1)/Makefile.uk
+$(call verbose_include,$(1)/Makefile.uk)
 undefine _IMPORT_BASE
 endef
 # _import_linker $plat_name
 define _import_linker =
- include $(UK_PLAT_$(call uc,$(1))_LINKER)
+$(call verbose_include,$(UK_PLAT_$(call uc,$(1))_LINKER))
 endef
 
 # Register a platform to the build system
-- 
2.20.1


_______________________________________________
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®.