In the IDE when you select a board to compile to under tools -> Board, is there a constant or #define set that identifies that board so we can conditionally compile our code ?
The board type is passed from the compile command:
... -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR ...
Which you can see if you turn on "verbose" compilation in the preferences screen.
The various values come from the build.board variables defined in the appropriate boards.txt file (for the board type) (I'm not quite sure where "arduino_arch_xxx" comes from.)