env_consts.rs - source
Description: Source of the Rust file `library/std/src/sys/env_consts.rs`.

#
std/sys/
env_consts.rs

    1//! Constants associated with each target.
    2
    3// Replaces the #[else] gate with #[cfg(not(any(…)))] of all the other gates.
    4// This ensures that they must be mutually exclusive and do not have precedence
    5// like cfg_select!.
    6macro cfg_unordered(
    7    $(#[cfg($cfg:meta)] $os:item)*
    8    #[else] $fallback:item
    9) {
    10    $(#[cfg($cfg)] $os)*
    11    #[cfg(not(any($($cfg),*)))] $fallback
    12}
    13
    14// Keep entries sorted alphabetically and mutually exclusive.
    15
    16cfg_unordered! {
    17
    18#[cfg(target_os = "aix")]
    19pub mod os {
    20    pub const FAMILY: &str = "unix";
    21    pub const OS: &str = "aix";
    22    pub const DLL_PREFIX: &str = "lib";
    23    pub const DLL_SUFFIX: &str = ".a";
    24    pub const DLL_EXTENSION: &str = "a";
    25    pub const EXE_SUFFIX: &str = "";
    26    pub const EXE_EXTENSION: &str = "";
    27}
    28
    29#[cfg(target_os = "android")]
    30pub mod os {
    31    pub const FAMILY: &str = "unix";
    32    pub const OS: &str = "android";
    33    pub const DLL_PREFIX: &str = "lib";
    34    pub const DLL_SUFFIX: &str = ".so";
    35    pub const DLL_EXTENSION: &str = "so";
    36    pub const EXE_SUFFIX: &str = "";
    37    pub const EXE_EXTENSION: &str = "";
    38}
    39
    40#[cfg(target_os = "cygwin")]
    41pub mod os {
    42    pub const FAMILY: &str = "unix";
    43    pub const OS: &str = "cygwin";
    44    pub const DLL_PREFIX: &str = "";
    45    pub const DLL_SUFFIX: &str = ".dll";
    46    pub const DLL_EXTENSION: &str = "dll";
    47    pub const EXE_SUFFIX: &str = ".exe";
    48    pub const EXE_EXTENSION: &str = "exe";
    49}
    50
    51#[cfg(target_os = "dragonfly")]
    52pub mod os {
    53    pub const FAMILY: &str = "unix";
    54    pub const OS: &str = "dragonfly";
    55    pub const DLL_PREFIX: &str = "lib";
    56    pub const DLL_SUFFIX: &str = ".so";
    57    pub const DLL_EXTENSION: &str = "so";
    58    pub const EXE_SUFFIX: &str = "";
    59    pub const EXE_EXTENSION: &str = "";
    60}
    61
    62#[cfg(target_os = "emscripten")]
    63pub mod os {
    64    pub const FAMILY: &str = "unix";
    65    pub const OS: &str = "emscripten";
    66    pub const DLL_PREFIX: &str = "lib";
    67    pub const DLL_SUFFIX: &str = ".so";
    68    pub const DLL_EXTENSION: &str = "so";
    69    pub const EXE_SUFFIX: &str = ".js";
    70    pub const EXE_EXTENSION: &str = "js";
    71}
    72
    73#[cfg(target_os = "espidf")]
    74pub mod os {
    75    pub const FAMILY: &str = "unix";
    76    pub const OS: &str = "espidf";
    77    pub const DLL_PREFIX: &str = "lib";
    78    pub const DLL_SUFFIX: &str = ".so";
    79    pub const DLL_EXTENSION: &str = "so";
    80    pub const EXE_SUFFIX: &str = "";
    81    pub const EXE_EXTENSION: &str = "";
    82}
    83
    84#[cfg(target_os = "freebsd")]
    85pub mod os {
    86    pub const FAMILY: &str = "unix";
    87    pub const OS: &str = "freebsd";
    88    pub const DLL_PREFIX: &str = "lib";
    89    pub const DLL_SUFFIX: &str = ".so";
    90    pub const DLL_EXTENSION: &str = "so";
    91    pub const EXE_SUFFIX: &str = "";
    92    pub const EXE_EXTENSION: &str = "";
    93}
    94
    95#[cfg(target_os = "fuchsia")]
    96pub mod os {
    97    pub const FAMILY: &str = "unix";
    98    pub const OS: &str = "fuchsia";
    99    pub const DLL_PREFIX: &str = "lib";
    100    pub const DLL_SUFFIX: &str = ".so";
    101    pub const DLL_EXTENSION: &str = "so";
    102    pub const EXE_SUFFIX: &str = "";
    103    pub const EXE_EXTENSION: &str = "";
    104}
    105
    106#[cfg(target_os = "haiku")]
    107pub mod os {
    108    pub const FAMILY: &str = "unix";
    109    pub const OS: &str = "haiku";
    110    pub const DLL_PREFIX: &str = "lib";
    111    pub const DLL_SUFFIX: &str = ".so";
    112    pub const DLL_EXTENSION: &str = "so";
    113    pub const EXE_SUFFIX: &str = "";
    114    pub const EXE_EXTENSION: &str = "";
    115}
    116
    117#[cfg(target_os = "hermit")]
    118pub mod os {
    119    pub const FAMILY: &str = "";
    120    pub const OS: &str = "hermit";
    121    pub const DLL_PREFIX: &str = "";
    122    pub const DLL_SUFFIX: &str = "";
    123    pub const DLL_EXTENSION: &str = "";
    124    pub const EXE_SUFFIX: &str = "";
    125    pub const EXE_EXTENSION: &str = "";
    126}
    127
    128#[cfg(target_os = "horizon")]
    129pub mod os {
    130    pub const FAMILY: &str = "unix";
    131    pub const OS: &str = "horizon";
    132    pub const DLL_PREFIX: &str = "lib";
    133    pub const DLL_SUFFIX: &str = ".so";
    134    pub const DLL_EXTENSION: &str = "so";
    135    pub const EXE_SUFFIX: &str = ".elf";
    136    pub const EXE_EXTENSION: &str = "elf";
    137}
    138
    139#[cfg(target_os = "hurd")]
    140pub mod os {
    141    pub const FAMILY: &str = "unix";
    142    pub const OS: &str = "hurd";
    143    pub const DLL_PREFIX: &str = "lib";
    144    pub const DLL_SUFFIX: &str = ".so";
    145    pub const DLL_EXTENSION: &str = "so";
    146    pub const EXE_SUFFIX: &str = "";
    147    pub const EXE_EXTENSION: &str = "";
    148}
    149
    150#[cfg(target_os = "illumos")]
    151pub mod os {
    152    pub const FAMILY: &str = "unix";
    153    pub const OS: &str = "illumos";
    154    pub const DLL_PREFIX: &str = "lib";
    155    pub const DLL_SUFFIX: &str = ".so";
    156    pub const DLL_EXTENSION: &str = "so";
    157    pub const EXE_SUFFIX: &str = "";
    158    pub const EXE_EXTENSION: &str = "";
    159}
    160
    161#[cfg(target_os = "ios")]
    162pub mod os {
    163    pub const FAMILY: &str = "unix";
    164    pub const OS: &str = "ios";
    165    pub const DLL_PREFIX: &str = "lib";
    166    pub const DLL_SUFFIX: &str = ".dylib";
    167    pub const DLL_EXTENSION: &str = "dylib";
    168    pub const EXE_SUFFIX: &str = "";
    169    pub const EXE_EXTENSION: &str = "";
    170}
    171
    172#[cfg(target_os = "l4re")]
    173pub mod os {
    174    pub const FAMILY: &str = "unix";
    175    pub const OS: &str = "l4re";
    176    pub const DLL_PREFIX: &str = "lib";
    177    pub const DLL_SUFFIX: &str = ".so";
    178    pub const DLL_EXTENSION: &str = "so";
    179    pub const EXE_SUFFIX: &str = "";
    180    pub const EXE_EXTENSION: &str = "";
    181}
    182
    183#[cfg(target_os = "linux")]
    184pub mod os {
    185    pub const FAMILY: &str = "unix";
    186    pub const OS: &str = "linux";
    187    pub const DLL_PREFIX: &str = "lib";
    188    pub const DLL_SUFFIX: &str = ".so";
    189    pub const DLL_EXTENSION: &str = "so";
    190    pub const EXE_SUFFIX: &str = "";
    191    pub const EXE_EXTENSION: &str = "";
    192}
    193
    194#[cfg(target_os = "macos")]
    195pub mod os {
    196    pub const FAMILY: &str = "unix";
    197    pub const OS: &str = "macos";
    198    pub const DLL_PREFIX: &str = "lib";
    199    pub const DLL_SUFFIX: &str = ".dylib";
    200    pub const DLL_EXTENSION: &str = "dylib";
    201    pub const EXE_SUFFIX: &str = "";
    202    pub const EXE_EXTENSION: &str = "";
    203}
    204
    205#[cfg(target_os = "netbsd")]
    206pub mod os {
    207    pub const FAMILY: &str = "unix";
    208    pub const OS: &str = "netbsd";
    209    pub const DLL_PREFIX: &str = "lib";
    210    pub const DLL_SUFFIX: &str = ".so";
    211    pub const DLL_EXTENSION: &str = "so";
    212    pub const EXE_SUFFIX: &str = "";
    213    pub const EXE_EXTENSION: &str = "";
    214}
    215
    216#[cfg(target_os = "nto")]
    217pub mod os {
    218    pub const FAMILY: &str = "unix";
    219    pub const OS: &str = "nto";
    220    pub const DLL_PREFIX: &str = "lib";
    221    pub const DLL_SUFFIX: &str = ".so";
    222    pub const DLL_EXTENSION: &str = "so";
    223    pub const EXE_SUFFIX: &str = "";
    224    pub const EXE_EXTENSION: &str = "";
    225}
    226
    227#[cfg(target_os = "nuttx")]
    228pub mod os {
    229    pub const FAMILY: &str = "unix";
    230    pub const OS: &str = "nuttx";
    231    pub const DLL_PREFIX: &str = "lib";
    232    pub const DLL_SUFFIX: &str = ".so";
    233    pub const DLL_EXTENSION: &str = "so";
    234    pub const EXE_SUFFIX: &str = "";
    235    pub const EXE_EXTENSION: &str = "";
    236}
    237
    238#[cfg(target_os = "openbsd")]
    239pub mod os {
    240    pub const FAMILY: &str = "unix";
    241    pub const OS: &str = "openbsd";
    242    pub const DLL_PREFIX: &str = "lib";
    243    pub const DLL_SUFFIX: &str = ".so";
    244    pub const DLL_EXTENSION: &str = "so";
    245    pub const EXE_SUFFIX: &str = "";
    246    pub const EXE_EXTENSION: &str = "";
    247}
    248
    249#[cfg(target_os = "redox")]
    250pub mod os {
    251    pub const FAMILY: &str = "unix";
    252    pub const OS: &str = "redox";
    253    pub const DLL_PREFIX: &str = "lib";
    254    pub const DLL_SUFFIX: &str = ".so";
    255    pub const DLL_EXTENSION: &str = "so";
    256    pub const EXE_SUFFIX: &str = "";
    257    pub const EXE_EXTENSION: &str = "";
    258}
    259
    260#[cfg(target_os = "rtems")]
    261pub mod os {
    262    pub const FAMILY: &str = "unix";
    263    pub const OS: &str = "rtems";
    264    pub const DLL_PREFIX: &str = "lib";
    265    pub const DLL_SUFFIX: &str = ".so";
    266    pub const DLL_EXTENSION: &str = "so";
    267    pub const EXE_SUFFIX: &str = "";
    268    pub const EXE_EXTENSION: &str = "";
    269}
    270
    271#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
    272pub mod os {
    273    pub const FAMILY: &str = "";
    274    pub const OS: &str = "";
    275    pub const DLL_PREFIX: &str = "";
    276    pub const DLL_SUFFIX: &str = ".sgxs";
    277    pub const DLL_EXTENSION: &str = "sgxs";
    278    pub const EXE_SUFFIX: &str = ".sgxs";
    279    pub const EXE_EXTENSION: &str = "sgxs";
    280}
    281
    282#[cfg(target_os = "solaris")]
    283pub mod os {
    284    pub const FAMILY: &str = "unix";
    285    pub const OS: &str = "solaris";
    286    pub const DLL_PREFIX: &str = "lib";
    287    pub const DLL_SUFFIX: &str = ".so";
    288    pub const DLL_EXTENSION: &str = "so";
    289    pub const EXE_SUFFIX: &str = "";
    290    pub const EXE_EXTENSION: &str = "";
    291}
    292
    293#[cfg(target_os = "solid_asp3")]
    294pub mod os {
    295    pub const FAMILY: &str = "itron";
    296    pub const OS: &str = "solid";
    297    pub const DLL_PREFIX: &str = "";
    298    pub const DLL_SUFFIX: &str = ".so";
    299    pub const DLL_EXTENSION: &str = "so";
    300    pub const EXE_SUFFIX: &str = "";
    301    pub const EXE_EXTENSION: &str = "";
    302}
    303
    304#[cfg(target_os = "tvos")]
    305pub mod os {
    306    pub const FAMILY: &str = "unix";
    307    pub const OS: &str = "tvos";
    308    pub const DLL_PREFIX: &str = "lib";
    309    pub const DLL_SUFFIX: &str = ".dylib";
    310    pub const DLL_EXTENSION: &str = "dylib";
    311    pub const EXE_SUFFIX: &str = "";
    312    pub const EXE_EXTENSION: &str = "";
    313}
    314
    315#[cfg(target_os = "uefi")]
    316pub mod os {
    317    pub const FAMILY: &str = "";
    318    pub const OS: &str = "uefi";
    319    pub const DLL_PREFIX: &str = "";
    320    pub const DLL_SUFFIX: &str = "";
    321    pub const DLL_EXTENSION: &str = "";
    322    pub const EXE_SUFFIX: &str = ".efi";
    323    pub const EXE_EXTENSION: &str = "efi";
    324}
    325
    326#[cfg(target_os = "vexos")]
    327pub mod os {
    328    pub const FAMILY: &str = "";
    329    pub const OS: &str = "vexos";
    330    pub const DLL_PREFIX: &str = "";
    331    pub const DLL_SUFFIX: &str = "";
    332    pub const DLL_EXTENSION: &str = "";
    333    pub const EXE_SUFFIX: &str = ".bin";
    334    pub const EXE_EXTENSION: &str = "bin";
    335}
    336
    337#[cfg(target_os = "visionos")]
    338pub mod os {
    339    pub const FAMILY: &str = "unix";
    340    pub const OS: &str = "visionos";
    341    pub const DLL_PREFIX: &str = "lib";
    342    pub const DLL_SUFFIX: &str = ".dylib";
    343    pub const DLL_EXTENSION: &str = "dylib";
    344    pub const EXE_SUFFIX: &str = "";
    345    pub const EXE_EXTENSION: &str = "";
    346}
    347
    348#[cfg(target_os = "vita")]
    349pub mod os {
    350    pub const FAMILY: &str = "unix";
    351    pub const OS: &str = "vita";
    352    pub const DLL_PREFIX: &str = "lib";
    353    pub const DLL_SUFFIX: &str = ".so";
    354    pub const DLL_EXTENSION: &str = "so";
    355    pub const EXE_SUFFIX: &str = ".elf";
    356    pub const EXE_EXTENSION: &str = "elf";
    357}
    358
    359#[cfg(target_os = "vxworks")]
    360pub mod os {
    361    pub const FAMILY: &str = "unix";
    362    pub const OS: &str = "vxworks";
    363    pub const DLL_PREFIX: &str = "lib";
    364    pub const DLL_SUFFIX: &str = ".so";
    365    pub const DLL_EXTENSION: &str = "so";
    366    pub const EXE_SUFFIX: &str = "";
    367    pub const EXE_EXTENSION: &str = "";
    368}
    369
    370#[cfg(all(target_family = "wasm", not(any(target_os = "emscripten", target_os = "linux"))))]
    371pub mod os {
    372    pub const FAMILY: &str = "";
    373    pub const OS: &str = "";
    374    pub const DLL_PREFIX: &str = "";
    375    pub const DLL_SUFFIX: &str = ".wasm";
    376    pub const DLL_EXTENSION: &str = "wasm";
    377    pub const EXE_SUFFIX: &str = ".wasm";
    378    pub const EXE_EXTENSION: &str = "wasm";
    379}
    380
    381#[cfg(target_os = "watchos")]
    382pub mod os {
    383    pub const FAMILY: &str = "unix";
    384    pub const OS: &str = "watchos";
    385    pub const DLL_PREFIX: &str = "lib";
    386    pub const DLL_SUFFIX: &str = ".dylib";
    387    pub const DLL_EXTENSION: &str = "dylib";
    388    pub const EXE_SUFFIX: &str = "";
    389    pub const EXE_EXTENSION: &str = "";
    390}
    391
    392#[cfg(target_os = "windows")]
    393pub mod os {
    394    pub const FAMILY: &str = "windows";
    395    pub const OS: &str = "windows";
    396    pub const DLL_PREFIX: &str = "";
    397    pub const DLL_SUFFIX: &str = ".dll";
    398    pub const DLL_EXTENSION: &str = "dll";
    399    pub const EXE_SUFFIX: &str = ".exe";
    400    pub const EXE_EXTENSION: &str = "exe";
    401}
    402
    403#[cfg(target_os = "zkvm")]
    404pub mod os {
    405    pub const FAMILY: &str = "";
    406    pub const OS: &str = "";
    407    pub const DLL_PREFIX: &str = "";
    408    pub const DLL_SUFFIX: &str = ".elf";
    409    pub const DLL_EXTENSION: &str = "elf";
    410    pub const EXE_SUFFIX: &str = ".elf";
    411    pub const EXE_EXTENSION: &str = "elf";
    412}
    413
    414// The fallback when none of the other gates match.
    415#[else]
    416pub mod os {
    417    pub const FAMILY: &str = "";
    418    pub const OS: &str = "";
    419    pub const DLL_PREFIX: &str = "";
    420    pub const DLL_SUFFIX: &str = "";
    421    pub const DLL_EXTENSION: &str = "";
    422    pub const EXE_SUFFIX: &str = "";
    423    pub const EXE_EXTENSION: &str = "";
    424}
    425
    426}