Exclude code based on device

My code base is large as it supports LOTs of devices.   Is there a way to exclude code based upon the device so the memory footprint is smaller for each device?