I had been able to reproduce the behavior with the static lib wizard of Code::Blocks. The problem is, if the project file .cbp and the sources of the project are on different drives. In the attached file the project static_lib/static_lib.cbp is on e.g C:\temp\static_lib and the source file main.c on a network drive r:\tausch\mario\testx. The output directory in the project file is configured as build\Debug but instead of generating objects in object output dir C:\temp\static_lib\build\Debug they are generated in the source directory r:\tausch\mario\testx.
I wrote this earlier that this behaviour is hard-coded.
IMHO, the fallback code should create the relative path of object file to
C:\temp\static_lib\build\Debug\r\tausch\mario\testx.
There is only one, but a nasty, problem. In C::B every plugin handles file path creation/manipulation on it's own. I'm not sure if I make such changes, other parts would function normally or not.
I'll try to fix this issue.