[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: include files with :=
From: |
Dill, John |
Subject: |
RE: include files with := |
Date: |
Wed, 15 Dec 2004 12:32:24 -0600 |
>>>I am still trying to track down where exactly my lag time is coming from,
>>>and it
>doesn't >appear to be from using the include directive by itself. My question
>is how
>makefile
>>>evaluates variables that are defined using ':=' with respect to include
>>>files.
>>>
>>>If I have a file include_me.mk which contains:
>>>
>>>my_var:=$(shell script)
>>>
>>>and I have included this file several times (indirectly through my file's
>>>dependent
>>>include files). Does make re-evaluate this variable assignment each time
>>>'include
>>>include_me.mk' appears?
>>>
>>>If that's the case, then I think that's where my problem is.
>>
>> I did some more investigation and found that this is where my performance
>> problem is. >It appears that time increases linearly with the number of
>> times the include file with >':=' variables are included, which means make
>> is evaluating it each time it is seen like >it should. Adding inclusion
>> guards to my include files should fix my performance
>problem.
>
>This makes sense. The := is evaluated at the time of the assignment (rather
>than at the >time of usage as with =). As Paul has said $(system) is an
>expensive call.
Yep. I did a 'grep -r ":=" * | grep shell' and I think the only variable I
have defined with a shell which may take a while is this particular variable.
$(call first_file,filename,path) is a function to search for the first instance
of a file in a path, which uses $(shell). It allows me to guess the extension
whether I'm on a windows or a unix box.
shell_exec_extension:=$(if $(call first_file,sh.exe,$(PATH)),.exe)
I also like the ifndef idea just for those expensive variables that Paul gave.
I'll have to play with it.
John