Split makefile into per-device configuration and common patterns