When building libraries, build c-sources separately for profiling.

Fixes #1284.

There is no need to do this for exes since they are always built in only one
way.

One downside of this patch is that it increases the compilation time when
building with '--enable-library-profiling'. An alternative solution would be to
add a new field (e.g. 'c-sources-ffi') for non-Haskell sources that depend on
the GHC "way".