work build# into version string

This commit is contained in:
Guido van Rossum 1997-01-20 18:34:26 +00:00
parent 3bb63a8dbe
commit 2fff2e6b05
2 changed files with 39 additions and 2 deletions

View File

@ -93,7 +93,7 @@ MAKESETUP= $(srcdir)/makesetup
OBJS= $(MODOBJS) OBJS= $(MODOBJS)
ADDOBJS= main.o config.o getpath.o ADDOBJS= main.o config.o getpath.o getbuildinfo.o
LIB= libModules.a LIB= libModules.a
@ -120,11 +120,18 @@ $(LIB): $& $(OBJS) Makefile
$(AR) cr $(LIB) $(OBJS) $(AR) cr $(LIB) $(OBJS)
$(RANLIB) $(LIB) $(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) \ $(LINKCC) $(LDFLAGS) $(OPT) $(LINKFORSHARED) $(ADDOBJS) \
$(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(MYLIBS) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python
mv python ../python mv python ../python
buildno:
echo 0 >buildno
clean: clean:
-rm -f *.o python core *~ [@,#]* *.old *.orig *.rej -rm -f *.o python core *~ [@,#]* *.old *.orig *.rej

30
Modules/getbuildinfo.c Normal file
View File

@ -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;
}