Update genmake.sh

Disallow invalid arguments.
Fix directory change bug.