I have an extension which I am trying to build using distutils. There are a series of .c files in a subdirectory, and a couple of driver C files. The subdirectory files should, ideally, be compiled and then built into a temporary .lib file, which is then linked with the 2 individual driver files to create two .pyd extensions. I can do the build by listing all of the subdirectory .c files in the build instructions for the 2 .pyds, but if I do this, the compiler (MSVC) doesn't seem to eliminate unused object files. So either I need to list exactly the right .c files for each extension, or I build the intermediate .lib.
The problem is, I can't work out if it is possible to persuade distutils to build an intermediate library like this. Is it possible? If so, can anyone point me to any suitable examples of what to do? (Or alternatively, point me at the appropriate parts of the source, and appropriate example setup.py files, to allow me to work out how to do this for myself.)