Generalize some aspects of Makefiles and building different base images.

In particular, this adds support for POSTFIX and EXTRAS variables.