$(LDFLAGS) and fprintf

$(LDFLAGS) is not properly passed to all the building of all targets.
There are some calls to printf that should be fprintf.