Create virtual packages for OpenPower toolchain

Create a "toolchain" category, plus "p8-pore-toolchain" and
"ppe42-toolchain" virtual-packages, with the goal of lowering the
coupling between these toolchain and target packages.

Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
diff --git a/openpower/Config.in b/openpower/Config.in
index b6decad..412dedb 100644
--- a/openpower/Config.in
+++ b/openpower/Config.in
@@ -1,6 +1,7 @@
 menu "OpenPower"
 
 source "$BR2_EXTERNAL_OP_BUILD_PATH/platform/Config.in"
+source "$BR2_EXTERNAL_OP_BUILD_PATH/toolchain/Config.in"
 
 menu "OpenPower Packages"
 if BR2_OPENPOWER_PLATFORM
diff --git a/openpower/configs/opal_defconfig b/openpower/configs/opal_defconfig
index fcc24a9..791214d 100644
--- a/openpower/configs/opal_defconfig
+++ b/openpower/configs/opal_defconfig
@@ -52,7 +52,6 @@
 BR2_PACKAGE_PETITBOOT=y
 BR2_PACKAGE_PETITBOOT_MTD=y
 # BR2_PACKAGE_HOST_P8_PORE_BINUTILS is not set
-# BR2_PACKAGE_OCC_P8 is not set
 # BR2_PACKAGE_CAPP_UCODE is not set
 BR2_SKIBOOT_DEVICETREE=y
 # BR2_PACKAGE_IMA_CATALOG is not set
diff --git a/openpower/configs/zz_defconfig b/openpower/configs/zz_defconfig
index 117e248..db28ca4 100644
--- a/openpower/configs/zz_defconfig
+++ b/openpower/configs/zz_defconfig
@@ -54,8 +54,6 @@
 # BR2_TARGET_SKIBOOT_XZ is not set
 BR2_PACKAGE_PETITBOOT=y
 BR2_PACKAGE_PETITBOOT_MTD=y
-# BR2_PACKAGE_HCODE is not set
-# BR2_PACKAGE_OCC is not set
 # BR2_PACKAGE_CAPP_UCODE is not set
 BR2_PACKAGE_LOADKEYS=y
 # BR2_PACKAGE_HOST_PPE42_BINUTILS is not set
diff --git a/openpower/external.mk b/openpower/external.mk
index e8f46f1..2e4d7ce 100644
--- a/openpower/external.mk
+++ b/openpower/external.mk
@@ -1,3 +1,7 @@
+# OpenPower Toolchain
+include $(sort $(wildcard $(BR2_EXTERNAL_OP_BUILD_PATH)/toolchain/*/*.mk))
+
+# OpenPower Packages
 include $(sort $(wildcard $(BR2_EXTERNAL_OP_BUILD_PATH)/package/*.mk))
 include $(sort $(wildcard $(BR2_EXTERNAL_OP_BUILD_PATH)/package/*/*.mk))
 
diff --git a/openpower/package/hcode/Config.in b/openpower/package/hcode/Config.in
index 6a5130f..d1610b9 100644
--- a/openpower/package/hcode/Config.in
+++ b/openpower/package/hcode/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_HCODE
         bool "hcode"
         default y if (BR2_OPENPOWER_PLATFORM && BR2_OPENPOWER_POWER9)
+        depends on BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
         select BR2_CPP
         help
             Project to build the hcode firmware codebase
diff --git a/openpower/package/hcode/hcode.mk b/openpower/package/hcode/hcode.mk
index c97d54a..1e4e889 100644
--- a/openpower/package/hcode/hcode.mk
+++ b/openpower/package/hcode/hcode.mk
@@ -12,7 +12,7 @@
 HCODE_INSTALL_IMAGES = YES
 HCODE_INSTALL_TARGET = NO
 
-HCODE_DEPENDENCIES = host-binutils host-ppe42-gcc hostboot-binaries
+HCODE_DEPENDENCIES = host-binutils host-ppe42-toolchain hostboot-binaries
 
 HW_IMAGE_BIN_PATH=output/images/hw_image
 HW_IMAGE_BIN=p9n.hw_image.bin
diff --git a/openpower/package/occ-p8/Config.in b/openpower/package/occ-p8/Config.in
index 0137e94..3fb3b86 100644
--- a/openpower/package/occ-p8/Config.in
+++ b/openpower/package/occ-p8/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_OCC_P8
         bool "OCC for P8"
         default y if (BR2_OPENPOWER_PLATFORM && BR2_OPENPOWER_POWER8)
+        depends on BR2_PACKAGE_HAS_P8_PORE_TOOLCHAIN
         select BR2_CPP
         help
             Project to build OCC
