#!/bin/sh
#
# optim.sh : Insert better optimisations for romcc with PII processor.

BASE=${1?Need a directory with 'fallback' and 'normal'.}

if [ ! -d $BASE/fallback ]; then
	echo -e "\nThere is no directory \"$BASE/fallback\". Aborting.\n"
	exit 1
fi

do_change () {
	sed -i '/romcc.*-O / s/-O/-O2 -mcpu=p2/' $1
}

do_change $BASE/normal/Makefile

do_change $BASE/fallback/Makefile
