The chemical reactions and pathways involving macromolecules forming, or destined to form, part of a cell wall. A cell wall is a rigid or semi-rigid envelope lying outside the cell membrane of plant, fungal and most prokaryotic cells, maintaining their shape and protecting them from osmotic lysis, occurring at the level of the cell.