diff --git a/openpower/package/occ-p8/occ-p8.mk b/openpower/package/occ-p8/occ-p8.mk
index a925a53..7630497 100644
--- a/openpower/package/occ-p8/occ-p8.mk
+++ b/openpower/package/occ-p8/occ-p8.mk
@@ -16,7 +16,7 @@
 OCC_P8_STAGING_DIR = $(STAGING_DIR)/occ
 
 OCC_P8_IMAGE_BIN_PATH = src/image.bin
-OCC_P8_DEPENDENCIES = host-binutils host-p8-pore-binutils
+OCC_P8_DEPENDENCIES = host-binutils host-p8-pore-toolchain
 
 define OCC_P8_BUILD_CMDS
         cd $(@D)/src && \
diff --git a/openpower/package/occ/Config.in b/openpower/package/occ/Config.in
index d9df0b3..d3be09d 100644
--- a/openpower/package/occ/Config.in
+++ b/openpower/package/occ/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_OCC
         bool "OCC (POWER9)"
         default y if (BR2_OPENPOWER_PLATFORM && BR2_OPENPOWER_POWER9)
+        depends on BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
         select BR2_CPP
         help
             Project to build OCC
diff --git a/openpower/package/occ/occ.mk b/openpower/package/occ/occ.mk
index 39ad15e..7d8c582 100644
--- a/openpower/package/occ/occ.mk
+++ b/openpower/package/occ/occ.mk
@@ -18,7 +18,7 @@
 
 OCC_IMAGE_BIN_PATH = obj/image.bin
 
-OCC_DEPENDENCIES = host-binutils host-ppe42-gcc
+OCC_DEPENDENCIES = host-binutils host-ppe42-toolchain
 ifeq ($(BR2_OCC_GPU_BIN_BUILD),y)
 	OCC_DEPENDENCIES += hostboot-binaries
 endif
diff --git a/openpower/package/p8-pore-binutils/Config.in b/openpower/package/p8-pore-binutils/Config.in
index a29397a..3d69782 100644
--- a/openpower/package/p8-pore-binutils/Config.in
+++ b/openpower/package/p8-pore-binutils/Config.in
@@ -1,6 +1,12 @@
 config BR2_PACKAGE_HOST_P8_PORE_BINUTILS
         bool "p8-pore-binutils"
         default y if (BR2_OPENPOWER_POWER8)
+        select BR2_PACKAGE_HAS_P8_PORE_TOOLCHAIN
         select BR2_CPP
         help
             Project to build the P8 PORE binutils
+
+if BR2_PACKAGE_HOST_P8_PORE_BINUTILS
+config BR2_PACKAGE_PROVIDES_P8_PORE_TOOLCHAIN
+        default "p8-pore-binutils"
+endif
diff --git a/openpower/package/p8-pore-binutils/p8-pore-binutils.mk b/openpower/package/p8-pore-binutils/p8-pore-binutils.mk
index 880dc09..7cd9807 100644
--- a/openpower/package/p8-pore-binutils/p8-pore-binutils.mk
+++ b/openpower/package/p8-pore-binutils/p8-pore-binutils.mk
@@ -8,6 +8,7 @@
 P8_PORE_BINUTILS_SITE ?= $(call github,open-power,p8-pore-binutils,$(P8_PORE_BINUTILS_VERSION))
 P8_PORE_BINUTILS_LICENSE = GPLv3+
 P8_PORE_BINUTILS_LICENSE_FILES = COPYING3 COPYING.LIB
+P8_PORE_BINUTILS_PROVIDES = p8-pore-toolchain
 HOST_P8_PORE_BINUTILS_DEPENDENCIES = host-binutils
 
 P8_PORE_BINUTILS_DIR = $(STAGING_DIR)/p8-pore-binutils
diff --git a/openpower/package/ppe42-gcc/Config.in b/openpower/package/ppe42-gcc/Config.in
index d66418d..33f5276 100644
--- a/openpower/package/ppe42-gcc/Config.in
+++ b/openpower/package/ppe42-gcc/Config.in
@@ -1,6 +1,12 @@
 config BR2_PACKAGE_HOST_PPE42_GCC
         bool "ppe42-gcc"
         default y if (BR2_OPENPOWER_PLATFORM && BR2_OPENPOWER_POWER9)
+        select BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
         select BR2_CPP
         help
             Project to build the PPE42 gcc
