Cleaning up after custom PHP compile

I’ve compiled a custom version of php, but now want to clean up the files used in the compilation.

When the php cgi is compiled, are all the extensions compiled into the one file, or does the cgi reference libraries pointed to in the php configure statement? If it references other files, how do I know which ones id points to, so as to know what I can and can’t delete.