diff --git a/Config.uk b/Config.uk index 7d71cd2b83a58750b1d12fc33f0f71baaa926dac..a64f1995a0aa9172d0815b0c8f96e347fe18cfd0 100644 --- a/Config.uk +++ b/Config.uk @@ -45,7 +45,7 @@ menu "Platform Configuration" endmenu menu "Device Drivers" - source "$(shell,$(UK_BASE)/support/build/config-submenu.sh -q -o '$(KCONFIG_DIR)/drivers.uk' -r '$(KCONFIG_DRIV_BASE)' -l '$(KCONFIG_DRIV_BASE)' -e '$(KCONFIG_EXCLUDEDIRS)')" + source "$(shell,$(UK_BASE)/support/build/config-submenu.sh -q -o '$(KCONFIG_DIR)/drivers.uk' -r '$(KCONFIG_DRIV_BASE)' -l '$(KCONFIG_DRIV_BASE)' -c '$(KCONFIG_EDRV_DIRS)' -e '$(KCONFIG_EXCLUDEDIRS)')" endmenu menu "Library Configuration" diff --git a/Makefile b/Makefile index 613f0d941a81cab6b9271caf7f53463c44d45aa9..48cd4327cc9c55134928b82bd03adf8a54327703 100644 --- a/Makefile +++ b/Makefile @@ -199,6 +199,19 @@ $(error Cannot find library: $(ITR)) \ endif ELIB_DIR := $(realpath $(patsubst %/,%,$(patsubst %.,%,$(ELIB_DIR)))) +# EDRV_DIR (list of external drivers) +ifeq ("$(origin D)", "command line") +# driver path exists? +$(foreach ITR,$(subst :, ,$(D)), \ +$(if $(filter /%,$(ITR)),,$(error Path to external library "$(ITR)" (D) is not absolute));\ +$(if $(wildcard $(ITR)), \ +$(eval EDRV_DIR += $(realpath $(patsubst %/,%,$(patsubst %.,%,$(ITR))))), \ +$(error Cannot find library: $(ITR)) \ +) \ +) +endif +EDRV_DIR := $(realpath $(patsubst %/,%,$(patsubst %.,%,$(EDRV_DIR)))) + # IMPORT_EXCLUDEDIRS (list of (library) paths to exclude) # Retrieved from E variable from the command line # (paths are separated by colon) @@ -251,6 +264,7 @@ KCONFIG_ELIB_DIRS := $(L) KCONFIG_PLAT_BASE := $(CONFIG_UK_BASE)/plat KCONFIG_EPLAT_DIRS := $(P) KCONFIG_DRIV_BASE := $(CONFIG_UK_BASE)/drivers +KCONFIG_EDRV_DIRS := $(D) ifneq ($(CONFIG_UK_BASE),$(CONFIG_UK_APP)) KCONFIG_EAPP_DIR := $(CONFIG_UK_APP) else @@ -326,6 +340,8 @@ UK_PLATS:= UK_PLATS-y:= UK_LIBS:= UK_LIBS-y:= +UK_DRVS:= +UK_DRVS-y:= UK_ALIBS:= UK_ALIBS-y:= UK_OLIBS:= @@ -732,6 +748,12 @@ $(eval $(call verbose_include,$(CONFIG_UK_BASE)/lib/Makefile.uk)) $(foreach ITR,$(ELIB_DIR), \ $(eval $(call import_lib,$(ITR))); \ ) + +# external drivers +$(foreach ITR,$(EDRV_DIR), \ + $(eval $(call import_lib,$(ITR))); \ +) + # architecture library $(eval $(call import_lib,$(CONFIG_UK_BASE)/arch/$(UK_FAMILY))) # drivers @@ -919,6 +941,7 @@ COMMON_CONFIG_ENV = \ KCONFIG_PLAT_BASE="$(KCONFIG_PLAT_BASE)" \ KCONFIG_EPLAT_DIRS="$(KCONFIG_EPLAT_DIRS)" \ KCONFIG_DRIV_BASE="$(KCONFIG_DRIV_BASE)" \ + KCONFIG_EDRV_DIRS="$(KCONFIG_EDRV_DIRS)" \ KCONFIG_EAPP_DIR="$(KCONFIG_EAPP_DIR)" \ KCONFIG_EXCLUDEDIRS="$(KCONFIG_EXCLUDEDIRS)" \ UK_NAME="$(CONFIG_UK_NAME)" diff --git a/support/build/Makefile.rules b/support/build/Makefile.rules index 16f660f29fc62fdf10823ce80693aed2a81375a6..da961e0e9f6acbc3e606580064dc7d28508049d0 100644 --- a/support/build/Makefile.rules +++ b/support/build/Makefile.rules @@ -273,6 +273,29 @@ define addplat_s = $(if $(filter y,$(2)),$(call addplat,$(1)),) endef +# Register driver to build system +# adddrv $1:drvname +define adddrv = +$(call mk_sub_build_dir,$(1)) +UK_LIBS += $(1) +$(eval $(call uc,$(1))_BASE := $(IMPORT_BASE)) +$(eval $(call uc,$(1))_BUILD := $(call sub_build_dir,$(1))) +$(eval $(call uc,$(1))_EXPORTS += $(wildcard $(IMPORT_BASE)/exportsyms.uk)) +$(eval $(call uc,$(1))_LOCALS += $(wildcard $(IMPORT_BASE)/localsyms.uk)) +endef + +# adddrv_tree $1:libname +define adddrv_tree = +$(eval $(call uc,$(1))__BUILDTREE := y) +$(call addlib,$(1)) +endef + +# adddrv_s $1:libname,$2:switch +define adddrv_s = +ifeq ($(2),y) +$(call addlib,$(1)) +endif +endef # Register libraries to build system # addlib $1:libname