-
Notifications
You must be signed in to change notification settings - Fork 116
/
spudfrog
executable file
·51 lines (36 loc) · 2 KB
/
spudfrog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Trusted build attendant
die() { echo "spudfrog: $@"; exit 1; }
max() { [ $1 -gt $2 ] && echo $1 || echo $2; }
[ -n "$OPT" ] || die "i need to be called from Makefile"
red="[31;1m"; green="[32;1m"; yellow="[33;1m"; blue="[34;1m"
purple="[35;1m"; cyan="[36;1m"; end="[0m"
ngreen="[32m"; white="[37;1m" gray="[30;1m"
cc1=$( $CC $CFLAGS -E -v - </dev/null 2>&1 | grep cc1 | head -1 | tr -d '\\"' )
build="${green}[native]${end}"
echo "$cc1" | grep -q "mtune=generic" && build="${cyan}[generic]${end}"
static=""
[ "$STATIC_BUILD" = 1 ] && static=" ${green}[static]${end}"
dcnn=" ${cyan}[!dcnn]${end}"
[ "$DCNN" = 1 ] && dcnn=" ${green}[dcnn]${end}"
opt=" ${cyan}[$OPT]${end}"
[ "$OPT" = "-O3" ] && opt=" ${green}[$OPT]${end}"
boardsize=""
[ -n "$BOARD_SIZE" ] && boardsize=" ${cyan}[${BOARD_SIZE}x${BOARD_SIZE}]${end}"
fifo=""
[ "$FIFO" = 1 ] && fifo=" ${cyan}[fifo]${end}"
float=""
[ "$DOUBLE_FLOATING" = 1 ] && float=" ${cyan}[double]${end}"
distributed=""
[ "$DISTRIBUTED" = 1 ] && distributed=" ${cyan}[distributed]${end}"
status="$build$static$dcnn$opt$boardsize$fifo$float$distributed"
raw=${status//?????m/}; raw=${raw//${end}/}
n=`max $[45-${#raw}] 0`; n1=$[$n/2]; n2=$[$n-$n1]
spud=$gray
printf "%s (.)~(.) $end\n" $spud
printf "%s (-------) $end\n" $spud
printf "%s .------%sooO%s-----%sOoo%s------------------------------.$end\n" $gray $spud $gray $spud $gray
printf "%s | ${end} %*s%s%*s $gray |$end\n" $gray $n1 "" "$status" $n2 ""
printf "%s ᛫-----------------------------------------------᛫$end\n" $gray
printf "%s ( ) ( ) $end \n" $spud
printf "\n"