I have code with various parts which can be enabled or disabled with macros. This can be done with #ifdef/#endif in the code, with -D options in the makefile and by calling make with setting the macro. Example:
make DOMP=-DUSE_OMP
In the makefile
calco.o: calco.cpp calco.h
$(CC) calco.cpp -o calco.o $(DOMP)
in the code
#ifdef USE_OMP
#pragma omp parallel for
#endif
for (i =0; i < N; i++) {
...
}
I have quite a few of possible macros that can be set and would like to be able to have these set simply by making a different target. For example
make calc_abc
would build my application using a particular set of macros, whereas
make calc_xyz
would do this with a different set of macros.
I tried different approaches in my makefile, but found nothing that worked. Is something like this possible at all?