Fix race condition on mkdir in codegen

This is done by moving mkdir from codegen into the Makefile.

The race condition would occur when invoking make with -j2.

This commit also adds the missing `<output-dir>` parameter to the usage.