[Omake] Changing variables for a target

David Kågedal davidk at lysator.liu.se
Thu Sep 14 23:58:00 PDT 2006


I'd like to use the standard implicit rule for compiling %.c to %.o,
but then for some targets, I'd like to set CFLAGS to a different
value.

I think what I want to do is to control the "instantiation" of the
implicit rule, but I'm not sure how it works.

Consider the rule for compiling C source:

%$(EXT_OBJ): %.c :scanner: scan-c-%.c
    $(CC) $(CFLAGS) $(PREFIXED_INCLUDES) -c -o $@ $<

In a file foo/OMakefile I want to compile a bunch of C files using
this implicit rule, but for one of them I'd like to update the CFLAGS
variable.

In GNU Make I can do it like this (see the section "Target-specific
Variable Values" in the GNU Make manual)

b.o : CFLAGS += -O2

prog : a.o b.o c.o
	gcc -o prog $+

In OMake, I figured I'd like to do something like this

section
    CFLAGS += -O2
    # instantiate the implicit rule
    b.o:

CProgram(prog, a b c)

But that doesn't seem to be the answer.  Are the implicit rules always
instantiated using the scope at the end of the current OMakefile, or
how does it work?

-- 
David Kågedal



More information about the Omake mailing list