diff options
Diffstat (limited to 'nacl/cpucycles/do')
-rwxr-xr-x | nacl/cpucycles/do | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/nacl/cpucycles/do b/nacl/cpucycles/do new file mode 100755 index 00000000..efc063de --- /dev/null +++ b/nacl/cpucycles/do | |||
@@ -0,0 +1,105 @@ | |||
1 | #!/bin/sh -e | ||
2 | |||
3 | okabi | ( | ||
4 | while read abi | ||
5 | do | ||
6 | |||
7 | rm -f cpucycles.o cpucycles.h | ||
8 | |||
9 | ( | ||
10 | case "$abi" in | ||
11 | ppc*) | ||
12 | echo powerpccpuinfo | ||
13 | echo powerpcmacos | ||
14 | ;; | ||
15 | amd64*) | ||
16 | echo amd64tscfreq | ||
17 | echo amd64cpuinfo | ||
18 | echo amd64cpuspeed | ||
19 | ;; | ||
20 | x86*) | ||
21 | echo x86tscfreq | ||
22 | echo x86cpuinfo | ||
23 | echo x86cpuspeed | ||
24 | echo x86estimate | ||
25 | ;; | ||
26 | cell*) | ||
27 | echo celllinux | ||
28 | ;; | ||
29 | sparc*) | ||
30 | echo sparccpuinfo | ||
31 | echo sparc32cpuinfo | ||
32 | ;; | ||
33 | mips*) | ||
34 | echo mips | ||
35 | ;; | ||
36 | hppa*) | ||
37 | echo hppapstat | ||
38 | ;; | ||
39 | alpha*) | ||
40 | echo alpha | ||
41 | ;; | ||
42 | sgi*) | ||
43 | echo sgi | ||
44 | ;; | ||
45 | arm*) | ||
46 | echo cortex | ||
47 | echo dev4ns | ||
48 | ;; | ||
49 | esac | ||
50 | |||
51 | echo amd64tscfreq | ||
52 | echo amd64cpuinfo | ||
53 | echo amd64cpuspeed | ||
54 | echo x86tscfreq | ||
55 | echo x86cpuinfo | ||
56 | echo x86cpuspeed | ||
57 | echo x86estimate | ||
58 | echo ia64cpuinfo | ||
59 | echo powerpccpuinfo | ||
60 | echo powerpcmacos | ||
61 | echo celllinux | ||
62 | echo sparccpuinfo | ||
63 | echo sparc32cpuinfo | ||
64 | echo mips | ||
65 | echo hppapstat | ||
66 | echo alpha | ||
67 | echo sgi | ||
68 | echo cortex | ||
69 | echo dev4ns | ||
70 | echo monotoniccpuinfo | ||
71 | echo monotonic | ||
72 | echo gettimeofday | ||
73 | ) | ( | ||
74 | while read n | ||
75 | do | ||
76 | okc-$abi | ( | ||
77 | while read c | ||
78 | do | ||
79 | echo "=== `date` === Trying $n.c with $c..." >&2 | ||
80 | rm -f test cpucycles-impl.o cpucycles-impl.h cpucycles-impl.c | ||
81 | cp $n.c cpucycles-impl.c || continue | ||
82 | cp $n.h cpucycles-impl.h || continue | ||
83 | $c -c cpucycles-impl.c || continue | ||
84 | $c -o test test.c cpucycles-impl.o || continue | ||
85 | ./test || continue | ||
86 | echo "=== `date` === Success. Using $n.c." >&2 | ||
87 | mkdir -p lib/$abi | ||
88 | mv cpucycles-impl.o lib/$abi/cpucycles.o | ||
89 | mkdir -p include/$abi | ||
90 | mv cpucycles-impl.h include/$abi/cpucycles.h | ||
91 | exit 0 | ||
92 | done | ||
93 | exit 111 | ||
94 | ) && exit 0 | ||
95 | done | ||
96 | exit 111 | ||
97 | ) || ( | ||
98 | echo ===== Giving up. >&2 | ||
99 | rm -f test cpucycles-impl.o cpucycles-impl.h cpucycles-impl.c | ||
100 | exit 111 | ||
101 | ) || exit 0 | ||
102 | |||
103 | done | ||
104 | exit 0 | ||
105 | ) || exit 111 | ||