changeset 40:5bccf3ca5c4f

Win: Cleaner way to disable common function deprecation warnings. Also include the version and revision information in the build.
author Brian Smith <brian@dbsoft.org>
date Mon, 05 Oct 2020 23:44:05 -0500
parents 683ab0f780e8
children b67969b3555b
files makefile.vc
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/makefile.vc	Sun Oct 04 18:57:53 2020 -0500
+++ b/makefile.vc	Mon Oct 05 23:44:05 2020 -0500
@@ -40,7 +40,21 @@
 PLATFORM_DEF = -DWIN64
 !endif
 
-CFLAGS = -c $(PLATFORM_DEF) -D__WIN32__ -DMSVC -D__TARGET__=\"$(TARGET)\" -I. -I$(DWINCDIR) -D_CRT_SECURE_NO_WARNINGS
+# 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
+
+# The Visual C CRT and other Windows components have deprecated lots of common functions
+# These options will hide the deprecation warnings; Comment the next line to see them
+CRT_FLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNING -D_WINSOCK_DEPRECATED_NO_WARNINGS
+
+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) $(CRT_FLAGS)
 CFLAGS_DEBUG = -Zi
 CFLAGS_COMPILE = -MTd
 LIBS = wsock32.lib kernel32.lib user32.lib comctl32.lib gdi32.lib advapi32.lib shell32.lib comdlg32.lib $(DWLIBDIR)\dw.lib $(DWLIBDIR)\dwcompat.lib