I'm afraid you're discovering the horribleness of the windows CreateProcess system call. Rather than taking an already-split array of tokens it receives a command string and tokenises it.
When bash shell scripts are in the mix the whole problem of quoting things starts to get very complicated because CreateProcess is doing things and then bash is doing things. There's also the problem that whatever library is pretending to emulate execve() or posix_spawn() is going to stick parameters together for CreateProcess in some way that it thinks is going to get the correct result. You're basically finding out how cross platform UNIX/Windows makefiles are not easy to write. Good luck Tim On Tue, 16 May 2023 at 13:27, <tom...@posteo.net> wrote: > Hello list > > Given this directory structure > > $ tree . > . > |-- D > | |-- f1.png > | `-- f2.png > |-- Makefile > `-- img.png > > 1 directory, 4 files > > and this makefile > > $ cat Makefile > PNGS := $(shell find D -name '*.png' -type f) > > all : tellpng > > .PHONY : tellpng > tellpng : > echo pngs: $(PNGS) > > running make give this output > > $ make > echo pngs: > pngs: > > I was hoping to see the two png files in the D directory. If I change > to > > PNGS := $(shell find D -name "*.png" -type f) > > (using double quotes) the two png files in the D directory are found. > > Running make with the -d option I see the following differences of the > CreateProcess call using single quotes, no quotes and double quotes > around the -name argument (*.png), (editing the makefile). > > With single quotes: > CreateProcess(C:\progs\Git\usr\bin\find.exe,find D -name *.png -type > f,...) > > With no quotes: > CreateProcess(C:\progs\Git\usr\bin\sh.exe,C:/progs/Git/usr/bin/sh.exe -c > "find D -name *.png -type f",...) > > With double quotes: > CreateProcess(C:\progs\Git\usr\bin\sh.exe,C:/progs/Git/usr/bin/sh.exe -c > "find D -name \"*.png\" -type f",...) > > In the first example (with single quotes), it looks as if find is > called directly, and not shell? > > Should I learn from this that its better to use double quotes in a > $(shell) call like this, or is there something strange going on? > > The make run here is the ezwinports make, > > $ make --version > GNU Make 4.3 > Built for Windows32 > Copyright (C) 1988-2020 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > <http://gnu.org/licenses/gpl.html> > This is free software: you are free to change and redistribute it. > There is NO WARRANTY, to the extent permitted by law. > > What do you think? > > -- > Tomas > >