help-make
[Top][All Lists]
Advanced

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

Re: Associative arrays and $(eval)


From: Greg Chicares
Subject: Re: Associative arrays and $(eval)
Date: Tue, 03 Feb 2004 11:46:05 -0500

Andre Majorel wrote:
> 
> I need something like associative arrays in my makefiles recipes.
> Supposing I have a bunch of vars like
> 
>         DIR_i386=/somedir
>         DIR_sparc64=/someotherdir
> 
> In shell, I'd do
> 
>         target:
>                 cp somefile `eval echo \\$DIR_$ARCH`

Doesn't make evaluate it properly, without 'eval'?

# Makefile begins #
DIR_i386=/somedir
DIR_sparc64=/someotherdir

.PHONY: all
all:
        @echo 'DIR_$$(ARCH)'=DIR_$(ARCH)
        @echo '$$(DIR_$$(ARCH))'=$(DIR_$(ARCH))
        cd $(DIR_$(ARCH))
# Makefile ends #

C:/tmp[0]$make -f Makefile
DIR_$(ARCH)=DIR_i386
$(DIR_$(ARCH))=/somedir
cd /somedir





reply via email to

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