Re-write makefile to more easily support building other distributions.

The %: %.appl rules is a little bit magic, the rest is just standard (gnu?) make wildcard rules.