Article View: gnu.utils.bug
Article #568Problem passing cmd line args to shell scripts in GNU Make 3.57?
From: Skip Montanaro
Date: Thu, 30 Nov 1989 15:06
Date: Thu, 30 Nov 1989 15:06
59 lines
2133 bytes
2133 bytes
The following short makefile demonstrates a feature/bug in Make 3.57. The
shell script, mic, does not have a #!/bin/sh first line. When executed by
Make 3.57, it does not receive command line args other than $0. However,
mic2 does. This problem arises with the move-if-change shell script that is
used in building GNU CC. (I use it for other things. The version in the GCC
stuff may have acquired a #!/bin/sh line by now.) SunPro Make does not
exhibit this behavior, as the sample output following the makefile shows.
----------cut here----------
tst : mic mic2
./mic foo bar
./mic2 baz bip
mic : FRC
@echo 'echo Executing $$0' > mic
@echo 'echo Arg 1 == $$1' >> mic
@echo 'echo Arg 2 == $$2' >> mic
@chmod +x mic
mic2 : FRC
@echo '#!/bin/sh' > mic2
@echo 'echo Executing $$0' >> mic2
@echo 'echo Arg 1 == $$1' >> mic2
@echo 'echo Arg 2 == $$2' >> mic2
@chmod +x mic2
FRC :
----------cut here----------
Sample output:
% /bin/make
./mic foo bar
Executing ./mic
Arg 1 == foo
Arg 2 == bar
./mic2 baz bip
Executing ./mic2
Arg 1 == baz
Arg 2 == bip
% gmake -v
GNU Make version 3.57, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 1989 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
./mic foo bar
Executing ./mic
Arg 1 ==
Arg 2 ==
./mic2 baz bip
Executing ./mic2
Arg 1 == baz
Arg 2 == bip
Skip (montanaro@crdgw1.ge.com)
Technical Details
Message-ID:
<8911301506.AA00916@sprite.crd.Ge.Com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!sprite.crd.ge.com!montnaroShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!sprite.crd.ge.com!montnaro From: montnaro@sprite.crd.ge.com (Skip Montanaro) Newsgroups: gnu.utils.bug Subject: Problem passing cmd line args to shell scripts in GNU Make 3.57? Message-ID: <8911301506.AA00916@sprite.crd.Ge.Com> Date: 30 Nov 89 15:06:49 GMT Sender: daemon@tut.cis.ohio-state.edu Reply-To: <montanaro@crdgw1.ge.com> (Skip Montanaro) Distribution: gnu Organization: GNUs Not Usenet Lines: 59