help-gnu-utils
[Top][All Lists]
Advanced

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

Re: make: remote dependencies?


From: Colin S. Miller
Subject: Re: make: remote dependencies?
Date: Mon, 20 Apr 2009 22:30:29 +0100
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Henrik Carlqvist wrote:
"curl -I" is one way to find out the time stamp of a remote file on a web
server.

rsync is a very nice tool to mirror files from a remote severe to which
you have ssh access.

regards Henrik

wget can also be used to check if a file is up-to-date,
and if not, then fetch the new version.

make will then notice that the source-file is newer than its dependants,
and remake the dependants.

I think .phony is correct on remote.c, to force it to be always remade,
but not always its dependants.


Thus, I think this is a valid makefile for what you want:

#!/bin/make -f

.phony: ALL
ALL:remote

.phony: remote.c
# phony is needed on remote.c to force make to always
# remake it (run wget)
# the time stamp won't be updated if it is up-to-date,
# and thus it's dependant won't be rebuilt

remote.c:
  wget -N http://my-server.example:80/path/to/remote.c || rm remote.c

remote.o: remote.c
  gcc -c -o remote.o remote.c

remote: remote.o
  gcc -o remote remote.o

# end of makefile



HTH,
Colin S. Miller

--
Replace the obvious in my email address with the first three letters of the 
hostname to reply.


reply via email to

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