[Top][All Lists]

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

how to make symbolic links?

From: Mark Galeck (CW)
Subject: how to make symbolic links?
Date: Wed, 7 Sep 2011 20:07:52 -0700


I am facing some problems making symbolic links.

The only thing the manual says about links, is only that there is an option, 
which will consider the timestamp on the link itself, in addition to the 
timestamp on the file linked to by a make target which is a symbolic link.

This seems to imply, that normally, without that option, you can have targets 
that are symbolic links, and the timestamp on such a target is the timestamp of 
the file linked to.

OK, so then if I do this:

dir/foobar: dir1/foobar1
                ln -s $< $@

Ø  Mkdir dir

Ø  Mkdir dir1

Ø  Touch dir1/foobar1

Ø  Make dir/foobar

Then I expect first, the target does not exist,  (and make does not know it is 
supposed to be a link) so it calls the recipe and the recipe makes the target.

After that, if I immediately attempt to remake it, now make would consider the 
timestamps both target (as above, following through to the link), and the 
prerequisite, find them to be _the_same_, therefore, the prerequisite target is 
not newer, and therefore, the target should be considered up to date.

But that is not what happens...
Instead,  I get

ln -s dir1/foobar1 dir/foobar
ln: creating symbolic link `dir/foobar' to `dir1/foobar1': File exists
make: *** [dir/foobar] Error 1

and the closer inspection with -d, reveals that make for some reason thinks the 
target does not even exist! (and then it bombs trying to execute the recipe 
when it finds out the target does exist).

What is going on??  Why is the target not up to date?

(PS.  If the target is in the same directory, not subdirectory, then everything 
is as expected).


reply via email to

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