+
+if BR2_PACKAGE_HOST_PPE42_GCC
+config BR2_PACKAGE_PROVIDES_PPE42_TOOLCHAIN
+        default "ppe42-gcc"
+endif
diff --git a/openpower/package/ppe42-gcc/ppe42-gcc.mk b/openpower/package/ppe42-gcc/ppe42-gcc.mk
index 518e458..a59071d 100644
--- a/openpower/package/ppe42-gcc/ppe42-gcc.mk
+++ b/openpower/package/ppe42-gcc/ppe42-gcc.mk
@@ -10,6 +10,7 @@
 
 PPE42_GCC_DEPENDENCIES = ppe42-binutils gmp mpfr mpc
 HOST_PPE42_GCC_DEPENDENCIES = host-ppe42-binutils host-gmp host-mpfr host-mpc
+PPE42_GCC_PROVIDES = ppe42-toolchain
 
 PPE42_GCC_DIR = $(STAGING_DIR)/ppe42-binutils
 PPE42_GCC_BIN = $(STAGING_DIR)/ppe42-binutils/linux
diff --git a/openpower/package/sbe/Config.in b/openpower/package/sbe/Config.in
index 2291255..e5f1d46 100644
--- a/openpower/package/sbe/Config.in
+++ b/openpower/package/sbe/Config.in
@@ -3,6 +3,7 @@
         default y if (BR2_OPENPOWER_PLATFORM && BR2_OPENPOWER_POWER9)
         select BR2_CPP
         depends on BR2_PACKAGE_HCODE
+        depends on BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
         help
             Project to build the sbe firmware codebase
 
diff --git a/openpower/package/sbe/sbe.mk b/openpower/package/sbe/sbe.mk
index 121e2c4..2f6d5b4 100644
--- a/openpower/package/sbe/sbe.mk
+++ b/openpower/package/sbe/sbe.mk
@@ -8,7 +8,7 @@
 SBE_SITE = $(call github,open-power,sbe,$(SBE_VERSION))
 
 SBE_LICENSE = Apache-2.0
-SBE_DEPENDENCIES = host-ppe42-gcc hcode
+SBE_DEPENDENCIES = host-ppe42-toolchain hcode
 
 SBE_INSTALL_IMAGES = YES
 SBE_INSTALL_TARGET = NO
diff --git a/openpower/toolchain/Config.in b/openpower/toolchain/Config.in
new file mode 100644
index 0000000..dc5b205
--- /dev/null
+++ b/openpower/toolchain/Config.in
@@ -0,0 +1,6 @@
+menu "OpenPower Toolchain"
+
+source "$BR2_EXTERNAL_OP_BUILD_PATH/toolchain/ppe42-toolchain/Config.in"
+source "$BR2_EXTERNAL_OP_BUILD_PATH/toolchain/p8-pore-toolchain/Config.in"
+
+endmenu
diff --git a/openpower/toolchain/p8-pore-toolchain/Config.in b/openpower/toolchain/p8-pore-toolchain/Config.in
new file mode 100644
index 0000000..40dd48d
--- /dev/null
+++ b/openpower/toolchain/p8-pore-toolchain/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HAS_P8_PORE_TOOLCHAIN
+	bool
+
+config BR2_PACKAGE_PROVIDES_P8_PORE_TOOLCHAIN
+	depends on BR2_PACKAGE_HAS_P8_PORE_TOOLCHAIN
+	string
diff --git a/openpower/toolchain/p8-pore-toolchain/p8-pore-toolchain.mk b/openpower/toolchain/p8-pore-toolchain/p8-pore-toolchain.mk
new file mode 100644
index 0000000..b618004
--- /dev/null
+++ b/openpower/toolchain/p8-pore-toolchain/p8-pore-toolchain.mk
@@ -0,0 +1,7 @@
+################################################################################
+#
+# p8-pore-toolchain
+#
+################################################################################
+
+$(eval $(host-virtual-package))
diff --git a/openpower/toolchain/ppe42-toolchain/Config.in b/openpower/toolchain/ppe42-toolchain/Config.in
new file mode 100644
index 0000000..baf4375
--- /dev/null
+++ b/openpower/toolchain/ppe42-toolchain/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
+	bool
+
+config BR2_PACKAGE_PROVIDES_PPE42_TOOLCHAIN
+	depends on BR2_PACKAGE_HAS_PPE42_TOOLCHAIN
+	string
diff --git a/openpower/toolchain/ppe42-toolchain/ppe42-toolchain.mk b/openpower/toolchain/ppe42-toolchain/ppe42-toolchain.mk
new file mode 100644
index 0000000..f841657
--- /dev/null
+++ b/openpower/toolchain/ppe42-toolchain/ppe42-toolchain.mk
@@ -0,0 +1,7 @@
+################################################################################
+#
+# ppe42-toolchain
+#
+################################################################################
+
+$(eval $(host-virtual-package))