Refactor makefile to honor dependencies

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>