I am using simulink to generate c-code. For the compilation of the code a generate makefile is used.
In this make file the following variable "MAKECMD" is made. This variable is used to make a `*.bat` file (how this is done I don't know yet.)
This is what is in the make file
SRCDIR = $(PROJECTROOT)\\Implementation\\Src
BLDDIR = $(PROJECTROOT)\\Implementation\\Bld
CFGDIR = $(PROJECTROOT)\\Implementation\\Cfg
BINDIR = $(BLDDIR)\\bin
MAKECMD = $(PROJECTROOT)\ ools\\gmake\\make.exe
When I look in the `*.bat` file that is generated I see that the `$(PROJECTROOT)` is not expandend.
set MEMORY_MODEL=BANKED
set PROJECTROOT=C:\\DOCUMENT\\Software\\Matlab\\Move\\S12X_Target_R2009a
set CW_ROOT=C:\\Programs\\Freescale\\CodeWarS12
$(PROJECTROOT)\ ools\\gmake\\make.exe S12X
What should I do so that `$(PROJECTROOT)` wil be expandend in the `*.bat` file
so that the last line will look like this:
C:\\DOCUMENT\\Software\\Matlab\\Move\\S12X_Target_R2009a\\\ ools\\gmake\\make.exe S12X
It's hard to tell you exactly what's wrong without the whole makefile however here's some things that might be causing your issue:
make has 2 assignment operators '=' and ':='. ':=' will evaluate the right hand side and assign the expanded string to the variable. '=' Will not and the reference to variables will be preserved in the string. However, depending on how these variables are used they should just be evaluated at the command `@echo $(BINDIR)` or similar.
make will not evaluate the variable if the variable doesn't exist so, if the variable is missing you will only see the reference as if it were text. This would imply that at the time of the make call PROJECTROOT is not set. If you were calling make through matlab/simulink, this is not likely the issue. If you are calling make through the terminal then, before calling make check the value of PROJECTROOT with `echo $(PROJECTROOT)`