Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 87339da

Browse files
committedApr 15, 2025·
Use cfg_if for unsupported fallback
1 parent 6305037 commit 87339da

File tree

2 files changed

+288
-378
lines changed

2 files changed

+288
-378
lines changed
 

‎library/std/src/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ impl fmt::Debug for ArgsOs {
950950
/// Constants associated with the current target
951951
#[stable(feature = "env", since = "1.0.0")]
952952
pub mod consts {
953-
use crate::sys::env_consts::os;
953+
use crate::sys::env_consts as os;
954954

955955
/// A string describing the architecture of the CPU that is currently in use.
956956
/// An example value may be: `"x86"`, `"arm"` or `"riscv64"`.

‎library/std/src/sys/env_consts.rs

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

0 commit comments

Comments
 (0)
Please sign in to comment.