Implicit rules for downloading packages

Alexander E. Patrakov patrakov at ums.usu.ru
Mon Jul 18 08:27:07 PDT 2005


Jeremy Huntwork wrote:
> Alexander E. Patrakov wrote:
> 
>> Hello,
>>
>> currently the new makefiles contain boilerplate rules for downloading
>> files. I don't like that, and propose to remove them with the help of
>> implicit rules.
> 
> Please explain *why* you don't like them.  Saying you don't like them 
> without giving any reasons isn't going to hold much weight. I will look 
> at your diff soon, but can't just now, as I'm at work.

In fact there's no much weight in this indeed :)

The only argument is the size of boilerplate stuff and my laziness to 
type or copy that (and adjust to the number of patches) when it really 
has to be done exactly once.

What the diff does is to define a rule that is executed every time a 
dependency on non-existing source file is seen. The rule downloads that 
file. E.g.:

packages/binutils/Makefile contains the "pass1" target that depenfs upon 
$(FILE)=binutils-2.16.1.tar.bz2. Since the file doesn't exist yes, make 
tries to create it. Before this diff, Makefile for each package 
contained rules for each downloaded file. After the diff, there is one 
catch-all download rule in scripts/functions instead.

So, make uses that rule to download binutils-2.16.1.tar.bz2. The action 
in this rule expands to:

$(call 
download,binutils-2.16.1.tar.bz2,$(URL-binutils-2.16.1.tar.bz2),$(SHA-binutils-2.16.1.tar.bz2))

where $(URL-binutils-2.16.1.tar.bz2) and $(SHA-binutils-2.16.1.tar.bz2) 
are defined at the top of packages/binutils/Makefile as URL-$(FILE)=... 
and SHA-$(FILE)=...

Hope this helps understanding.

-- 
Alexander E. Patrakov



More information about the livecd mailing list