Re: Solution solicited
Posted in 1996
This is a multi-part message in MIME format. --------------3578FA4F7A2DDD31973C2E6 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Jamini Kant wrote: > > I have a problem in writing a shell program . Any suggestion/solution > is most welcome. > > I have a make file like > ------------------------- > > #LOADLIBS This contains the list of libraries > LOADLIB := /a/b/lib1 a/b/lib2 \\ > /a/c/lib3 \\ > /a/d/lib4 > > #INCDIR This had a list of all INCDIR files in it. > INCDIR := x/y/incdir1 /x/a/incdir2 \\ > /y/d/incdir3 \\ > /z/g/incdir4 > > #USES is the dependent etc ..... > --------------------------------- > The following is the portion of the shell script > which gives the listing of all INCDIRs. But the prob > is it does not list the listing in the next line. > For example in the above example for INCDIR > it prints only "x/y/incdir1" and "/x/a/incdir2" > but ignores to print other INCDIRs in the next line. > > echo $line > echo 'LIBRARY USED LIBRARY LOADED INCDIRS' > echo $line > > #for INCDIRS > for list in `grep INCDIRS Makefile | grep -v '#' | cut -d= -f2 |grep " \\"` > do > echo " $list" > done > > echo > echo 'C++ FILES ' > echo $smallline > ls -CF *.C > echo > echo 'C FILES ' > echo $smallline > ls -CF *.c > echo > echo 'LOCAL HEADER FILES ' > echo $smallline > ls -CF *.h > cd $currentdir > echo > echo > #echo $double_line > fi > > I know what is the problem. But what I need is solution. > There are hundreds of Makefiles and we desperately need > a script to list all these. > > Thanx in advance. > > Jaminikant --------------3578FA4F7A2DDD31973C2E6 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="incdir" Hi, I don't know if I found the very best solution. But here it is. Bye Stefan. stefan@www.weideneder.de ----------------- cut here ----------------- : # # A bourne shell script. # awk print all lines starting with INCDIRS until the first line # without a backslash. "tr" replaces any = or \\ char with a space. # "sed" deletes the word INCDIRS. # getinclude(){ awk '/^INCDIRS/,/[^\\\\]$/{ print $0 }' $* | tr '=\\\\' ' ' | \\ sed "s/INCDIRS//" } for i in `getinclude Makefile` do echo $i done --------------3578FA4F7A2DDD31973C2E6--