[Omake] sections & implicit rules

Aleksey Nogin nogin at metaprl.org
Sun Mar 25 12:07:34 PDT 2007


On 24.03.2007 22:18, Jonathan Roewen wrote:

> CProgram(kernel.elf, $(OBJS))
> 
> kernel.elf: kernel.lds libdummy.so
> 
> section
>  CC = $(LD)
>  CFLAGS = -nostdlib -T kernel.lds -export-dynamic
>  LIBS[] = $(LIBRARIES)/libm $(LIBRARIES)/libc ...
>  LDFLAGS = libdummy.so
>  kernel.elf:
> 
> However, omake uses gcc, and all my redefined options are being
> ignored. 

CProgram creates _explicit_ rules, using the _current_ values of CC,
CFLAGS, etc.

So you need something like

section
 CC = $(LD)
 CFLAGS = -nostdlib -T kernel.lds -export-dynamic
 LIBS[] = $(LIBRARIES)/libm $(LIBRARIES)/libc ...
 LDFLAGS = libdummy.so
 CProgram(kernel.elf, $(OBJS))
 kernel.elf: kernel.lds libdummy.so

Also note that if you did have an implicit rule for, say, %.elf, in your
original code, the rule will get instantiated when the _first_
"kernel.elf: ..." line (before the "section" block) is encountered.

> It's probably a bad design to do the above hack with CProgram
> though =P

Probably, although currently we do something very silimar for CXXProgram.

> In fact, the
> section that fails is identical to another OMakefile in another part
> of my project.
> 
> the problem:
> 
> section
>  OCAMLFLAGS += -nopervasives
>  pervasives.cmi:
> 
> which is in: <root>/minilib/OMakefile & <root>/kernel/stdlib/OMakefile

Do you have some other "...pervasives.cmi...: ..." explicit dependency
before this "section" block in the file that does not work?

Aleksey



More information about the Omake mailing list