I have the following makefile:
all:
echo $(PATH)
When I execute the file using the following command
make -f pathtest.mk
I get both an error and correct execution. The error is listed bellow
/usr/bin/sh: -c: line 0: syntax error near unexpected token `('
/usr/bin/sh: -c: line 0: `echo C:\Users\Aris\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Aris\bin;C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Common Files\Autodesk Shared;C:\Program Files\PuTTY;C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe;C:\Program Files\dotnet;C:\Program Files (x86)\VisioForge\VisioForge .Net SDKs Base Redist x86;C:\Program Files\VisioForge\VisioForge .Net SDKs Base Redist x64;C:\Program Files (x86)\VisioForge\VisioForge .Net SDKs FFMPEG EXE x86 Redist;C:\Program Files (x86)\VisioForge\VisioForge .Net SDKs LAV Redist x86;C:\Program Files\Pandoc;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\dotnet;C:\Users\Aris\AppData\Local\Microsoft\WindowsApps;C:\Users\Aris\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Aris\MiKTeX\miktex\bin\x64;C:\Users\Aris\.dotnet\tools;C:\Users\Aris\bin\pmtk;C:\Users\Aris\AppData\Roaming\npm;C:\Neovim\bin;C:\Users\Aris\bin\mingw64\bin;C:\Users\Aris\bin\netcoredbg;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl'
mingw32-make: *** [pathtest.mk:2: all] Error 1
the all
target has tab identation and i have tried the file in both unix and dos line endings. I don't know what is happening. I am under a git for windows environment and I
am using the mingw make. I am trying to do this test since I am trying to compile some GNU code on my windows machine.
CodePudding user response:
make
expands the $PATH
and lets your shell run the echo ...
line. But ;
and (
are special characters in the shell that cause the errors.
If you are sure there are no double quotes in the $PATH, you can use
echo "$(PATH)"
or similarly with single quotes.