I usually pass macro definitions from the "make command line" to the "makefile" with the option: -Dname = value. The definition is available inside the makefile.
I also pass macros from the "makefile" to the "source code" using a similar compiler option: -Dname = value (supported by many compilers). This definition is available in source code.
Now I need the user of my make file to be able to transfer arbitrary macros from the "make.exe commandline" to the "source code" right away without changing anything in the make file.
so that the user can enter: make -f mymakefile.mk -SOMEOPTION var = 5
then directly the main.c code can see var:
int main() { int i = var; }
c macros makefile
MohamedEzz Jan 29 '12 at 11:22 2012-01-29 11:22
source share