I'd like to get value of variable named $(MYVAR)_SOME_SUFFIX in the b.mak makefile.
Instead I get "b.mak(2) : fatal error U1001: syntax error : illegal character '$' in macro"
# ---- a.mak ----
all :
set MYVAR=SOME_PREFIX
nmake -f b.mak
#--- END ---
# ---- b.mak ----
all:
@echo $($(MYVAR)_SOME_SUFFIX)
#--- END ---
You can sort of do what you want with inline files.
# ---- piotr1.mak ----
all :
nmake -nologo -f piotr2.mak MYVAR=BBB
#--- END ---
# ---- piotr2.mak ----
AAA_SETTING=17
BBB_SETTING=24
AVAR=$(MYVAR)_SETTING
all:
# create and invoke a temporary cmd file
@<<myecho.cmd
@echo off
setlocal
REM insert nMAKE macros into environment of the command
set AAA_SETTING=$(AAA_SETTING)
set BBB_SETTING=$(BBB_SETTING)
REM now echo the value of whichever env var is named by the
REM nmake macro, AVAR.
echo %$(AVAR)%
endlocal
<<
#--- END ---
when I run nmake -f piotr1.mak
I get the expected value echo'd to the console: 24.