[Omake] 2 questions about .SCANNER rules and a possible bug report

Nick z508617 at ftml.net
Mon Jan 8 20:03:16 PST 2007


Hello, it's me again.
I have confirmed by experimentation 2 things that are not explicitly
stated in section 7.6
of the documentation.
1) the output of the command in a .SCANNER rule is supposed to go to
stdout.
   Somehow it's captured from stdout and stored somewhere.
   Q: if I wanted to analyze that output how would I be able to extract
   it other than
      running the same command in my shell?

2) See the sed command in the snippet below?
   It was required because the scanner command returns the dependencies
   like so
   
   prog.o: ctrprog/yprog_eod/main.c 3rdparty/bstr/bstr.h \
          ctrprog/include/db_iface.h

   but I need a $(ROOTDIR)/$(PLATFORM)/ or similar prefix in front of
   prog.o .
   The snippet shown below works just fine but is expensive because it
   does fork/exec/exit for sed,
   i.e. doesn't use cheap osh builtins.
   Q: how could I rewrite the expensive sed transformation in osh and
   thereby gain efficiency?

--------------------------------------------
   i = 0
   len = $(length $(F2))
   while $(lt $i, $(len))
     left = $(nth $i, $(F4))
     right = $(nth $i, $(cfiles))
     $(left): $(right)
        $(create_dir $(nth $i, $(F2)))
        $(CC) -o $(left) -c $(CFLAGS) $(right)
     dir = $(nth $i, $(F2))
     .SCANNER: $(left) : $(right)
        $(CC) -MM $(CFLAGS) $(right) | sed -e "s@^@$(dir)@"

     i = $(add $i, 1)
---------------------------------

One final note: if the indentation of "i = $(add $i, 1) " matches the
indentation of "while" the program goes into unbounded recursion and
gobbles
up all available memory (>2GB on my machine).
Obviously such indentation is wrong but nevertheless I consider the
omake
behaviour in that case a bug. I use OMake 0.9.8 (release 2).
Thanks.
-- 
  Nick
  z508617 at ftml.net

-- 
http://www.fastmail.fm - And now for something completely different




More information about the Omake mailing list