From 42c3faff14917f687aab405d8f571e352ffdf3f5 Mon Sep 17 00:00:00 2001
From: Francis Laniel <flaniel@linux.microsoft.com>
Date: Wed, 6 Apr 2022 15:58:02 +0100
Subject: [PATCH] tbb: Enable cross-compilation.

This patch replaces hardcoded value for CPLUS and CONLY with $(CXX) and $(CC).
So, by defining CC= it is possible to cross compile this library using a
cross-compiler.

This patch was originally written by:
Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
and taken from:
https://github.com/intel/luv-yocto/blob/3b0688bc9a5e8d52b6ca461b15fb4abd3eaaf7a8/meta-oe/recipes-support/tbb/tbb/cross-compile.patch

Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
 build/linux.clang.inc | 5 +++--
 build/linux.gcc.inc   | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/build/linux.clang.inc b/build/linux.clang.inc
index 5a459ef5..a0777db5 100644
--- a/build/linux.clang.inc
+++ b/build/linux.clang.inc
@@ -31,8 +31,9 @@ DYLIB_KEY = -shared
 EXPORT_KEY = -Wl,--version-script,
 LIBDL = -ldl
 
-CPLUS = clang++
-CONLY = clang
+CPLUS = $(CXX)
+CONLY = $(CC)
+CPLUS_FLAGS = $(CXXFLAGS)
 LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
 LIBS += -lpthread -lrt
 LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
diff --git a/build/linux.gcc.inc b/build/linux.gcc.inc
index 786c4153..30242a82 100644
--- a/build/linux.gcc.inc
+++ b/build/linux.gcc.inc
@@ -32,8 +32,9 @@ DYLIB_KEY = -shared
 EXPORT_KEY = -Wl,--version-script,
 LIBDL = -ldl
 
-CPLUS = g++
-CONLY = gcc
+CPLUS = $(CXX)
+CONLY = $(CC)
+CPLUS_FLAGS = $(CXXFLAGS)
 LIB_LINK_FLAGS = $(DYLIB_KEY) -Wl,-soname=$(BUILDING_LIBRARY)
 LIBS += -lpthread -lrt
 LINK_FLAGS = -Wl,-rpath-link=. -rdynamic
-- 
2.25.1

