[comp.unix.programmer] Makefile and csh...?

isl@fmi.uunet.uu.net (Ivan S. Leung) (05/30/91)

In article <1991May21.210000.15284@shearson.com> you write:
>The simple makefile looks like this:
>
>SHELL = /bin/csh
>CFILES = test.c
>
>dependencies :
>	cc -M $(CFILES) > deps
>
>When run, the computer generates:
>143 kaplanr - make
>cc -M test.c > deps
>*** Error code 1
>make: Fatal error: Command failed for target `dependencies'

You may have "set noclobber" in your .cshrc or .login files.
change the command to "cc -M $(CFILES) >! deps" should fix it.
It will be nice if we can do "SHELL=/bin/csh -c" but we can't.
Could somebody suggest a better solution?
-- 
Ivan Leung      fmi!isl@uunet.uu.net

weimer@garden.ssd.kodak.com (Gary Weimer (253-7796)) (05/31/91)

In article <1991May21.210000.15284@shearson.com>, kaplanr@shearson.com
(Roger Kaplan) writes:
|> The simple makefile looks like this:
|> ----
|> SHELL = /bin/csh
|> CFILES = test.c
|> dependencies :
|> 	cc -M $(CFILES) > deps
|> ----
|> When run, the computer generates:
|> ----
|> 
|> 143 kaplanr - make
|> cc -M test.c > deps
|> *** Error code 1
|> make: Fatal error: Command failed for target `dependencies'
|> ----

If noclobber (sp?) is set and deps exists, the shell will not allow you
to overwrite it. Try changing '>' to '>!' to force an overwrite.

weimer@ssd.kodak.com ( Gary Weimer )

rsalz@bbn.com (Rich Salz) (06/03/91)

In <1991May21.210000.15284@shearson.com> kaplanr@shearson.com (Roger Kaplan) writes:
>The simple makefile looks like this:
>SHELL = /bin/csh
You will live to regret this.  Put
	SHELL=/bin/sh
in your Makefiles and write your actions accordingly -- your stuff will be
more portable (sort of), and you will be much less frustrated by the Cshell's
idiosyncratic behavior.

As to the specific problem:
>	cc -M $(CFILES) > deps
causes the Cshell to not overwrite a file.  Ignore advice telling you to
put "unset noclobber" in everyone's .cshrc file.  Put this line before the
cc line instead:
	rm -f deps
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.

davis@pacific.mps.ohio-state.edu ("John E. Davis") (06/03/91)

In article <3605@litchi.bbn.com> rsalz@bbn.com (Rich Salz) writes:
   In <1991May21.210000.15284@shearson.com> kaplanr@shearson.com (Roger Kaplan) writes:{
   As to the specific problem:
   >	cc -M $(CFILES) > deps
   causes the Cshell to not overwrite a file.  Ignore advice telling you to
   put "unset noclobber" in everyone's .cshrc file.  Put this line before the
   cc line instead:
           rm -f deps


I missed the main thread here but what about just using `>!' to redirect
output?  It always ignores the value of noclobber.
--
John

  bitnet: davis@ohstpy
internet: davis@pacific.mps.ohio-state.edu