Remove variable and code repetitions in master makefile