octave-maintainers
[Top][All Lists]
Advanced

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

Makefile rule for symbolic links in src/DLD-FUNCTIONS


From: John W. Eaton
Subject: Makefile rule for symbolic links in src/DLD-FUNCTIONS
Date: Tue, 25 Jan 2011 15:15:33 -0500

On 25-Jan-2011, Rik wrote:

| 1/25/11
| 
| Often, when I run make in the src/ directory I get a lot of useless
| re-creation of symbolic links.  For example:
| 
| make DLD-FUNCTIONS/balance.oct
| 
| making defaults.h from defaults.h.in
| making oct-conf.h from oct-conf.h.in
| defaults.h is unchanged
| oct-conf.h is unchanged
| rm -f DLD-FUNCTIONS/balance.oct
| la=`echo DLD-FUNCTIONS/balance.la | /bin/sed 's,DLD-FUNCTIONS/,,'` && \
|           of=`echo DLD-FUNCTIONS/balance.oct | /bin/sed
| 's,DLD-FUNCTIONS/,,'` && \
|           cd DLD-FUNCTIONS && \
|           ln -s .libs/`/bin/sed -n -e "s/dlname='\([^']*\)'/\1/p" < $la` $of
| 
| The issue seems to be that the target of the rule is a symbolic link and
| make looks at the timestamp of the file *pointed* to by the symbolic link
| rather than the link itself.  The rule is this one:
| 
| DLD-FUNCTIONS/balance.oct: DLD-FUNCTIONS/balance.la
|    ... commands ...
| 
| I can stop the endless rule firings by passing the GNU Make-specific
| argument '--check-symlink-times' which instructs Make to look at the
| symbolic link for modification times.  Is there any problem with adding
| 
| MAKEFLAGS += --check-symlink-times
| 
| to Makefile.am for the src/ directory?  The fix above works for me and we
| already require GNU Make for building.

That change seems OK for the .oct files, but in the src directory tree
there are other files that are symbolic links.  Are any of them
involved in rules where the intent is to check the timestamp of the
target file rather than the link?  Even if not, can we be sure that
this won't be true in the future?

On my system, I have

  DLD-FUNCTIONS/balance.la
  DLD-FUNCTIONS/balance.oct -> .libs/balance.so.0
  DLD-FUNCTIONS/.libs/balance.so.0 -> balance.so.0.0.0

and

  DLD-FUNCTIONS/balance.la
  DLD-FUNCTIONS/.libs/balance.so.0.0.0

When I run make for a DLD-FUNCTIONS/X.oct file that needs to be
remade, apparently unnecessarily, I see

  making defaults.h from /home/jwe/src/octave/src/defaults.h.in
  defaults.h is unchanged
  making oct-conf.h from /home/jwe/src/octave/src/oct-conf.h.in
  oct-conf.h is unchanged
  rm -f DLD-FUNCTIONS/sqrtm.oct
  la=`echo DLD-FUNCTIONS/sqrtm.la | /bin/sed 's,DLD-FUNCTIONS/,,'` && \
            of=`echo DLD-FUNCTIONS/sqrtm.oct | /bin/sed 's,DLD-FUNCTIONS/,,'` 
&& \
            cd DLD-FUNCTIONS && \
            ln -s .libs/`/bin/sed -n -e "s/dlname='\([^']*\)'/\1/p" < $la` $of

and for another that does not have the symbolic link rule triggered:

  making defaults.h from /home/jwe/src/octave/src/defaults.h.in
  defaults.h is unchanged
  making oct-conf.h from /home/jwe/src/octave/src/oct-conf.h.in
  oct-conf.h is unchanged

(and nothing else).  Looking at the output of make -d for these, it
looks like the same things are happening for the defaults.h and
oct-conf.h files, and the only difference is that in the first case,
the .la file is newer than the .oct file (which is really the
timestamp of the corresponding .so.0.0.0 file).

Since I think the .la file is created after the .so.0.0.0 file, I
guess a better question would be why doesn't this recreating of
symbolic links happen all the time?  I don't see it for all files.  I
guess that sometimes the .la and .so.0.0.0 file end up with the same
time stamp (to the 1 second resolution of the filesystem)?

OK, now I think I understand what is happening and why.  Yes, the
intent of the rule is to check the timestamp of the symbolic link
itself.  But it would be nice if we could somehow limit that to just
these .oct file targets and not apply it globally unless there is some
way to know that there will never be any dependency checks that will
now be incorrect if we make this change.

jwe


reply via email to

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