patch for a verbose -fullversion

Patrick Tullmann tullmann at cs.utah.edu
Mon Mar 13 16:31:47 PST 2000


I updated my '-fullversion' patch to meet most of Alexandre's
suggestions and fixes.  It is below.

Alexandre Oliva wrote:
> I don't like having phony targets that cause something to be built
> every time I run `make'.  

Its somewhat annoying, but in reality the generation and recompile are
lost in the shuffle of symbol extraction and relinking.  I really
wanted compile-time information (such as the date and the actual flags
used) to be part of the version header.  Short of having GCC or the
linker generate this info, I don't see another choice.... hmm, we
could stuff it KaffeS.c which gets recompiled for each link....

> You could extract the first line of ChangeLog like this:

Done.  I also did the '-rm' thing and used a temp file for the
output.  

For those who are curious, here's a sample of 'kaffe -fullversion': 

Kaffe Virtual Machine
Copyright (c) 1996-2000
Transvirtual Technologies, Inc.  All rights reserved
Engine: Just-in-time v3   Version: 1.0.5   Java Version: 1.1
Configuration/Compilation options:
  Compile date  : Mon Mar 13 16:53:15 MST 2000
  Compile host  : alta.cs.utah.edu
  Install prefix: /n/alta/z/tullmann/janos/install/kaffe-1.1-kaffe-jit-debug-unix
  Thread system : unix-jthreads
  CC            : gcc
  CFLAGS        : -g -O2 -Wall -Wstrict-prototypes
  LDFLAGS       : -export-dynamic
  ChangeLog head: Mon Mar 13 15:23:44 PST 2000  Archie Cobbs <archie at whistle.com>

-Pat

----- ----- ---- ---  ---  --   -    -      -         -               -
Pat Tullmann                                       tullmann at cs.utah.edu
		Your research fills a much needed gap.


Index: kaffe/kaffe/version.c
===================================================================
--- /dev/null	Mon Mar 13 17:21:36 2000
+++ kaffe/kaffe/version.c	Mon Mar 13 16:31:51 2000
@@ -0,0 +1,48 @@
+/*
+ * version.c
+ *
+ * Copyright (c) 2000  The University of Utah.  All rights Reserved.
+ *
+ * This file is distributed as is under the terms of the GNU General
+ * Public License.
+ */
+
+/* Print out the Kaffe version information.
+ * This is in a separate file because the version-info.h header file is
+ * re-generated for each compile, and this minimizes the dependencies.
+ */
+#include "config.h"
+#include "config-std.h"
+#include "version.h"
+#include "version-info.h" /* generated at compile time */
+
+extern char* engine_name;	/* defined in the engine's library */
+extern char* engine_version;	/* defined in the engine's library */
+
+static FILE* versionfd = stderr;
+
+void
+printShortVersion(void)
+{
+	fprintf(versionfd, "Kaffe Virtual Machine\n");
+	fprintf(versionfd, "Copyright (c) 1996-2000\nTransvirtual Technologies, Inc.  All rights reserved\n");
+	fprintf(versionfd, "Engine: %s   Version: %s   Java Version: %s\n",
+		engine_name, engine_version, JAVA_VERSION_STRING);
+}
+
+void
+printFullVersion(void)
+{
+	printShortVersion();
+	fprintf(versionfd, "Configuration/Compilation options:\n");
+	fprintf(versionfd, "  Compile date  : %s\n", VER_COMPILE_DATE);
+	fprintf(versionfd, "  Compile host  : %s\n", VER_COMPILE_HOST);
+	fprintf(versionfd, "  Install prefix: %s\n", VER_PREFIX);
+	fprintf(versionfd, "  Thread system : %s\n", VER_THREAD_SYSTEM);
+	fprintf(versionfd, "  CC            : %s\n", VER_CC);
+	fprintf(versionfd, "  CFLAGS        : %s\n", VER_CFLAGS);
+	fprintf(versionfd, "  LDFLAGS       : %s\n", VER_LDFLAGS);
+	fprintf(versionfd, "  ChangeLog head: %s\n", VER_CHANGELOG_HEAD);
+	// fprintf(versionfd, "  Libraries     : %s\n", VER_KAFFELIBS);
+}
+
Index: kaffe/kaffe/version.h
===================================================================
--- /dev/null	Mon Mar 13 17:21:36 2000
+++ kaffe/kaffe/version.h	Thu Mar  9 18:12:08 2000
@@ -0,0 +1,29 @@
+/*
+ * version.h
+ *
+ * Copyright (c) 2000  The University of Utah.  All rights Reserved.
+ *
+ * This file is distributed as is under the terms of the GNU General
+ * Public License.
+ */
+
+#ifndef KAFFE_KAFFE_VERSION_H
+#define KAFFE_KAFFE_VERSION_H
+
+#define JAVA_VERSION_STRING	"1.1"
+#define JAVA_VERSION_HEX 	0x00010001
+
+/*
+ * Print copyright notice and simple version info (Java version, 
+ * engine type, etc).  Prints to stderr.
+ */
+void printShortVersion(void);
+
+/*
+ * In addition to the short version, print ludicrous amounts of
+ * information about the compile environment, configuration 
+ * options, etc.
+ */
+void printFullVersion(void);
+
+#endif /* KAFFE_KAFFE_VERSION_H */
Index: kaffe/kaffe/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffe/Makefile.am,v
retrieving revision 1.5
diff -u -u -r1.5 Makefile.am
--- kaffe/kaffe/Makefile.am	1999/02/08 10:44:38	1.5
+++ kaffe/kaffe/Makefile.am	1999/12/03 06:45:20
@@ -10,10 +10,35 @@
 
 INCLUDES = -I../kaffevm -I$(srcdir)/../kaffevm -I$(top_srcdir)/libltdl
 
-Kaffe_SOURCES = main.c
+Kaffe_SOURCES = main.c version.c
 
 LIBKAFFEVM = ../kaffevm/libkaffevm.la
 
 Kaffe_LDFLAGS = -export-dynamic
 Kaffe_LDADD = $(DLOPEN_JAVA_LIBS) $(LIBKAFFEVM) $(KAFFE_LIBS)
 Kaffe_DEPENDENCIES = $(LIBKAFFEVM) $(JAVA_LIBS)
+
+### Rules to generate the version-info header file
+
+version-info.h: $(top_srcdir)/ChangeLog 
+	-rm -f $@
+	-rm -f $@T
+	echo "/* version-info.h is automagically generated by Kaffe's Makefile */" > $@T
+	sed < $(top_srcdir)/ChangeLog            \
+	  -e 's/^/#define VER_CHANGELOG_HEAD "/' \
+	  -e 's/$$/"/'				 \
+	  -e '1q' >> $@T
+	echo '#define VER_COMPILE_DATE  "'`date`'" '            >> $@T
+	echo '#define VER_COMPILE_HOST  "'`hostname`'"'         >> $@T
+	echo '#define VER_CC            "$(CC)"'                >> $@T
+	echo '#define VER_KAFFELIBS     "$(Kaffe_LDADD)""$(LIBS)"'      >> $@T
+	echo '#define VER_CFLAGS        "$(AM_CFLAGS)""$(CFLAGS)"'      >> $@T
+	echo '#define VER_CPPFLAGS      "$(AM_CPPFLAGS)""$(CPPFLAGS)"'  >> $@T
+	echo '#define VER_LDFLAGS       "$(Kaffe_LDFLAGS)"'            >> $@T
+	echo '#define VER_DEFS          "$(DEFS)"'              >> $@T
+	echo '#define VER_PREFIX        "$(prefix)"'            >> $@T
+	echo '#define VER_THREAD_SYSTEM "$(THREAD_SYSTEM)"'     >> $@T
+	-mv $@T $@
+
+# Make version-info.h phony because we always want it to be regenerated
+.PHONY: version-info.h
Index: kaffe/kaffe/main.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffe/main.c,v
retrieving revision 1.28
diff -u -u -r1.28 main.c
--- kaffe/kaffe/main.c	2000/03/09 21:52:28	1.28
+++ kaffe/kaffe/main.c	1999/12/03 06:45:21
@@ -22,13 +22,11 @@
 #include "system.h"
 #include "md.h"
 #include "ltdl.h"
+#include "version.h"
 
 #if defined(KAFFE_PROFILER)
 extern int profFlag;
 #endif
-extern char* engine_name;
-extern char* engine_version;
-static char* java_version;
 
 #include "jni.h"
 
@@ -63,8 +61,8 @@
 	/* Machine specific main first */
 	MAIN_MD;
 #endif
-	java_version = "1.1";
-	vmargs.version = 0x00010001;
+	vmargs.version = JAVA_VERSION_HEX;
+
 #if defined(KAFFE_PROFILER)
 	profFlag = 0;
 #endif
@@ -231,9 +229,11 @@
 			exit(0);
 		}
 		else if (strcmp(argv[i], "-version") == 0) {
-			fprintf(stderr, "Kaffe Virtual Machine\n");
-			fprintf(stderr, "Copyright (c) 1996-2000\nTransvirtual Technologies, Inc.  All rights reserved\n");
-			fprintf(stderr, "Engine: %s   Version: %s   Java Version: %s\n", engine_name, engine_version, java_version);
+			printShortVersion();
+			exit(0);
+		}
+		else if (strcmp(argv[i], "-fullversion") == 0) {
+			printFullVersion();
 			exit(0);
 		}
 		else if (strcmp(argv[i], "-classpath") == 0) {


More information about the kaffe mailing list