Remove unnecessary dependency on headers, since it's already
implicit through the object files.
Don't use -pie link option when linking against static libraries.

Position Independent Executables require code to be compiled with
PIC/PIE, but at least on Debian static libraries are compiled
without. Hence, filter out this linker option for these binaries.
I'm not aware of an option to "partially link" with -pie, or any
better workaround that improves security.