I am having this problem with the makefile...
---------------
SHELL= /bin/csh
<lot of stuff here deleted>
clean:
foreach file (${SOURCES})\
if (-w $$file) then\
ci $$file\
else\
rm -f $$file\
endif\
end
Now, the problem is, foreach requires that the commands enclosed by it
be on a separate line, whereas makefile doesn't allow for a command to
span multiple lines..
I know this can be done easily using sh. But due to other
considerations I am forced to use csh. Can anyone help me with this
makefile and make it work ?
Thanks in advance,
Arun
--
ARUN SHARMA
ar...@cs.iastate.edu
: Now, the problem is, foreach requires that the commands enclosed by it
: be on a separate line, whereas makefile doesn't allow for a command to
: span multiple lines..
: I know this can be done easily using sh. But due to other
: considerations I am forced to use csh. Can anyone help me with this
: makefile and make it work ?
Error, Make is not csh, it has its own command interpretter
--
Matus Uhlar,
Computer Centre of Technical University in Kosice, Slovakia
: Now, the problem is, foreach requires that the commands enclosed by it
: be on a separate line, whereas makefile doesn't allow for a command to
: span multiple lines..
: I know this can be done easily using sh. But due to other
: considerations I am forced to use csh. Can anyone help me with this
: makefile and make it work ?
Try GNU-make, I think it supports the "\" notation.
Unless you have a huge makefile with CSH commands (which is already there),
there is no reson to run csh from makefiles.
If you can't obtain a GNU-make (gmake) and you already have a huge makefile
with csh commands (very unlikely), try to run (in the same line) the
following code (ugly):
echo 'foreach ... (...) ; if (....) then ; .... ; else ; ... ; endif ; ... ; end ; ' | tr ";" "\012" | $(SHELL)
OR (a little bit less ugly, but slower):
echo "foreach...." > tmpfile
echo "if ...." >> tmpfile
....
...
echo "end" >> tmpfile
$(SHELL) tmpfile
rm tmpfile
Again, try to use "sh" not "csh"
hope this helps
Michael
Actually, Make uses Bourne shell by default. However, many versions of
Make allow you to setup a SHELL macro and *that* shell will be used for
executions.
SHELL = /bin/csh
Give it a try.
Another solution is to write a csh script and call it from your Makefile.
target : $(DEPENDENCIES)
csh my.shell.script $(param1) $(param2) $(param3)
If you need to work with the results of the shell script, use the backtick
syntax, many makes now take it:
target: $(DEPENDENCIES)
$(ANSWER) = `csh my.shell.script $(param1)`
--
David Weintraub dav...@cnj.digex.net
Clueless on the Internet? Send $1.00 for clues to:
Internet Clues, 1988 Rhodes Drive, Port Reading NJ 07814