See debian/rules. You might also want to look at http://www.debian.org/doc/debian-policy/ch-source.html, especially http://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules .
[there should be better documentation, but I'm not sure what it would be] Daniel