diff src/Makefile.am @ 18151:91a3858ef8cf stable

invoke versioned binaries from octave driver program (bug #40957) * main.in.cc (OCTAVE_VERSION): New macro. (main) Append OCTAVE_VERSION to exec file name. Always set new_argv[0] to full name of file that is executed. * Makefile.am (octave-cli-$(version), octave-gui-$(version), all-local): New rules. (OCTAVE_VERSION_LINKS): New variable. (CLEANFILES): Include $(OCTAVE_VERSION_LINKS) in the list.
author John W. Eaton <jwe@octave.org>
date Thu, 19 Dec 2013 15:24:28 -0500
parents a99b7d656a6c
children 8071c0a9d193 bce3a82a4a8d
line wrap: on
line diff
--- a/src/Makefile.am	Wed Dec 18 17:47:21 2013 +0000
+++ b/src/Makefile.am	Thu Dec 19 15:24:28 2013 -0500
@@ -49,8 +49,11 @@
   octave \
   octave-cli
 
+OCTAVE_VERSION_LINKS = octave-cli-$(version)
+
 if AMCOND_BUILD_GUI
   OCTAVE_BINARIES += octave-gui
+  OCTAVE_VERSION_LINKS += octave-gui-$(version)
 endif
 
 OCTAVE_CORE_LIBS = \
@@ -136,6 +139,8 @@
   octave-config
 endif
 
+all-local: $(OCTAVE_VERSION_LINKS)
+
 if AMCOND_BUILD_COMPILED_AUX_PROGRAMS
 octave-config.cc: octave-config.in.cc Makefile
 	@$(do_subst_default_vals)
@@ -189,5 +194,17 @@
 
 .PHONY: make-version-links remove-version-links
 
+## We need these file names in the build tree because the wrapper
+## program (main.cc) will try to invoke the versioned binaries.
+
+octave-cli-$(version): octave-cli
+	rm -f $@
+	$(LN_S) $< $@
+
+octave-gui-$(version): octave-gui
+	rm -f $@
+	$(LN_S) $< $@
+
 CLEANFILES = \
-  $(bin_SCRIPTS)
+  $(bin_SCRIPTS) \
+  $(OCTAVE_VERSION_LINKS)