help-make
[Top][All Lists]
Advanced

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

Re: exporting functions?


From: Erik Rull
Subject: Re: exporting functions?
Date: Mon, 08 Nov 2010 00:09:08 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.15) Gecko/20101027 Lightning/1.0b1 SeaMonkey/2.0.10

Paul Smith wrote:
On Thu, 2010-11-04 at 18:04 +0100, Erik Rull wrote:
You should always use the variable $(MAKE), never the value 'make', when
invoking sub-makes.


Thanks for the hint, I do that already but not consequent enough ;-)

in Makefile.install:

.PHONY: all
all:
        $(call assert_target_dir,/etc)
        [...]

What happens when I call make install:

mkdir -p /home/user/target/sbin
make -f Makefile.install
mkdir -p /home/user/target
                            ^^ here is /etc missing!

so basically the funtion gets "exported" but it seems to be not possible to
give a parameter with the $(call ...)

Variable values are expanded before being placed into the environment
due to "export".  That's why you see the behavior you do.

What's wrong here? Am I doing something wrong? or is it not possible to
define and export functions in such way?

export is not a good way to communicate between parent and child makes,
except for simple settings of static strings.  What gets expanded when
it tricky to control.  The best way to do this is by having a standard
makefile that sets these values, then including it in all your other
makefiles.

Okay, so if I understand your proposal correctly would be to put the stuff that I tried to export into a seperate makefile and include it to each file that needs it?
(like an include in C)

Best regards,

Erik



reply via email to

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