help-make
[Top][All Lists]
Advanced

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

RE: unable to use $ORIGIN in rpath


From: Dave Korn
Subject: RE: unable to use $ORIGIN in rpath
Date: Wed, 15 Aug 2007 18:02:38 +0100

On 15 August 2007 07:26, Paul Smith wrote:

> In order to fix THIS you'll have to add an extra level of escaping to
> $ORIGIN, so it survives the second expansion.  Note though!  This means
> you cannot use this variable directly in Makefile; it will only work in
> the sub-makes:
> 
>         RPATHFLAG := $$$$ORIGIN:$$$$ORIGIN/../lib:$(RPATHFLAG)


  I think I just ran across a similar situation, but I'm not sure it's the
exact same.  I define a function in an include file:

------------------------------<snip>------------------------------
# Helper to include a string of text iff a particular
# CPU exists for the target chip version.
# Usage: $(call if-cpu,CPU,TEXT,ELSE)
define if-cpu
$(if $(filter $(1),$(ARTIMI_CPU_LIST)),$(2),$(3))
endef

export if-cpu
------------------------------<snip>------------------------------

  It gets included in a top-level makefile, which recursively invokes a
submake.  


------------------------------<snip>------------------------------
include makefile_lib

export ARTIMI_CPU_LIST:=cpuz cpuy cpux

$(info at all-sys if-cpu is $(value if-cpu) and yet $(filter
if-cpu,$(.VARIABLES)) has $(words $(value if-cpu)) words has origin $(origin
$(filter if-cpu,$(.VARIABLES))))

all: 
        @echo 'if-cpu0 is $(value if-cpu) and yet $(filter
if-cpu,$(.VARIABLES)) has $(words $(value if-cpu)) words has origin $(origin
$(filter if-cpu,$(.VARIABLES))) '
        @echo 'likewise set_quiet_build has $(words $(value set_quiet_build))
words and yet $(filter set_quiet_build,$(.VARIABLES)) has origin $(origin
$(filter set_quiet_build,$(.VARIABLES))) '
        $(MAKE) -f system_bootrom_makefile 
        @echo 'if-cpu1 is $(value if-cpu) and yet $(filter
if-cpu,$(.VARIABLES)) has $(words $(value if-cpu)) words has origin $(origin
$(filter if-cpu,$(.VARIABLES))) '
        @echo 'likewise set_quiet_build has $(words $(value set_quiet_build))
words and yet $(filter set_quiet_build,$(.VARIABLES)) has origin $(origin
$(filter set_quiet_build,$(.VARIABLES)))'
        @echo done
------------------------------<snip>------------------------------


The function is passed to the submake by exporting it from the toplevel, not
by explicitly assigning it on the submake invocation commandline as in the
original poster's case.

  By the time we arrive in the submake, it has been reduced to an empty
string, even though I haven't deliberately done anything to expand it.


Q. - Am I correct in believing that after exporting a variable to the
environment, the imported version in a submake will have been through a round
of expansion?

Q. - Is there any way round this?

Q. - Or is there just no way of defining a function at one makefile level that
is any use in recursive submakes if it uses any functions or variables at all?




    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

Attachment: makefile_lib
Description: Binary data

Attachment: system_bootrom_makefile
Description: Binary data

Attachment: makefile
Description: Binary data


reply via email to

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