[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gmake doesn't honor #! line
From: |
Karl Tomlinson |
Subject: |
Re: gmake doesn't honor #! line |
Date: |
Fri, 03 Nov 2000 15:50:29 +1300 |
Hans-Bernhard Broeker wrote:
> In what way would other make's (which of them?) "honor" a hashbang
> (#!)? I don't think I've ever seen anything like that with respect to
> Makefiles. The only thing that routinely has to honor hashbang would
> be the kernel itself, which uses it as a magic cookie to distinguish
> how to execute a script flagged 'chmod +x'. I.e. if you write a
> Makefile with first line '#! /usr/bin/make -f' and make it executable,
> the kernel and shell will execute it as expected if you ./Makefile.
>
> Not that that'd make much sense, though :-)
>
>From `man make' under IRIX 6.5:
Alternate Make
make understands a convention similar to the alternate interpreter
feature of exec(2) . If the first line of the makefile starts with a
#!alternate_make , then make will attempt to exec the alternate make
with
the same environment and arguments that make itself was invoked with.
Additional arguments may be supplied on the #! line - these are placed
ahead of all the command line arguments given to the original
invocation
of make . If a new makefile specification is given using the -f flag,
any
original -f options given on the command line are ignored. If the
alternate make cannot be found in the user's PATH or make finds that it
would be re-invoking itself, then make silently ignores the line and
continues to execute the remainder of the makefile. The -d flag will
display information as to whether the alternate make was successfully
invoked. As a special case to support compatibility with a makefile
used
as a shell script (with a "#!/bin/make -f"), a lone -f flag is ignored.
Not all `make's behave the same way. Perhaps making the file executable
is a good idea, but it would be a nice feature if any make would try to
run the make for which the Makefile was intended. I s'pose we can
call our makefiles GNUmakefile to encourage the user to run GNU make,
but this feels a little strange to me.