help-make
[Top][All Lists]
Advanced

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

dependency depending on symlinks


From: Basile Starynkevitch
Subject: dependency depending on symlinks
Date: Sat, 16 Jun 2012 22:48:20 +0200

Hello All,

(for the very curious, all this is about the GCC MELT branch and MELT plugin, 
see
http://gcc-melt.org/ for much more and see recent source code under
http://gcc.gnu.org/viewcvs/branches/melt-branch/gcc etc...)


Le't say that I have a foo.c file (actually it is a generated file, but that 
don't matter
much here). That may be either a real file, or a symlink to something like
workdir/foo-1c1ecd394e9981eddea268db2b62d910.mdsumed.c where
1c1ecd394e9981eddea268db2b62d910 is the md5sum of foo.c (and I do assume that 
no md5
collisions happen in practice).

I would like to have the obvious dependency 
foo.o: foo.c
but actually, if foo.c is a symlink to some workdir/foo-*.md5sum.c (e.g. the 
above one),
I would like that foo.o would be a symlink to
workdir/foo-1c1ecd394e9981eddea268db2b62d910.mdsumed.o and to actually use the
dependencies
foo.o: workdir/foo-1c1ecd394e9981eddea268db2b62d910.mdsumed.o
    $(LN_S) $< $@
workdir/foo-1c1ecd394e9981eddea268db2b62d910.mdsumed.o: \
    workdir/foo-1c1ecd394e9981eddea268db2b62d910.mdsumed.c


that is, I want to have 
foo.c: $(patsubst %.c, %.o, $(shell realpath foo.c))
when foo.c is a symlink but
foo.c: foo.o
when it is not a symlink


(in some very restricted sense, I am doing my own poor-man's ccache, because I 
don't want
to depend upon it).


The motivation is that MELT is a bootstrapped language translated to C, and I 
would like
to accelerate the common case when MELT stage 3 is the same as MELT stage 2 and 
same as
MELT stage 1


Any clues?

Regards
-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***



reply via email to

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