I want to get the value of a variable named $ (MYVAR) _SOME_SUFFIX in the make.md file. Instead, I get "b.mak (2): fatal error U1001: syntax error: illegal character" $ "in the macro"
# ---- a.mak ---- all : set MYVAR=SOME_PREFIX nmake -f b.mak #--- END --- # ---- b.mak ---- all: @echo $($(MYVAR)_SOME_SUFFIX) #--- END ---
You can do what you want with embedded 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 on the console: 24.
nmake -f piotr1.mak
Source: https://habr.com/ru/post/1332493/More articles:liferay: how to get out of the auto catalog in the first place - javaManual ownership of an object versus smart pointers - c ++Check file existence in NMake - makefileCSS Horizontal Menu: Display: Inline And Block? Make cover link as a whole LI? - cssDisplay a PDF file in a control in Visual Basic 2010 - vb.netC # Singleton Pattern over inherited classes - inheritanceWindows Vista and 7 motion effects are applied only once when my form is displayed. What for? - windowsOracle: query with function "N" - what data type should I use? - typesCan't figure out how to read a file with nmake - nmakenmake: can a batch file work as part of the make command block, affect the environment of the nmake.exe process? - nmakeAll Articles