- Utility: NMake
- Platform : Windows 7
I have the following Makefile
FILE = $(shell) *.c
FILE += $(shell) *.cpp
exec:
@echo $(FILE)
This works perfectly fine with make. This throws up the following error with nmake
makefile(2) : fatal error U1036: syntax error : too many names to left of '='
Stop.
What could be the reason?
Without the line
FILE += $(shell) *.cpp
nmake works perfectly fine.
The
+=syntax is a GNU Make extension that was pioneered in Sun’smakein the late 80s. It is not part of the syntax for POSIX standardmake, or the original AT&Tmake.If you use extensions, you get caught when you switch to a system that doesn’t support them. You either have to rework things (hard) or stick with the original system.
One way to modify the file to work with
nmakeis probably:Or, given that the macro
shellis not defined, even: