[comp.sys.sgi] Using 'csh' in Makefiles

peterk@foetus.syd.sgi.oz.au (Peter Kerney) (10/04/90)

Hi there everyone,

This probably should go to comp.unix but anyway.

Question: How do you use the C-shell in a Makefile
	'make' will pass this to the shell 1 (one) line at a time
	and it will therefore give an error.
	If you use the continuation on the end of the line, 'make'
	will pass the line to the shelll, but the foreach statement
	is all on one line and will therefore not work either.

Example:
------------------------------ Makefile ------------------------------
test:
        foreach i (1 2)
                echo "===== $i ====="
        end
----------------------------------------------------------------------

We need to get the preceding Makefile working so as we can do more complex
things.

I have tried '\', '\n\' and all sorts of things on the end of the line
but no luck yet.

Any help would be gratefully accepted.

Taa, PeterK


-- 
Peter Kerney. Silicon Graphics, Sydney, Australia. (peterk@syd.sgi.oz.au)

If you can't have an IRIS at home,
have the next best thing, an Amiga !!!

karron@MCIRPS2.MED.NYU.EDU (10/11/90)

make takes each action line as a separate shell exec. The way
around that is to use a backslash (\) to escape each newline. Then
make will run the entire bunch of lines as one line.
To change the default shell command, equate SHELL=/bin/csh in the
makefile.

You might want to look at pmake, which is much better at this than
make. Do a "man pmake" for more details.

+-----------------------------------------------------------------------------+
| karron@nyu.edu                          Dan Karron                          |
| . . . . . . . . . . . . . .             New York University Medical Center  |
| 560 First Avenue           \ \    Pager <1> (212) 397 9330                  |
| New York, New York 10016    \**\        <2> 10896   <3> <your-number-here>  |
| (212) 340 5210               \**\__________________________________________ |
| Please Note :Soon to move to dan@karron.med.nyu.edu 128.122.135.3  (Mid Oct)|
+-----------------------------------------------------------------------------+

peterk@foetus.syd.sgi.oz.au (Peter Kerney) (10/15/90)

From article <9010102030.AA23475@mcirps2.med.nyu.edu>, by karron@MCIRPS2.MED.NYU.EDU:
> 
> make takes each action line as a separate shell exec. The way
> around that is to use a backslash (\) to escape each newline. Then
> make will run the entire bunch of lines as one line.
> To change the default shell command, equate SHELL=/bin/csh in the
> makefile.
> 
This will not work. I have tried it.
The problem is that 'csh' relies on the fact that all the constructs are
on separate lines.

eg:   foreach i (*)
          echo $i
      end

This will not work in a Makefile, even with '\' at the end of the line.

-- 
Peter Kerney. Silicon Graphics, Sydney, Australia. (peterk@syd.sgi.oz.au)

If you can't have an IRIS at home,
have the next best thing, an Amiga !!!