Hello,

I am trying to combine a pattern rule with the multi-architecture build method described at http://make.paulandlesley.org/multi-arch.html, but I am not getting what I had hoped for.

Take this Makefile for example. It is almost the same as the one in the aforementionned method, but it uses a pattern rule:

----------------------------------------------------------------
OBJDIR:=/tmp
$(shell [ -d $(OBJDIR) ] || mkdir -p $(OBJDIR))
ifneq ($(CURDIR),$(OBJDIR))

.SUFFIXES:
MAKETARGET = $(MAKE) -C $@ -f $(CURDIR)/Makefile \
  SRCDIR=$(CURDIR) $(MAKECMDGOALS)

.PHONY: $(OBJDIR) $(OBJDIR): [EMAIL PROTECTED] -d $@ ] || mkdir -p $@ +$(MAKETARGET)

Makefile : ;
%.mk :: ;
% :: $(OBJDIR) ;
.PHONY: clean
clean:
        rm -rf $(OBJDIR)

else

%.out: %.src
        cp $< $@

vpath %.src $(SRCDIR)
src := $(wildcard $(SRCDIR)/*.src)
OBJS=$(src:%.src=%.out)
all:: $(OBJS)

endif
----------------------------------------------------------------

To run this, simply touch file.src then make -f Makefile -n.
You will see that the target file.out is not placed in /tmp but it is rather placed right in the source directory. This is because the pattern matched by % is obtained via the vpath, "$(SRCDIR)/file".

Was it intentional that this method does not work with pattern rules, or have I missed something?

Thanks,
Martin


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to