Distribution function theory for inhomogeneous fluids