How to detect boards

I have a sketch that works on UNO and Teensy 3.6. I want to use something like the following to discover which one the sketch is running on:

#ifdef <tensy 3.6 id>
  run teensy code
  run UNO coded

Is there a list somewhere that indicates what #ifdef values to use for each type of board?
If the detection isn’t done this way, then how?

i found that the following work for Arduinos

#if defined __AVR_ATmega328P__      // Uno
#if defined __AVR_ATmega2560__

there may be something similar for the ARM processor

Thanks I'll run some tests and do more research on detecting chip types.


EDIT // Even easier:

> grep build.board  hardware/teensy/avr/boards.txt

These get ARDUINO_ prefix so this does the trick:


For AVR boards there is ARDUINO_AVR_BOARDNAME.


Thank you so much oqibidipo. That did it…

Best regards!