aboutsummaryrefslogtreecommitdiff
path: root/cartbank2.sh
blob: d9a0bce243e29919f734d3f38155e0fd0899acfb (plain)
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
#!/bin/sh

# cc65 linker script stuff changed between 2.15 and 2.16. Pick the right
# .cfg for the version of cc65 we're using.

DEST="cartbank2.cfg"

VER="$( cc65 --version 2>&1 | sed 's,^.*V\([0-9.]*\) .*$,\1,' )"
MAJOR="$( echo "$VER" | cut -d. -f1 )"
MINOR="$( echo "$VER" | cut -d. -f2 )"
VERDEC="$( printf "%d%03d" "$MAJOR" "$MINOR" )"

if [ "$VERDEC" -lt "2015" ]; then
  echo "*** Warning: cc65 version $VER is too old, upgrade to at least 2.15"
  CFG=old
elif [ "$VERDEC" -eq "2015" ]; then
  CFG=old
else
  CFG=new
fi

CONFIG="$DEST.$CFG"
echo "=== Found cc65 version $VER, using $CONFIG"
rm -f "$DEST"
cp "$CONFIG" "$DEST"