[Omake] Changing variables for a target
Jason Hickey
jyh at cs.caltech.edu
Fri Sep 15 00:56:32 PDT 2006
David Kågedal wrote:
> 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.
...
> 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)
This should work... Here is an example that I tried.
% touch a.c b.c c.c
<OMakefile>
section
CFLAGS += -O6
b.o:
CProgram(prog, a b c)
.DEFAULT: prog$(EXE)
</OMakefile>
And here is an example run:
% omake
*** omake: reading OMakefiles
*** omake: finished reading OMakefiles (0.0 sec)
- scan . scan-c-c.c
+ gcc -I. -MM c.c
- build . c.o
+ gcc -I. -c -o c.o c.c
- scan . scan-c-b.c
+ gcc -O6 -I. -MM b.c
- build . b.o
+ gcc -O6 -I. -c -o b.o b.c
- scan . scan-c-a.c
+ gcc -I. -MM a.c
- build . a.o
+ gcc -I. -c -o a.o a.c
- build . prog
+ gcc -o prog a.o b.o c.o
...
*** omake: done (0.3 sec, 3/3 scans, 4/4 rules, 16/109 digests)
I'm not sure what is happening in your case, could it be that you are
redefining the implicit rule somewhere? Also, note that implicit rules
outside the current directory may not work as you expect--rules like this:
boo/%.o: boo/%.c
....
In any case, can you try the above OMakefile to see if it works? Thanks:)
Jason
--
Jason Hickey http://www.cs.caltech.edu/~jyh
Caltech Computer Science Tel: 626-395-6568 FAX: 626-792-4257
More information about the Omake
mailing list