Check for log directory.
Also optimization added to Makefile.