help-make
[Top][All Lists]
Advanced

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

Re: file versus identical symlink as a target?


From: Paul Smith
Subject: Re: file versus identical symlink as a target?
Date: Fri, 03 Jan 2020 12:02:53 -0500
User-agent: Evolution 3.34.1-2

On Fri, 2019-11-01 at 06:53 -0400, Robert P. J. Day wrote:
>   if, however, i would rather create a symlink under local/ to the
> tarball to avoid all that copying, make insists on downloading it
> anyway.
> 
>   so, in summary, can a target be a symlink and, if so, how? thank you
> kindly.

Yes, sure.  The operating system handles symlinks invisibly to the program;
when make asks for the modification time of a symlink the operating system
returns the modification time of the file the link points to.  In fact, you
have to run a special, different system call to operate with the symlink
instead of the linked-to file: all the normal file operations always
resolve the symlink automatically.

Your problem is exactly that: when you create the symlink that doesn't
change the modification time of the thing being linked to, so it appears to
be still out of date.  When you copy the file locally, of course, its
modification time is updated.

You have two choices: you can either touch the file when you create a
symlink to it so that it appears up to date, or (if that's a problem for
example it's in a central shared location and you don't want to change it
because that breaks other makefiles) you can use GNU make's -L option
(added in GNU make 3.81) to have it treat the modification time of the
symlink separately from the modification time of the linked-to file.




reply via email to

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