]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
build: Ability to skip imports with `import_lib`
authorSimon Kuenzer <simon@unikraft.io>
Mon, 18 Sep 2023 12:15:42 +0000 (14:15 +0200)
committerRazvan Deaconescu <razvand@unikraft.io>
Fri, 20 Oct 2023 16:35:55 +0000 (19:35 +0300)
This commits adds the ability to skip including `Makefile.uk` files by
`import_lib` if the target path matches with one of the paths that can
be found in the `$(IMPORT_EXCLUDEDIRS)` variable.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
GitHub-Closes: #1104

support/build/Makefile.rules

index 1ef4799403d86d76cd9b87a34e1d30e8d9ea1a0e..16f660f29fc62fdf10823ce80693aed2a81375a6 100644 (file)
@@ -241,11 +241,19 @@ endef
 # Import a library
 # For internally use only (Unikraft main makefile and internal libs Makefike.uk)
 # import_lib $1:path
-define import_lib =
+define do_import_lib =
 IMPORT_BASE := $(1)
 $(call verbose_include,$(1)/Makefile.uk)
 undefine IMPORT_BASE
 endef
+
+define import_lib =
+$(eval IMPORT_IS_FILTERED:=n)
+$(foreach ITR,$(IMPORT_EXCLUDEDIRS),$(if $(filter $(ITR),$(1)),$(eval IMPORT_IS_EXCLUDED:=y),))
+$(if $(filter $(IMPORT_IS_EXCLUDED),y),$(call verbose_info,Skip including $(1): Excluded from build (E)),$(call do_import_lib,$(1)))
+$(eval undefine IMPORT_IS_EXCLUDED)
+endef
+
 # import_linker $plat_name
 define import_linker =
 $(call verbose_include,$(UK_PLAT_$(call uc,$(1))_LINKER))