Like said by "doom" your gonna want to sell mastered "all" materia for 1.4 million a piece. You can buy "all" from fort condor and max them in the last dungeon
on the enemy "magic pot" for 1000 ap per pot (up to two) or "movers" for 2400 ap per battle.
Get your characters "growth" times 2 weapon (or 3, but only cid and cloud have a growth times 3 weapon) and times 2 armor to speed up your farming, and just farm magic pots, and movers. When ones mastered, simply replace it with the new one that's created when the original is mastered. You can steal elixirs from the enemies in the same area as the pots and movers or use the W-item glitch to get an unlimited supply. For a more in depth explanation as to the location of growth 2/3 equipment and where to find magic pots and movers watch the video provided.