Refactored makefile for building library