Reputation: 639
In my project for daily build we storing its library to its version name dir. .
for latest one we are creating symbolic link as a 'LATEST'.
ex.-
ls -ltr
drw-r--r-- 1 4096 2010-02-10 16:34 abc7.2.0
drw-r--r-- 1 4096 2010-02-10 16:34 abc7.2.1
drw-r--r-- 1 4096 2010-02-10 16:34 abc7.2.2
drw-r--r-- 1 4096 2010-02-10 16:34 abc7.2.3
lrwxrwxrwx 1 8 2010-02-10 16:34 LATEST -> abc7.2.3
Now, In makefile, I want to get dir. name to which LATEST is linking to?
Thanks in advance. :-)
Upvotes: 2
Views: 2368
Reputation: 99254
You can used shell's functionality to get link values. In shell you might type
$ readlink LATEST
abc7.2.3
So in makefile you can just invoke shell
command to get the actual value. This will store the link target to value variable.
value=$(shell readlink LATEST)
Note that it doesn't work relatively to working dir, but, rather, to the directory the symlink is in.
I also reckon a question with link-related issues; it may be useful for you.
Upvotes: 3