Bug 1029385 - Rewrite app-makefile rule in javascript

I would have added a try/catch here with an helpful error message to say that BUILD_APP_NAME regexp is wrong.