build.sh: better handling of .lno and .log files