xous: Use CARGO_CFG_TARGET_OS in build scripts.

This allows for a more reliable detection of target_os configuration
in build scripts. The target is inconsistent between some architectures,
notably armv7a is `armv7a-none-eabi` skipping the `unknown` (the vendor,
I guess) part. This happen with some of the unrelated Cortex-M targets
present, and others may also be.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
This commit is contained in:
Jean-Pierre De Jesus DIAZ 2022-10-12 19:03:46 +02:00
parent 006a7cc8a6
commit 955fbc8788
No known key found for this signature in database
GPG key ID: 6279AEC20A9524EC
4 changed files with 5 additions and 10 deletions

View file

@ -10,10 +10,9 @@ use std::path::PathBuf;
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let target = env::var("TARGET").unwrap();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let name = env::var("CARGO_PKG_NAME").unwrap();
let target_os = target.split('-').nth(2).unwrap_or("none");
// If we're not running on a desktop-class operating system, emit the "baremetal"
// config setting. This will enable software to do tasks such as
// managing memory.

View file

@ -2,9 +2,7 @@
use std::env;
fn main() {
let target = env::var("TARGET").unwrap();
let target_os = target.split('-').nth(2).unwrap_or("none");
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
// If we're not running on a desktop-class operating system, emit the "baremetal"
// config setting. This will enable software to do tasks such as

View file

@ -2,9 +2,7 @@
use std::env;
fn main() {
let target = env::var("TARGET").unwrap();
let target_os = target.split('-').nth(2).unwrap_or("none");
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
// If we're not running on a desktop-class operating system, emit the "baremetal"
// config setting. This will enable software to do tasks such as

View file

@ -1,3 +1,4 @@
use core::panic;
// NOTE: Adapted from cortex-m/build.rs
use std::env;
use std::fs;
@ -6,10 +7,9 @@ use std::path::PathBuf;
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let target = env::var("TARGET").unwrap();
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let name = env::var("CARGO_PKG_NAME").unwrap();
let target_os = target.split('-').nth(2).unwrap_or("none");
// If we're not running on a desktop-class operating system, emit the "baremetal"
// config setting. This will enable software to do tasks such as
// managing memory.