]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
work build# into version string
authorGuido van Rossum <guido@python.org>
Mon, 20 Jan 1997 18:34:26 +0000 (18:34 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 20 Jan 1997 18:34:26 +0000 (18:34 +0000)
Modules/Makefile.pre.in
Modules/getbuildinfo.c [new file with mode: 0644]

index a5f0d9a5c4fbfb98e59da8a03c78c85cfcd77f11..de2b107b570bff5497b453598e54cef5b6dcfff4 100644 (file)
@@ -93,7 +93,7 @@ MAKESETUP=    $(srcdir)/makesetup
 
 OBJS=          $(MODOBJS)
 
-ADDOBJS=       main.o config.o getpath.o
+ADDOBJS=       main.o config.o getpath.o getbuildinfo.o
 
 LIB=           libModules.a
 
@@ -120,11 +120,18 @@ $(LIB):           $& $(OBJS) Makefile
                $(AR) cr $(LIB) $(OBJS)
                $(RANLIB) $(LIB)
 
-../python:     $(MYLIBS) $(ADDOBJS) Makefile
+../python:     $(MYLIBS) $(ADDOBJS) Makefile buildno
+               expr `cat buildno` + 1 >@buildno
+               mv @buildno buildno
+               $(CC) -c $(CFLAGS) -DBUILD=`cat buildno` $(srcdir)/getbuildinfo.c
+               $(AR) r $(LIB) getbuildinfo.o
                $(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(ADDOBJS) \
                      $(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python
                mv python ../python
 
+buildno:
+               echo 0 >buildno
+
 clean:
                -rm -f *.o python core *~ [@,#]* *.old *.orig *.rej
 
diff --git a/Modules/getbuildinfo.c b/Modules/getbuildinfo.c
new file mode 100644 (file)
index 0000000..0bf031a
--- /dev/null
@@ -0,0 +1,30 @@
+#include <stdio.h>
+
+#ifndef DATE
+#ifdef __DATE__
+#define DATE __DATE__
+#else
+#define DATE "xx/xx/xx"
+#endif
+#endif
+
+#ifndef TIME
+#ifdef __TIME__
+#define TIME __TIME__
+#else
+#define TIME "xx:xx:xx"
+#endif
+#endif
+
+#ifndef BUILD
+#define BUILD 0
+#endif
+
+
+const char *
+Py_GetBuildInfo()
+{
+       static char buildinfo[40];
+       sprintf(buildinfo, "#%d, %.12s, %.8s", BUILD, DATE, TIME);
+       return buildinfo;
+}