[Omake] Adding rules to another directory

David Kågedal davidk at lysator.liu.se
Fri Jun 8 09:49:22 PDT 2007


For different reasons (I want to create a build system that looks like
the old system), I need to be able to, from one subdirectory, add a
target in another subdirectory.  When I wrote my build system for
0.9.6 or so, I managed to do this, but it doesn't seem to work with
0.9.8.

What I did was that I put this in the top-level OMakefile:

.SUBDIRS: $(BUILD_DIR)
    .SUBDIRS: bin
        # This function was actually in an imported file
        CopyProg(prog) =
            progfile = $(BUILD_DIR)/bin/$(prog)$(EXE)
            $(progfile) : $(BUILD_DIR)/obj/binaries/$(prog)/$(prog)$(EXE)
                $(CP) $< $@
            all-programs : $(progfile)
            return $(progfile)
        export CopyProg
    .SUBDIRS: obj
        .SUBDIRS: binaries
            section
                vmount($(ROOT)/src/core, .)
                .SUBDIRS: foobar

Then, in src/core/foobar/OMakefile, I call the function

CopyProg(foo)

This used to add a rule to build $(BUILD_DIR)/bin/foo by copying
$(BUILD_DIR)/obj/binaries/foo

But now, the rule created by the CopyProg function seems to be
completely lost.  I tried running omake with -print-rules to see if
it's there, but i can't find it.

I known that this isn't exactly the normal way to do things in omake,
but I think it would be nice if it was possible to do.

-- 
David Kågedal



More information about the Omake mailing list