Fix race condition on mkdir in codegen

This is done by moving mkdir from codegen into the Makefile.
Remove now-unused fs import
Merge pull request #59 from zr40/fix-race-cond

Fix race condition on mkdir in codegen