help-make
[Top][All Lists]
Advanced

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

Re: Dinamic paths


From: Greg Chicares
Subject: Re: Dinamic paths
Date: Tue, 05 Jun 2007 10:50:44 +0000
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

On 2007-06-05 09:26Z, Manuel Preliteiro wrote:
> Hello, i'm trying to create a makefile with dinamic paths.
> 
> I belive what I want is simple, but I'm having troubles finding what i
> need in the documentation, i thought what i would need was in section
> 6.2 (2 flavours of variables) but it didnt work as intended.

8.11 The shell Function

> I have the following definition:
> 
> OCAMLC = ocamlc
> OCAMLIBS = $(OCAMLC) -where
> /* This line returns the path i want -->
> /home/manuel/godi/lib/ocaml/std-lib */

At this point, the second variable would expand to the string
"ocamlc -where". This is only text substitution.

You want command substitution, so that it holds the result of
executing that string in a shell. Try:

OCAMLC := ocamlc
OCAMLIBS := $(shell $(OCAMLC) -where)

Normally you'd use simply-expanded variables here, so that the
command is run only once.

> and then inside a rule i have:
> $(CC) -I $(OCAML_LIBS) -c testing.c
> 
> The desired output would be:
> cc -I /home/manuel/godi/lib/ocaml/std-lib -c testing.c
> 
> But i'm geting
> cc -I ocamlc -where -c testing





reply via email to

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