🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Skip Montanaro Thu, 30 Nov 1989 15:06
Problem passing cmd line args to shell scripts in GNU Make 3.57?
#568
Author: Skip Montanaro
Date: Thu, 30 Nov 1989 15:06
59 lines
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)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads