compile debug print functionality only when DEBUG is defined

This reduces compilation time and (more importantly) silences false warnings.