A #include tells the compiler to put the text of that file right there. That is before the compiler starts compiling. Anything you do before the #include can be used.
Another thing at text level (before compiling) is the #ifdef directives : Conditional inclusion - cppreference.com
There are two ways:
- Make a define or not. You can test if the define exists with #ifdef MYSERIALPORT
- Give a define a number. Test what number the define has #if MYSERIALPORT == 1