Is it possible to put the equivalent of #define VAR (in a C program) into a makefile, so that one can control which part of the program should be compiled?
#define VAR
Yes.
Most compilers support command line options for specifying #define's. For Visual C++, this is the /D option.