blob: 31116533e4fcdb4bc1e9799a0d3d50412446e512 [file] [log] [blame]
swissChili9b46c902022-07-10 15:48:46 -07001# -*- tcl -*-
2
3variable isas
4variable devices
5
6variable isa_features
7
8proc isa {name} {
9 lappend ::isas $name
10}
11
12proc device {name isa} {
13 lappend ::devices($isa) $name
14}
15
16proc target_feature {feature} {
17 lappend ::isa_features $feature
18}
19
20proc target_features {args} {
21 lappend ::isa_features {*}$args
22}
23
24proc feature_supported {feature} {
25 return [expr {[lsearch -exact $::isa_features $feature] != -1}]
26}
27
28option ISA x86_32
swissChili56cf8172022-07-30 18:47:48 -070029option DEVICE generic
swissChili9b46c902022-07-10 15:48:46 -070030
31proc source_if_exists {path} {
32 if {[file exists $path]} {
33 uplevel 1 jmk_source $path
34 }
35}
36
37proc enable_multiplat {} {
38 uplevel 1 source_if_exists "$::root/etc/platforms/platforms.jmk"
39
40 if {[lsearch -exact $::isas $::options(ISA)] == -1} {
41 jmk_error "Specified ISA $::options(ISA) is invalid, choose one of $::isas"
42 }
43
44 if {[lsearch -exact $::devices($::options(ISA)) $::options(DEVICE)] == -1} {
45 jmk_error "Specified DEVICE $::options(DEVICE) is invalid, choose one of $::devices($::options(ISA))"
46 }
47
48 uplevel 1 source_if_exists "$::root/etc/platforms/$::options(ISA)/$::options(DEVICE).jmk"
49 uplevel 1 source_if_exists "$::root/etc/platforms/$::options(ISA)/$::options(ISA).jmk"
50
51 uplevel 1 source_if_exists "$::options(ISA)/$::options(DEVICE).jmk"
52 uplevel 1 source_if_exists "$::options(ISA)/$::options(ISA).jmk"
53}