Nmake: can a batch file work as part of the make command block, affect the environment of the nmake.exe process?

I think in nmake, if I do this:

example : set value=77 echo %%value%% 

As a result, 77 will be displayed on the console.

Is there a way to call a .cmd or .bat file that will affect the environment of the nmake.exe process? Suppose I put the set value=77 operator in a file called "setvalue.cmd". Then change the makefile to this:

  example : setvalue echo %%value%% 

I get:

 %value% 

Alternatively, if there is a way to set the macro in the command block, this will also work. Or a way to set the macro value from a batch file, even outside the batch block.

+2
source share
2 answers

No, I do not think so.

0
source

You can create a nmake fragment during preprocessing of the makefile and read this. Assuming batch.cmd prints the actual nmake syntax, then

 !if [batch.cmd >makefile.auto] !error *** Could not create makefile.auto !endif !include makefile.auto 

You need to make sure that batch.cmd matches %errorlevel% accordingly (e.g. exit /b 22 ).

makefile.auto can contain anything, but you probably need stuff like value=77 . A few points:

  • Difference value using nmake syntax ( $(value) )
  • If necessary, you can pass the parameters batch.cmd ( [batch.cmd $(OBJECTS) >makefile.auto] )
+3
source

Source: https://habr.com/ru/post/1332498/


All Articles