[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pattern rule and vpath build using Paul's multi-architecture method
From: |
Martin d Anjou |
Subject: |
pattern rule and vpath build using Paul's multi-architecture method |
Date: |
Wed, 24 Sep 2008 09:50:36 -0400 (EDT) |
User-agent: |
Alpine 1.10 (LNX 962 2008-03-14) |
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):
address@hidden -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- pattern rule and vpath build using Paul's multi-architecture method,
Martin d Anjou <=