I'm new to nmake and needing to modify a build script. I want to execute a command and capture the result in a variable that will then be used throughout the script. However when attempting to use the shell command I receive the following error message:
makefile(4) : fatal error U1000: syntax error : ')' missing in macro invocation
Stop.
I put together a one line script to test the shell command.
Makefile:
CMDRESULT = $(shell hostname)
all:
echo $(CMDRESULT)
Here's the version of nmake being used:
>nmake /?
Microsoft (R) Program Maintenance Utility Version 11.00.60610.1
Copyright (C) Microsoft Corporation. All rights reserved.
Does nmake support the shell command? Is there another option in nmake to execute a command and capture the result?
It is possible to read another programs output into nmake variable using temporay files if the output contains a single line of text. It is also possible to use external scripts to modify multiple line outputs and make this solution work. An example to read a single line output to nmake variable:
!IF [hostname>hostname.tmp] == 0
H_NAME = \
!INCLUDE hostname.tmp
!IF [del hostname.tmp] == 0
!ENDIF
!ENDIF
This [for execution]
is used to execute some commands and compare the return code
of the program. It is done during pre-processing. After tha a hack described here "Can't figure out how to read file from nmake" is used to read a single line from temporary file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With