Some fixes to make example project build on Ubuntu 11.10

* put object files *before* libs in gcc command!
* execute scripts under tools/ with bash instead of sh