[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Makefile idiom for referencing URL sources
From: |
Johnson, Richard |
Subject: |
Re: Makefile idiom for referencing URL sources |
Date: |
Tue, 21 Dec 2021 14:49:18 +0000 |
On Dec 21, 2021, at 3:54 AM, Mark Piffer
<mark.piffer@gmail.com<mailto:mark.piffer@gmail.com>> wrote:
As no one else asks this: how does make check the timestamps of the remote
resource? What I am seeing here (and I may be wrong) is checking against a
local file timestamp, like always. To my understanding it is not possible for
vanilla make to check anything else but stat-able files - how did you achieve
this?
Creation of local files derived from remote sources was tested. Alas, my
project is not mature enough to test updating against a volatile remote sources.
The theory is that a stat-able goal's timestamp is conditionally updated by the
recipe. The result is that the goal's stat-time can be significantly older
than the recipe's execution time.
So we have to ask whether further processing is based upon the recipe execution
time or the goal's actual stat-time? I've always assumed the actual stat-time
would be used when available. But I could be wrong on that detail.
If the goal's stat-time is used, checking the tracking files can be be forced
with the updated rules below.
If recipe execution time is used, two passes are required. One to update the
local timestamps and one to perform the build.
REMOTE:
.http/%: REMOTE
#...establish timestamp of the source
mkdir -p $$(dirname $@)
tstamp="$$(curl -sI $(subst .http,http:,$@) 2>/dev/null | sed -n
's/Last-Modified: //p')" && \
touch -d "$${tstamp}" $@