C

Asked • 05/18/19

How to expand nested variables in makefile?

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

1 Expert Answer

By:

Johnathan D. answered • 02/28/25

Tutor
New to Wyzant

Tutor for Computer Engineer, Science and Math

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.