bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue using "command" shell builtin in make rules.


From: Nick Bowler
Subject: Issue using "command" shell builtin in make rules.
Date: Tue, 7 Nov 2017 13:43:12 -0500

Hi,

GNU make (version 4.2.1) appears to have some magic to bypass shell
invocations when running commands.  I guess this usually helps with
performance but I noticed a failure when using the 'command' shell
builtin.  For example:

  % cat >Makefile <<'EOF'
  foo:
        command -v ls
  .PHONY: foo
EOF

  % gmake foo
  command -v ls
  gmake: command: Command not found
  gmake: *** [Makefile:2: foo] Error 127

Making some trivial change to the rule, e.g., using something like

  foo:
        command -v ls </dev/null

enables the expected execution of the builtin using the real shell.

Is this behaviour intended?  I noticed the manual says "make may take
shortcuts that do not affect the results" but in this instance a change
in results is definitely observed.

Cheers,
  Nick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]