changeset 12162:c9f42acd84e2

Use Makefile rules based on timestamp files for src/DLD-FUNCTIONS/*.oct
author John W. Eaton <jwe@octave.org>
date Tue, 25 Jan 2011 19:54:06 -0800
parents 1c5ecdda4e9a
children 55ebf5df9ea6
files src/ChangeLog src/DLD-FUNCTIONS/config-module.awk src/Makefile.am
diffstat 3 files changed, 41 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -4,6 +4,15 @@
 	load-save.cc: Make docstrings static by removing documentation
 	depending on #ifdef configuration variables.
 
+2011-01-25  John W. Eaton  <jwe@octave.org>
+
+	* Makefile.am (OCT_STAMP_FILES): New variable.
+	(DISTCLEANFILES): Add $(OCT_STAMP_FILES) to the list.
+	(all-local): Depend on $(OCT_STAMP_FILES) instead of $(OCT_FILES).
+
+	* DLD-FUNCTIONS/config-module.awk: Create stamp files when
+	creating .oct file links.
+
 2011-01-25  Konstantinos Poulios  <logari81@googlemail.com>
 
 	* src/graphics.cc (text::properties::update_text_extent):
--- a/src/DLD-FUNCTIONS/config-module.awk
+++ b/src/DLD-FUNCTIONS/config-module.awk
@@ -10,31 +10,38 @@
 } {
   files[++nfiles] = $1;
 } END {
+  print "DLD_FUNCTIONS_SRC = \\";
+  for (i = 1; i <= nfiles; i++) {
+    if (i == nfiles)
+      sep = "\n";
+    printf ("  DLD-FUNCTIONS/%s%s", files[i], sep);
+  }
+  print "";
+
   sep = " \\\n";
-  print "DLD_FUNCTIONS_LIBS = \\";
+  print "DLD_FUNCTIONS_LIBS = $(DLD_FUNCTIONS_SRC:.cc=.la)";
+  print "";
+  print "octlib_LTLIBRARIES += $(DLD_FUNCTIONS_LIBS)";
+  print "";
+  print "if AMCOND_ENABLE_DYNAMIC_LINKING";
+  print "";
+  print "## Use stamp files to avoid problems with checking timestamps";
+  print "## of symbolic links";
+  print "";
   for (i = 1; i <= nfiles; i++) {
     basename = files[i];
     sub (/\.cc$/, "", basename);
-    if (i == nfiles)
-      sep = "\n";
-    printf ("  DLD-FUNCTIONS/%s.la%s", basename, sep);
-  }
-  print ""
-  print "octlib_LTLIBRARIES += $(DLD_FUNCTIONS_LIBS)";
-  print ""
-  print "if AMCOND_ENABLE_DYNAMIC_LINKING";
-  for (i = 1; i <= nfiles; i++) {
-    basename = files[i];
-    sub (/\.cc$/, "", basename);
-    printf ("DLD-FUNCTIONS/%s.oct: DLD-FUNCTIONS/%s.la\n", basename, basename);
-    print "\trm -f $@";
-    print "\tla=`echo $< | $(SED) 's,DLD-FUNCTIONS/,,'` && \\";
-    print "\t  of=`echo $@ | $(SED) 's,DLD-FUNCTIONS/,,'` && \\";
+    printf ("DLD-FUNCTIONS/.%s.oct-stamp: DLD-FUNCTIONS/%s.la\n", basename, basename);
+    print "\trm -f $(<:.la=.oct)";
+    print "\tla=$(<F) && \\";
+    print "\t  of=$(<F:.la=.oct) && \\";
     print "\t  cd DLD-FUNCTIONS && \\";
-    print "\t  $(LN_S) .libs/`$(SED) -n -e \"s/dlname='\\([^']*\\)'/\\1/p\" < $$la` $$of";
+    print "\t  $(LN_S) .libs/`$(SED) -n -e \"s/dlname='\\([^']*\\)'/\\1/p\" < $$la` $$of && \\";
+    print "\t  touch $(@F)";
+    print "";
   }
   print "endif";
-  print ""
+  print "";
 
   for (i = 1; i <= nfiles; i++) {
     basename = files[i];
@@ -45,12 +52,6 @@
 	    basename);
     printf ("DLD_FUNCTIONS_%s_la_LIBADD = $(OCT_LINK_DEPS)\n", basename);
   }
+  print "";
 
-  sep = " \\\n";
-  print "DLD_FUNCTIONS_SRC = \\";
-  for (i = 1; i <= nfiles; i++) {
-    if (i == nfiles)
-      sep = "\n";
-    printf ("  DLD-FUNCTIONS/%s%s", files[i], sep);
-  }
 }
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -466,11 +466,13 @@
 if AMCOND_ENABLE_DYNAMIC_LINKING
   DLD_DYNAMIC_SRC = $(DLD_FUNCTIONS_SRC)
   DLD_STATIC_SRC =
-  OCT_FILES = $(DLD_FUNCTIONS_SRC:.cc=.oct)
+  OCT_FILES = $(DLD_FUNCTIONS_LIBS:.la=.oct)
+  OCT_STAMP_FILES = $(subst DLD-FUNCTIONS/,DLD-FUNCTIONS/., $(DLD_FUNCTIONS_LIBS:.la=.oct-stamp))
 else
   DLD_DYNAMIC_SRC =
   DLD_STATIC_SRC = $(DLD_FUNCTIONS_SRC)
   OCT_FILES =
+  OCT_STAMP_FILES =
 endif
 
 liboctinterp_la_SOURCES = \
@@ -606,14 +608,15 @@
 DISTCLEANFILES = \
   .DOCSTRINGS \
   DOCSTRINGS \
-  $(OCT_FILES)
+  $(OCT_FILES) \
+  $(OCT_STAMP_FILES)
 
 MAINTAINERCLEANFILES = \
   $(BUILT_DISTFILES)
 
 octave_LDADD = $(OCTAVE_LIBS)
 
-all-local: $(OCT_FILES) DLD-FUNCTIONS/PKG_ADD .DOCSTRINGS
+all-local: $(OCT_STAMP_FILES) DLD-FUNCTIONS/PKG_ADD .DOCSTRINGS
 
 lex.lo lex.o oct-parse.lo oct-parse.o: \
   AM_CXXFLAGS := $(filter-out -Wold-style-cast, $(AM_CXXFLAGS))