Newsgroups: comp.unix.questions Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!fitz From: fitz@mml0.meche.rpi.edu (Brian Fitzgerald) Subject: Re: Here docs in makefile Message-ID: Nntp-Posting-Host: mml0.meche.rpi.edu Organization: Rensselaer Polytechnic Institute, Troy NY References: <1991May9.150409.28352@cid.aes.doe.CA> Distribution: na Date: 9 May 91 18:15:30 GMT Lines: 52 afsipmh@cidsv01.cid.aes.doe.CA writes: >How can I use a here document within a makefile? >Is this possible? I posted the same question in January. In <}7W^DZ_@rpi.edu>, you write in comp.unix.shell: >This shell script with an ed script splits my file into two new files: > >ed foo <1,/^ *References$/-1w foo.body >/^ *References$/+1,$w foo.ref >q >E_O_F > >This makefile does the same thing for me: > >EDSCRIPT= 1,/^ *References$$/-1w $(DOC).body@\ >/^ *References$$/+1,$$w $(DOC).ref@\ >q > >ed: $(DOC) > echo '$(EDSCRIPT)' | tr @ '\012' | ed $(DOC) > >My question: Can a makefile rule contain a "here" document like my >first example? Please post tested solutions that use the standard >"ed", "sh", and "make". Thanks! By the way, in my original posting, I meant a "here" document embedded within the Makefile itself. I got a nice reply from a certain net guru (who spells his name with four rows of the keyboard!) who said: -- There isn't a way that is portable across all versions of make, no. The problem is that some makes take the backslash-newline and delete both. This is why /bin/sh scripts in Makefiles have all those semicolons, as in: @for I in $(LIST) ; do \ echo Creating $$I... ; \ sed -e s/foo/bar/