From e75e781a480d37898e8e38dc993dd8daf0dee8b3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 23 Jul 2022 13:48:24 +0100 Subject: rust-target-config: Allow the targets generated to be configurable Remove further code duplication by allowing the main function to be configurable. (From OE-Core rev: 2d4b35a0db1220e7a7f1b6776223aa4d40a3f246) Signed-off-by: Richard Purdie --- meta/classes/rust-target-config.bbclass | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'meta/classes/rust-target-config.bbclass') diff --git a/meta/classes/rust-target-config.bbclass b/meta/classes/rust-target-config.bbclass index 4db91d36d5..87b7dee3ed 100644 --- a/meta/classes/rust-target-config.bbclass +++ b/meta/classes/rust-target-config.bbclass @@ -357,10 +357,16 @@ rust_gen_target[vardepsexclude] += "RUST_HOST_SYS RUST_TARGET_SYS ABIEXTENSION l do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES" +RUST_TARGETGENS = "BUILD" + python do_rust_gen_targets () { wd = d.getVar('WORKDIR') + '/targets/' - build_arch = d.getVar('BUILD_ARCH') - rust_gen_target(d, 'BUILD', wd, build_arch) + # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last + rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH')) + if "HOST" in d.getVar("RUST_TARGETGENS"): + rust_gen_target(d, 'HOST', wd, d.getVar('HOST_ARCH')) + if "TARGET" in d.getVar("RUST_TARGETGENS"): + rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_ARCH')) } addtask rust_gen_targets after do_patch before do_compile -- cgit v1.2.3-54-g00ecf