changeset 40:ecfb5c023f40

Makefile cleanup.
author Brian Smith <brian@dbsoft.org>
date Thu, 24 Nov 2011 21:49:57 -0600
parents 5c69620f213e
children f3c4bcb83a37
files configure.in makefile.emx makefile.vac makefile.vc
diffstat 4 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Thu Nov 24 16:49:19 2011 -0600
+++ b/configure.in	Thu Nov 24 21:49:57 2011 -0600
@@ -15,7 +15,7 @@
 if test x"$MERCURIAL" = x; then
    MERCURIAL=0
 else
-   MERCURIAL="\` $MERCURIAL id -i -n -b -t | cut -d ' ' -f 2 | tr -d '+' \`"
+   MERCURIAL="\` $MERCURIAL log -r . --template={rev} \`"
 fi
 
 AC_PROG_INSTALL
--- a/makefile.emx	Thu Nov 24 16:49:19 2011 -0600
+++ b/makefile.emx	Thu Nov 24 21:49:57 2011 -0600
@@ -11,7 +11,10 @@
 DEFS =
 LIBS =
 
-CFLAGS = -O2 -Zomf -Zmt -D__ST_MT_ERRNO__ -I. -Wall
+include Version
+VER_REV := $(shell hg log -r . --template={rev})
+
+CFLAGS = -O2 -Zomf -Zmt -D__ST_MT_ERRNO__ -I. -Wall -DVER_MAJ=$(VER_MAJ) -DVER_MIN=$(VER_MIN) -DVER_REV=$(VER_REV)
 LDFLAGS = -lsocket
 RCFLAGS = -r
 
--- a/makefile.vac	Thu Nov 24 16:49:19 2011 -0600
+++ b/makefile.vac	Thu Nov 24 21:49:57 2011 -0600
@@ -8,7 +8,16 @@
 .SUFFIXES: \
 	.c .obj
 
-CFLAGS = /Ti /DOS2 /DTCPV40HDRS /D__TARGET__=\"$(TARGET)\" /I. /I$(DWINCPATH) /Sm /Ss /Q /Gm /Gt /C
+# Check the Mercurial revision number if possible
+!if ![hg log -r . --template="VER_REV={rev}" > HG.REV]
+!include HG.REV
+!else
+VER_REV=0
+!endif
+
+!include Version
+
+CFLAGS = /Ti /DOS2 /DTCPV40HDRS /D__TARGET__=\"$(TARGET)\" /I. /I$(DWINCPATH) /DVER_MAJ=$(VER_MAJ) /DVER_MIN=$(VER_MIN) /DVER_REV=$(VER_REV) /Sm /Ss /Q /Gm /Gt /C
 LDFLAGS = /DE /optfunc
 
 
@@ -53,7 +62,7 @@
     packinst cc.cfg
     
 clean: 
-	rm $(OBJECTS) cc.exe cc.res *~
+	rm -f $(OBJECTS) cc.exe cc.res HG.REV *~
 
 
 cc.obj: cc.c cc.h
--- a/makefile.vc	Thu Nov 24 16:49:19 2011 -0600
+++ b/makefile.vc	Thu Nov 24 21:49:57 2011 -0600
@@ -21,8 +21,18 @@
 PLATFORM_DEF = -DWIN64
 !endif
 
+# Check the Mercurial revision number if possible
+!if ![hg log -r . --template="VER_REV={rev}" > HG.REV]
+!include HG.REV
+!message Revision is [$(VER_REV)]
+!else
+VER_REV=0
+!endif
+
+!include Version
+
 CC = cl
-CFLAGS = -c $(PLATFORM_DEF) -D__WIN32__ -DMSVC -D__TARGET__=\"$(TARGET)\" -I. -I$(DWINCDIR)
+CFLAGS = -c $(PLATFORM_DEF) -D__WIN32__ -DMSVC -D__TARGET__=\"$(TARGET)\" -I. -I$(DWINCDIR) -DVER_MAJ=$(VER_MAJ) -D VER_MIN=$(VER_MIN) -DVER_REV=$(VER_REV)
 CFLAGS_DEBUG = -Zi
 CFLAGS_COMPILE = -MTd
 LIBS = wsock32.lib kernel32.lib user32.lib comctl32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib iphlpapi.lib $(DWLIBDIR)\dw.lib $(DWLIBDIR)\dwcompat.lib
@@ -37,7 +47,7 @@
 all: cc.exe
 
 clean:
-	-erase *.dll
+        -erase *.dll
         -erase *.exe
         -erase *.opt
         -erase *.lib
@@ -47,6 +57,7 @@
         -erase *.ilk
         -erase *.exp
         -erase *.res
+        -erase HG.REV
         -erase *~
         
 # Create a zip file for use with Nullsoft's Install system