summaryrefslogtreecommitdiffstats
path: root/win/rules-ext.vc
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2017-10-02 17:09:56 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2017-10-02 17:09:56 (GMT)
commit35256f809ed60c7d2fe088246d90c8841686dc76 (patch)
tree8a9b6f71426edf27f8ee3870d3ee40fb3350c7ff /win/rules-ext.vc
parent01201582b7a72ee2efbb6d431ef8f02becd562f1 (diff)
downloadtcl-35256f809ed60c7d2fe088246d90c8841686dc76.zip
tcl-35256f809ed60c7d2fe088246d90c8841686dc76.tar.gz
tcl-35256f809ed60c7d2fe088246d90c8841686dc76.tar.bz2
Introduce rules-ext.vc file for extensions to select most recent rules.vc
Diffstat (limited to 'win/rules-ext.vc')
-rw-r--r--win/rules-ext.vc74
1 files changed, 74 insertions, 0 deletions
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"