Inline with `mk_sub_build_dir`, this commit introduces
`mk_sub_libbuild_dir` that enables creating a sub build
directory for a library. This new Makefile command has
two parameters: (1) library name, (2) sub directory
structure.
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #194
$(if $(filter y,$(3)),$(call addplatlib,$(1),$(2)),)
endef
+# creates a sub build directory for a library
+# $libname,$subdir
+define mk_sub_libbuild_dir =
+$(if $(shell mkdir -p "$(BUILD_DIR)/$(1)/$(2)" && cd "$(BUILD_DIR)/$(1)/$(2)" >/dev/null && pwd),,\
+ $(error could not create directory "$(BUILD_DIR)/$(1)/$(2)"))
+endef
+
+sub_libbuild_dir = $(BUILD_DIR)/$(1)/$(2)
################################################################################
#