Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shell command in dmake adds '/S'

I'm working on compiling Xindy with a MinGW system. dmake always dies with an error, and I've narrowed it down to a couple of lines in the Makefile. Try running dmake on this:

SHELL = /bin/sh
some-target:
    target=`echo info-recursive | sed s/-recursive//`;

If you are using the regular Windows CMD instead of a MinGW shell, you have to change the location for the SHELL variable to point to something like "C:/MinGW/msys/1.0/sh.exe". Anyway, the above fails with:

CreateProcess failed (2).
dmake: Error executing 'bin/sh /S /c "target=`echo info-recursive | sed s/-recursive//`;"': No such file or directory
dmake: Error code -1, while making 'some-target'

Sed and sh are installed and they work fine. When I try and run the given command as output by the error message by itself, I get this:

$ /bin/sh /S /c "target=`echo info-recursive | sed s/-recursive//`;"
/bin/sh: /S: No such file or directory

So it seems that dmake (or something) is adding the '/S /c', to the shell argument, and bash thinks it's a file name and then fails when it can't find it.

Does anyone have experience with this or know how I can fix this?

like image 942
Nate Glenn Avatar asked Sep 14 '26 12:09

Nate Glenn


1 Answers

Brief examination of the dmake source code suggests that the problem is that $(SHELL) is being set too late and is still empty at startup time (macros.mk, line 37):

11  .IF $(SHELL) == $(NULL)
...
15     SHELL *:= $(COMSPEC)
...
...
35  .IF $(SHELL) == $(COMSPEC)
36  .IF $(COMSPEC:lf) == cmd.exe
37     SHELLFLAGS       *:= $(SWITCHAR)S $(SWITCHAR)c

You may be able to work around this by adding SHELL="C:/MinGW/msys/1.0/sh.exe" to your dmake command line invocation.

(I haven't used dmake in many years and so may be mistaken here, but I will be impressed if you can get what looks like an autoconfiscated makefile to work with dmake, which IIRC has a somewhat different flavour. It might be easier to find a GNU make or similar.)

like image 176
John Marshall Avatar answered Sep 17 '26 06:09

John Marshall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!