Density functional theory of lamellar ordering in diblock copolymers