[Omake] gnu make to omake port, 2nd and final glitch
Nick
z508617 at ftml.net
Sun Jan 7 14:38:13 PST 2007
Hello again,
If omake developers can address the concerns in this email, then all my
problems will have
been solved.
As I mentioned previously I am porting a gnu make project to omake.
For the powers that be to approve this port there is one requirement to
fulfill -
ALL derived objects ought to be built relative to some env. variable
$(ROOTDIR) that
is passed in and we cannot control.
For instance if the sources were exported to us as READ ONLY via nfs,
then we can't
possibly write to /nfs/source_tree. But we can write to $(ROOTDIR) and
descendants.
The following toy OMakefile attempts to blindly mimick the gnu makefile
without trying to
make use of superior capabilities found in omake.
I get error
"filename pattern is a path:
../../derived/yprog_eod/x86_64-unknown-linux-gnu/%.o"
I am not at all opposed to abandon the gnu make model and move to a
better one. as long
as it meets the requirement stated above.
How would you create all derived objects with omake relative to some
arbitrary $(ROOTDIR)?
----------------------------------------------------------------------------
#
.PHONY: yprog ctrprog
ROOTDIR = ../../derived
static. =
PLATFORM = $(nth 0, $(shell ../build/config.guess))
mkdir -p $(ROOTDIR)/$(PLATFORM)
CC = cc
nonempty(l) =
value $(gt $(length $l), 0)
join(l1, l2) =
result[] =
while $(and $(nonempty $(l1)), $(nonempty $(l2)))
x = $(nth 0, $(l1))
y = $(nth 0, $(l2))
l1 = $(nth-tl 1, $(l1))
l2 = $(nth-tl 1, $(l2))
result[] += $x$y
value $(result)
Cmyprog(name, cfiles) =
F0 = $(replacesuffixes .c,.o,$(cfiles))
F1 = $(addsuffix /$(PLATFORM)/, $(dirof $(F0)))
F2 = $(addprefix $(ROOTDIR)/, $(F1))
F3 = $(basename $(F0))
F4 = $(join $(F2), $(F3))
$(ROOTDIR)/$(PLATFORM)/$(name): $(F4)
$(CC) ($CFLAGS) -o $@ $(F4) $(CLIBS)
# $(println $(string $(F2)))
i = 0
len = $(length $(F2))
while $(lt $i, $(len))
left = $(nth $i, $(F2))
right = $(nth $i, $(F3))
$(left)%.o: $(right)/%.c
$(CC) -o $@ -c $(CFLAGS) @<
i = $(add $i, 1)
.DEFAULT: $(ROOTDIR)/$(PLATFORM)/yprog_eod
YSRCS = yprog_eod/main.c ctrprog/db/db.c
Cmyprog(yprog_eod, $(YSRCS))
--
Nick
z508617 at ftml.net
--
http://www.fastmail.fm - Does exactly what it says on the tin
More information about the Omake
mailing list