[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
per-target VPATH
From: |
__alex__ |
Subject: |
per-target VPATH |
Date: |
Wed, 12 Dec 2001 14:53:49 +0300 |
Hi all,
It seems that gmake doesn't take in account per-target VPATH variable. I
want to write something like
MODULE = foo
$(BUILDDIR)/$(MODULE)/.obj/bar.o : VPATH = $(SRCDIR)/$(MODULE)
$(BUILDDIR)/$(MODULE)/.obj/%.o : %.cxx
$(CXX) $(CXX_FLAGS) -c -o $@ $<
I'm playing with the idea of having non-recursive makefile(s) for
multi-directory build.
Without target-specific VPATH I need to either specify exact source directory
in the rule, like:
$(BUILDDIR)/$(MODULE)/.obj/%.o : $(SRCDIR)/$(MODULE)/%.cxx
$(CXX) $(CXX_FLAGS) -c -o $@ $<
(if a module has multiple source directories and different source file suffixes
it's not convenient)
or have a single vpath directive for an entire build tree:
SOURCE_PATH = $(MODULE1_SRCDIR):$(MODULE2_SRCDIR):$(MODULE3_SRCDIR)
vpath %.cxx $(SOURCE_PATH)
...
$(BUILDDIR)/$(MODULE)/.obj/%.o : %.cxx
$(CXX) $(CXX_FLAGS) -c -o $@ $<
though in this case source file name must be unique accross the whole source
tree.
Having working pattern-specific VPATH would be even better. I wonder whether
it's going to be
implemented in future versions of gmake. Any ideas and suggestions about this
issue are welcome.
Regards,
Alex
P.S. I've been thinking about introducing a notion of components in the build
process.
For example, it'd be great if gmake were able to recognize global and
component-specific variable & rule scopes.
Right now in order to simulate that I need to prefix each component-specific
variable by the unique
component name which is not very much convenient.
- per-target VPATH,
__alex__ <=