%% "Waldron, Terry" <[EMAIL PROTECTED]> writes:

  wt> Not sure if this is correct behavior but the commented code just
  wt> before the done statement in this Makefile segment below causes an
  wt> unexpected end of line error.

It is correct behavior.

  wt> install-final:
  wt>         -@temp=/tmp/$(FILE) ;\
  wt>         hosts="$(HOSTS)" ;\
  wt>         for i in $$hosts ;\
  wt>         do \
  wt>                 host="$$i" ;\
  wt>                 if [ "$$host" = "moose" ]; then \
  wt>                         rcp="su bin -c \"rcp" ;\
  wt>                         close=\" ;\
  wt>                 else \
  wt>                         rcp=rcp ; close="" ;\
  wt>                 fi ;\
  wt>                 cat header > $$temp 2>/dev/null ;\
  wt>                 cat $$host >> $$temp 2>/dev/null ;\
  wt>                 cat $(FILE) >> $$temp 2>/dev/null ;\
  wt>                 if [ $$host = "mink" -o $$host = "moose" ]; then \
  wt>                         ypcat -k $(FILE) >> $$temp ;\
  wt>                 else \
  wt>                         echo +$(FILE) >> $$temp ;\
  wt>                 fi ;\
  wt>                 echo $$rcp $$temp $$host:$(DESTDIR)/$(FILE) $$close | sh -x
  wt> ;\
  wt> #               chmod $(MODE) $(DESTDIR)/$(FILE) ;\
  wt>         done

You can't comment out things in the middle of scripts like this.

That is not a make comment, because make doesn't process command script
lines in any way except for expanding make variables.  That includes not
doing any comment processing (obviously, since in order to do this
properly make would have to understand full shell syntax to know when
the comment char was quoted or whatever).

Since the previous line ends in a backslash, the next line is appended
to it and make treats the whole thing as part of the single command
line.

And, if you write all that out without any backslashes you'll see that
it resolves to this:

  <...> fi ;  echo <...> | sh -x ; # chmod <...>; done

When the shell sees that comment character, it stops processing, so your
loop is missing its "done" (it's commented out).

You're not allowed to put comments in continued lines like this, it
almost never does what you want.

One option would be to prefix the command you want to avoid with the
shell's no-op command, ":".  Change this:

                  fi ;\
                  echo $$rcp $$temp $$host:$(DESTDIR)/$(FILE) $$close | sh -x
  ;\
  #               chmod $(MODE) $(DESTDIR)/$(FILE) ;\
          done

to this:
                fi ;\
                echo $$rcp $$temp $$host:$(DESTDIR)/$(FILE) $$close | sh -x
;\
:               chmod $(MODE) $(DESTDIR)/$(FILE) ;\
        done

See the shell man page for more details.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to