Using Nmake from GNU-make
Hello list. Now I have the need to use an already quite large Makefile written for Microsoft's 'NMake', from within GNU-make 4.390. Like: gnss_libf2c.lib: cd libf2c ; nmake.exe -nologo -f Makefile.VC all cp libf2c/vcfc2.lib $@ but Nmake errors with: Microsoft (R) Program Maintenance Utility Version 14.26.28806.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1065: invalid option '-' Stop. Adding a '--debug' gives no clues either. Rewriting to: SHELL = cmd.exe: gnss_libf2c.lib: cd libf2c & nmake.exe -nologo -f Makefile.VC all cp libf2c/vcfc2.lib $@ gives the same error. I use Cygwin as my shell normally, but it doesn't look like a SHELL issue to me. From the cmd-line, Nmake has no problem; hence I suspect some issue with GNU-make. And using ProcessMonitor, I see no problem with the cmd-line in CreateProcessA() either. What could I do? -- --gv
Re: Using Nmake from GNU-make
Hi Gisle, I seem to remember DOS having different command-line parsing semantics. Maybe quoting the parameters differently would help? Something like the following. gnss_libf2c.lib: cd libf2c ; nmake.exe "-nologo -f Makefile.VC all" cp libf2c/vcfc2.lib $@ If that doesn't work, one of the Sysinternals tools like the process monitor might help. https://docs.microsoft.com/en-us/sysinternals/downloads/procmon Good luck, Daniel On Wed, 24 Jun 2020, Gisle Vanem wrote: Hello list. Now I have the need to use an already quite large Makefile written for Microsoft's 'NMake', from within GNU-make 4.390. Like: gnss_libf2c.lib: cd libf2c ; nmake.exe -nologo -f Makefile.VC all cp libf2c/vcfc2.lib $@ but Nmake errors with: Microsoft (R) Program Maintenance Utility Version 14.26.28806.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1065: invalid option '-' Stop. Adding a '--debug' gives no clues either. Rewriting to: SHELL = cmd.exe: gnss_libf2c.lib: cd libf2c & nmake.exe -nologo -f Makefile.VC all cp libf2c/vcfc2.lib $@ gives the same error. I use Cygwin as my shell normally, but it doesn't look like a SHELL issue to me. From the cmd-line, Nmake has no problem; hence I suspect some issue with GNU-make. And using ProcessMonitor, I see no problem with the cmd-line in CreateProcessA() either. What could I do? -- --gv
Re: Using Nmake from GNU-make
> From: Gisle Vanem > Date: Wed, 24 Jun 2020 18:05:12 +0200 > > gnss_libf2c.lib: >cd libf2c ; nmake.exe -nologo -f Makefile.VC all >cp libf2c/vcfc2.lib $@ > > but Nmake errors with: >Microsoft (R) Program Maintenance Utility Version 14.26.28806.0 >Copyright (C) Microsoft Corporation. All rights reserved. > >NMAKE : fatal error U1065: invalid option '-' >Stop. Does this happen even if you remove the "cd libf2c" part? That is, are you saying that any invocation of NMake from a MinGW-built GNU Make causes this problem? > Rewriting to: > > SHELL = cmd.exe: > gnss_libf2c.lib: >cd libf2c & nmake.exe -nologo -f Makefile.VC all >cp libf2c/vcfc2.lib $@ > > gives the same error. What happens if you use redirection, or in some other way force GNU Make to invoke NMake via a batch file?
Re: Using Nmake from GNU-make
> Date: Wed, 24 Jun 2020 19:27:21 +0300 > From: Eli Zaretskii > Cc: bug-make@gnu.org > > >NMAKE : fatal error U1065: invalid option '-' > >Stop. > > Does this happen even if you remove the "cd libf2c" part? That is, > are you saying that any invocation of NMake from a MinGW-built GNU > Make causes this problem? > > > Rewriting to: > > > > SHELL = cmd.exe: > > gnss_libf2c.lib: > >cd libf2c & nmake.exe -nologo -f Makefile.VC all > >cp libf2c/vcfc2.lib $@ > > > > gives the same error. > > What happens if you use redirection, or in some other way force GNU > Make to invoke NMake via a batch file? And one more idea: did you try to use '/' as the NMake option character instead of '-' ?
Re: Using Nmake from GNU-make
Eli Zaretskii wrote: gnss_libf2c.lib: cd libf2c ; nmake.exe -nologo -f Makefile.VC all cp libf2c/vcfc2.lib $@ but Nmake errors with: Microsoft (R) Program Maintenance Utility Version 14.26.28806.0 Copyright (C) Microsoft Corporation. All rights reserved. NMAKE : fatal error U1065: invalid option '-' Stop. Does this happen even if you remove the "cd libf2c" part? That is, are you saying that any invocation of NMake from a MinGW-built GNU Make causes this problem? The 'cd' doesn't matter. And BTW the GNU-make is built using MSVC (by myself). But I discovered that maybe the 'MAKEFLAGS' picked up by NMake is to blame. Since: make -f GNUmakefile FOO_BAR=whatever triggers the same previous error. But a: make -f GNUmakefile works fine!? There are some details on MAKEFLAGS here: https://docs.microsoft.com/en-us/cpp/build/reference/makefile-preprocessing-directives?view=vs-2019 What happens if you use redirection, or in some other way force GNU Make to invoke NMake via a batch file? Probably worth a try. > And one more idea: did you try to use '/' as the NMake option > character instead of '-' ? No difference. All (?)/most MS tools handle both '/' and '-'. -- --gv