[Asterisk-Dev] Asterisk make clean and make looping??

tim panton tpanton at attglobal.net
Wed Nov 2 02:30:50 MST 2005


On 2 Nov 2005, at 08:28, Tzafrir Cohen wrote:

> On Wed, Nov 02, 2005 at 08:11:41AM +0000, tim panton wrote:
>
>>
>> On 2 Nov 2005, at 01:11, Saul Diaz wrote:
>>
>>>
>>> and i think is b/c this
>>>
>>> include/asterisk/version.h: FORCE
>>>       build_tools/make_version_h > $@.tmp
>>>       if cmp -s $@.tmp $@ ; then echo; else \
>>>               mv $@.tmp $@ ; \
>>>       fi
>>>       rm -f $@.tmp
>>>
>>> and this...
>>>
>>> .depend: include/asterisk/version.h
>>>       build_tools/mkdep ${CFLAGS} $(wildcard *.c)
>>>
>>>
>>> so could be an issue for the make not the asterisk Makefile
>>>
>>> I am using GNU Make 3.80
>>>
>>>
>>
>> I'm not in a position to test this, but I think that the problem
>> relates to
>> the fact that neither mv nor echo will change the modified time
>> stamp on version.h
>> Make uses modified time to decide what to do next.
>>
>
> even if there were an older version.h.tmp:
>
>   echo something >version.h.tmp
>   mv version.h.tmp version.h
>   # now there is no version.h.tmp
>   #
>   # looping...
>   #
>   echo something >version.h.tmp
>   # version.h.tmp did not exist and thus a new file with the time of
>   # "now" is created.
>

Yes, but make doesn't care about version.h.tmp, it isn't a target.
It does care about version.h, if an old version of that exists and is
gives the same cmp -s as the version.h.tmp made by make_version_h
then version.h won't change it's timestamp.
Make will assume that it _wasn't_ made (timestamp didn't change)
so will re-make it.

I'm not in the office so I can't test, or see the rest of the makefile,
so I'm guessing here :-)

>
>
>>
>> you could try changing the if section to read
>>
>> include/asterisk/version.h: FORCE
>>        build_tools/make_version_h > $@.tmp
>>        if cmp -s $@.tmp $@ ; then touch $@; else \
>>                cp $@.tmp $@ ;  \
>>        fi
>>        rm -f $@.tmp
>>
>

Has anyone with the problem tried my change ?

T.





More information about the asterisk-dev mailing list