Refine Makefile with function calls