[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recursively expanded variables in targets?
From: |
Ken Smith |
Subject: |
Re: Recursively expanded variables in targets? |
Date: |
Sat, 29 Oct 2005 18:20:19 -0400 |
User-agent: |
mutt-ng/devel-r445 (Linux) |
On Sat, Oct 29, 2005 at 10:32:26AM +0300, Angel Tsankov wrote:
> Consider the following makefile:
>
> ###############################################################################
>
> build_target := ''
> target_folder = Builds/$(build_target)
>
> all: set_vars build
> @echo $(target_folder)
>
> set_vars:
> $(eval build_target := $(patsubst %,debug,''))
>
> build: $(target_folder)/a.out
>
> $(target_folder)/a.out:
> @echo $@
>
> ###############################################################################
>
> make produces the following output when I execute make all (or just
> make):
> Builds//a.out
> Builds/debug
>
> Is it possible to produce
> Builds/debug/a.out
> Builds/debug
>
> If so, how?
You may want to consider setting the value of build_target using
conditionals (if you need it conditionally set) outside of any rule so
it gets set during the parsing phase. It will have a value and will not
be the empty string as it must be in your example.
Ken