I want to make a program which includes source files and header files from a sub-directory in addition to the main directory. The name of the sub-directory, and parts of the filenames themselves need to be chosen with a compiler constant. Here's an example file tree.
=main.h
=main.c
=anotherfile.h
=anotherfile.c
=A
---= A_file1.h
---= A_file1.c
---= A_file2.h
=B
---= B_file1.h
---= B_file1.c
---= B_file2.h
Every compilation involves main and anotherfile, which reference X_file1 and X_file2 where "X" is chosen at built time or with a constant. So the project can either be built with A files or B files.
So how does one (and what is the "best" way to) implement this? Can one put a reference to a compiler constant in an #include statement? (something like #include X+"/"+"x+"_file1.h) Or is there another way?
I'm very new to C build systems & the preprocessor so apologies if this is a poor question. Search engines have not been much help.