[Omake] eager evaluation in C.om

David Kågedal davidk at lysator.liu.se
Tue Sep 12 02:37:43 PDT 2006


Can someone explain why the rule in CProgram uses $,(OFILES), while
the build rule in StaticCLibrary used $(OFILES)?

I'm not sure where to look in the documentation, so I'm trying to make
a half-informed guess here, hoping that someone will correct me.

When writing a rule

    X: Y
        R

The expressions X and Y are evaluated strictly, but R is handled
lazily, so that you can redefine CFLAGS etc.

But then I think that CProgram is right, and StaticCLibrary should
also use $,(OFILES). Correct?

This is what it looks like, with some parts hidden:

StaticCLibrary(name, files) =
    OFILES = $(addsuffix $(EXT_OBJ), $(files))
    NORMALLIB = $(file $(name)$(EXT_LIB))

    $(NORMALLIB): $(OFILES)
        rm -f $@
        $(AR $@) $(OFILES)
        $(RANLIB) $@

CProgram(name, files) =
   OFILES = $(addsuffix $(EXT_OBJ), $(files))
   NAME   = $(file $(name)$(EXE))

   $(NAME): $(OFILES)
        $(CC) $(CFLAGS) -o $@ $,(OFILES) $(LIBS) $(LDFLAGS)

-- 
David Kågedal



More information about the Omake mailing list