[1.6.x] Allowed overriding variables in docs/Makefile.

Backport of c694e6220e from master