I need a couple of symlinks in my project.
From src/openlayers
, folders img
and theme
have to be symlinked in contrib/openlayers
. The contrib/openlayers
folder should also be created automatically.
.PHONY: run
run: contrib/openlayers/theme contrib/openlayers/img
../bin/pserve development.ini --reload
contrib/openlayers/theme:
ln -s src/openlayers/theme $@
contrib/openlayers/img:
ln -s src/openlayers/img $@
But this rule tries to create symlinks every time. (I put -f
flag to ln
, so it re-creates the symlinks every time.)
In general, no. Technically, there will be a very slight performance hit for the indirection, but it won't be noticeable to your application. As an example, most shared libraries are symlinks to symlinks (e.g. libQtCore.so -> libQtCore. so.
The -L option tells du to process symbolic links by using the file or directory which the symbolic link references, rather than the link itself.
Symlinks can be bidirectional, if they are "hard" symlinks. However, in general symlinks are unidirectional, and the information about the link is only stored in the symlink itself.
In order to follow symbolic links, you must specify ls -L or provide a trailing slash. For example, ls -L /etc and ls /etc/ both display the files in the directory that the /etc symbolic link points to. Other shell commands that have differences due to symbolic links are du, find, pax, rm and tar.
In case you ever you run into this problem in spite of your symlink pointing correctly to an existing file: also keep in mind that "make" looks at the mtime of the destination file of the symlink, and not at the mtime of the symbolic link itself.
Therefore, if the rule that calls "ln -s" has any dependency that is newer than the file your symbolic links points at, then "make" has to rerun the commands in that rule each time. It will do so again and again because creating a symlink that points to a file does not update the mtime of that file.
You may be able to use the "touch" command to ensure that the destination of your link has a more recent mtime than your dependency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With