help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pattern rules with directories


From: Garrett Cooper
Subject: Re: Pattern rules with directories
Date: Fri, 17 Apr 2009 13:56:15 -0700

On Fri, Apr 17, 2009 at 1:31 AM, Christophe LYON <address@hidden> wrote:
> Hello,
>
> I have a project where the Makefile has simple rules such as:
>
> %.suf1: %.suf2
>        $(CMDPATH)/cmd
>
> where the target is actually /path/to/dir1.
>
> Now, I need to add a dependency to a file which is not in /path/to/dir1, so
> %.suf1: %.suf2 %.suf3
> won't match.
>
> I think using vpath won't help either.
>
> I usually avoid using paths in target names, but unfortunately I am not the
> one who originally wrote the whole build system :-(
>
> What is the suggested way of handling such cases?
>
> Thanks,
> Christophe.

Send an angry letter to the build system designer.

And maybe think of implementing the implicit rules so that they're
dependent on expanded variables. Example:

DEPENDS_DIR ?= $(CURDIR)
TARGET_DIR ?= $(DEPENDS_DIR)

$(TARGET_DIR)/%.suf1: $(DEPENDS_DIR)/%.suf2 $(DEPENDS_DIR)/%.suf3

That or implement it using a smarter static rule :).

-Garrett




reply via email to

[Prev in Thread] Current Thread [Next in Thread]