Hey Greg, On 08-09-2020 22:07, Thorsten Glaser wrote:> Greg Thelen dixit: > >> This doesn't work with older versions of make. ?make 4.2.1 seems common >> now and does not support $(shell command). >> >> $ cat Makefile >> $(info take1: $(shell command -v ls)) >> $(info take2: $(shell bash -c 'type -p ls')) >> >> all: >> @true >> >> $ make-3.81/make >> make: command: Command not found > > Eh, what?well command can be either a shell built-in or an external program, right? but both are posix required [0]? So that's a bit odd, also, wouldn't shell sh do a double shell? Shell inseption? I'm not super familiar with make though, especially ancient ones :p [0] https://www.unix.com/man-page/posix/1p/command> > ? checks with gmake 3.81? indeed. > > But no, this isn?t correct. You just do this instead: > > $(info take1: $(shell sh -c 'command -v ls')) > > This works and avoids GNU bash just the same. (I ran this > on a system with no GNU bash installed.) > > bye, > //mirabilos, shell maintainer/developer >
Olliver Schinagl dixit:> well command can be either a shell built-in or an external program, right? butApparently it cannot, at least not in some GNU make versions.> So that's a bit odd, also, wouldn't shell sh do a double shell? ShellApparently not, otherwise it'd work without. bye, //mirabilos -- ?Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund, mksh auf jedem System zu installieren.? -- XTaran auf der OpenRheinRuhr, ganz begeistert (EN: ?[?]uhr.gz is a reason to install mksh on every system.?)
On Wed, 2020-09-09 at 14:41 +0000, Thorsten Glaser wrote:> Olliver Schinagl dixit: > > > well command can be either a shell built-in or an external program, right? but > > Apparently it cannot, at least not in some GNU make versions.GNU make has an optimisation to run some commands without using the shell, and its rules for recognising whether the shell is needed can be buggy. (This optimisation also has the interesting result that environment variables with unusual characters in them may or may not propragate to a command depending on whether make uses a shell.) Ben.> > So that's a bit odd, also, wouldn't shell sh do a double shell? Shell > > Apparently not, otherwise it'd work without. > > bye, > //mirabilos-- Ben Hutchings Time is nature's way of making sure that everything doesn't happen at once. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: <https://lists.zytor.com/archives/klibc/attachments/20200909/0ce3a0ec/attachment.sig>