Arduino Uno/Leonardo sketch compatibility

I'm writing a code which uses direct port manipulation. Since ports on Uno and Leonardo are different and I want to maintain compatibility, is this the correct way of doing it?

#if defined(AVR_ATmega32U4)
#define LEONARDO
#else
#define UNO
#endif

Why define a second name? Use the one that you know for the Leonardo, and look up the proper name for the UNO. That way, you won't be trying to compile for the Mega using UNO pins.