Homogenization in an optimal design problem with quadratic weakly discontinuous objective functional