Bugfix: filename without extension not terminated and compiled objects need subdirectories
When generating the filename without the file extension, terminate the string.
When library sources are specified using subdirectory paths, object files should have the same subdirectory structure.
This only applies to object files because they are compiled using the same naming structure as the sources.
The rest of the compiled code is compiled into a new structure, which is generally a single library or program.