From 35256f809ed60c7d2fe088246d90c8841686dc76 Mon Sep 17 00:00:00 2001 From: apnadkarni Date: Mon, 2 Oct 2017 17:09:56 +0000 Subject: Introduce rules-ext.vc file for extensions to select most recent rules.vc --- win/rules-ext.vc | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ win/rules.vc | 16 +++++++++--- 2 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 win/rules-ext.vc diff --git a/win/rules-ext.vc b/win/rules-ext.vc new file mode 100644 index 0000000..2a8943b --- /dev/null +++ b/win/rules-ext.vc @@ -0,0 +1,74 @@ +# This file should only be included in makefiles for Tcl extensions, +# NOT in the makefile for Tcl itself. +!if "$(PROJECT)" == "tcl" +!error The rules-ext.vc file is not intended for Tcl itself. +!endif + +# First locate the Tcl directory that we are working with. +!ifndef TCLDIR + +# If an installation path is specified, that is also the Tcl directory. +# Also, tk never builds against an installed Tcl, it needs Tcl sources +!if defined(INSTALLDIR) && "$(PROJECT)" != "tk" +TCLDIR=$(INSTALLDIR) +!else +TCLDIR = ../../tcl +!endif + +!endif # ifndef TCLDIR + +# _TCLDIR = Windows native path format of TCLDIR +_TCLDIR = $(TCLDIR:/=\) + +# Now look for the rules.vc file under the Tcl root +!if exist("$(_TCLDIR)\lib\nmake\rules.vc") # Building against installed Tcl +_RULESDIR = $(_TCLDIR)\lib\nmake +!elseif exist("$(_TCLDIR)\win\rules.vc") # Building against Tcl sources +_RULESDIR = $(_TCLDIR)\win +!else +# If we have not located Tcl's rules file, most likely we are compiling +# against an older version of Tcl and so must use our own support files. +_RULESDIR = . +!endif + +_RULES_VC = $(_RULESDIR)\rules.vc + +!if "$(_RULESDIR)" != "." +# Potentially using Tcl's support files. Need to compare the versions. +# We extract version numbers using the nmakehlp program. For this +# purpose, we use the version of nmakehlp that we have. +!if [$(CC) -nologo nmakehlp.c -link -subsystem:console > nul] +!endif + +!if [echo TCL_RULES_MAJOR = \> versions.vc] \ + && [nmakehlp -V "$(_RULES_VC)" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo TCL_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "$(_RULES_VC)" RULES_VERSION_MINOR >> versions.vc] +!endif + +!if [echo OUR_RULES_MAJOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc] +!endif +!if [echo OUR_RULES_MINOR = \>> versions.vc] \ + && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc] +!endif +!include versions.vc +# We have a newer version of the support files, use them +!message V $(TCL_RULES_MAJOR) $(TCL_RULES_MINOR) $(OUR_RULES_MAJOR) $(OUR_RULES_MINOR) +!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR)) +_RULESDIR = . +!endif + +!endif # $(_RULESDIR) != "." + + +# Get rid of our internal defines before calling rules.vc +!undef _TCLDIR +!undef TCL_RULES_MAJOR +!undef TCL_RULES_MINOR +!undef OUR_RULES_MAJOR +!undef OUR_RULES_MINOR + +!message *** Using $(_RULESDIR)\rules.vc +#!include "$(_RULESDIR)\rules.vc" diff --git a/win/rules.vc b/win/rules.vc index f62be5c..6846a32 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1,4 +1,4 @@ -#------------------------------------------------------------------------------ +#------------------------------------------------------------- -*- makefile -*- # rules.vc -- # # Microsoft Visual C++ makefile include for decoding the commandline @@ -15,6 +15,10 @@ !ifndef _RULES_VC _RULES_VC = 1 +# The following macros define the version of the rules.vc nmake build system +RULES_VERSION_MAJOR = 1 +RULES_VERSION_MINOR = 0 + ################################################################ # Nmake is a pretty weak environment in syntax and capabilities # so this file is necessarily verbose. It's broken down into @@ -1085,9 +1089,13 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 !endif -# UNICODE - Use the wide char Windows API. # _ATL_XP_TARGETING - Newer SDK's need this to build for XP -COMPILERFLAGS = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING +COMPILERFLAGS = /D_ATL_XP_TARGETING + +# UNICODE - Use the wide char Windows API. Tcl 8.5 does not define this. +!if $(TCL_VERSION) > 85 +COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE +!endif # crt picks the C run time based on selected OPTS !if $(MSVCRT) @@ -1299,7 +1307,7 @@ $< {$(RCDIR)}.rc{$(TMP_DIR)}.res: $(MAKERESCMD) - + {$(WINDIR)}.rc{$(TMP_DIR)}.res: $(MAKERESCMD) -- cgit v0.12