Remove duplicated code from the makefile