Refactor Makefiles.

Change-Id: I025899d491299721f17e62833a64c296426ebd3d
Signed-off-by: Wei-Chung Wen <morisato3711@gmail.com>