sung@hp-lsd.HP.COM (Ann Sung) (02/02/89)
I have recently experienced make behaviour which is, to my recollection, inconsistant with make on other Unix System V machines. Specifically, I have trouble relatively referencing files from the make'ing directory. A transcript of a session follows: $ cd /tmp/test $ cat Makefile test: pwd echo "test" > test.out pwd $ make pwd /tmp/test echo "test" > test.out pwd /tmp/test The file test.out is created in my home directory, rather than in /tmp/test as I expected. Is this proper? Is this consistant with various flavors of Unix? Is there an option to invoke or a substitution to perform which will force make to behave more to my intuition? Invoking make by (HOME=/tmp/test; make) seems to be a solution. I am on a 3B1, Version 3.51 foundation set, Version 3.50 development pkg. Responses to: John R Ruckstuhl, Jr Internet: "hp-lsd.hp.com!sphere!ruck"@hplabs.hp.com University of Florida UUCP: ...hplabs.hp.com!hp-lsd.hp.com!sphere!ruck
ditto@cbmvax.UUCP (Michael "Ford" Ditto) (02/06/89)
In article <8220001@hp-lsd.HP.COM> sung@hp-lsd.HP.COM (Ann Sung) writes: > $ make > pwd > /tmp/test > echo "test" > test.out > pwd > /tmp/test > >The file test.out is created in my home directory, rather than in /tmp/test >as I expected. Note that the line containing the "pwd" command is simple enough that make will directly exec() it without running a shell, while the "echo" line must be passed to the shell for interpretation. That points to your shell as the source of the problem, since the pwd commands executed correctly. I would guess that your $SHELL variable is set to /bin/ksh and you have a .kshrc file which changes your current directory. The problem can (and should) be fixed by setting SHELL to /bin/sh in the Makefile. You also probably want to consider whether your .kshrc's behavior is wrong. (The name .kshrc actually comes from $ENV; yours might be different.) (The same warning about make applies to users of csh with a cshrc file; I just assumed that this 3b1 user would be using ksh.) -- -=] Ford [=- "The number of Unix installations (In Real Life: Mike Ditto) has grown to 10, with more expected." ford@kenobi.cts.com - The Unix Programmer's Manual, ...!sdcsvax!crash!elgar!ford 2nd Edition, June, 1972. ditto@cbmvax.commodore.com