On Mon, 2021-04-26 at 06:25 +0800, Dan Jacobson wrote: > $ make B > :; Z > > /bin/sh: line 1: Z: command not found > make: *** [Makefile:2: B] Error 127 > > $ make C > : > Z > > make: Z: No such file or directory > make: *** [Makefile:5: C] Error 127 > > So we see that "the effect is the same" is inaccurate.
This has nothing to do with using a semicolon to put the command on the same line as the target. You'd get the same effect if you DIDN'T use a semicolon and put the same command on the line after the target: B: :; Z C: : Z The issue is that in the first example the script is "complex" so make uses its slow path solution, which is to run /bin/sh -c ":; Z". Thus you get an error from the shell. In the second example, the "Z" command is by itself so it's "simple" so make uses its fast path solution, which is to fork and exec "Z" directly without a shell. Thus you get an error from make.