diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2017-09-26 12:22:42 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2017-09-26 12:22:42 (GMT) |
commit | 07c1c221cb6dff468b482320fb122254ab0b49ed (patch) | |
tree | 557c07c2333ceeaec285b9d581836f94a9b3d3c5 /win | |
parent | 246e5991428e8da2ba868c84541901336a472ca0 (diff) | |
download | tcl-07c1c221cb6dff468b482320fb122254ab0b49ed.zip tcl-07c1c221cb6dff468b482320fb122254ab0b49ed.tar.gz tcl-07c1c221cb6dff468b482320fb122254ab0b49ed.tar.bz2 |
Include rules.vc and nmakehlp.c as part of install.
Work toward not having to keep updating extensions with the latest version
of rules.vc and nmakehlp. Extension makefiles can instead use the
installed files instead.
Also added some basic sanity checks to rules.vc to warn if extensions are
being compiled with options incompatible with those used to build Tcl.
Diffstat (limited to 'win')
-rw-r--r-- | win/makefile.vc | 34 | ||||
-rw-r--r-- | win/rules.vc | 64 |
2 files changed, 82 insertions, 16 deletions
diff --git a/win/makefile.vc b/win/makefile.vc index 2fe5c72..99d013e 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -468,7 +468,7 @@ PKGSDIR = $(ROOT)\pkgs # Additional include and C macro definitions for the implicit rules
# defined in rules.vc
PRJ_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TOMMATHDIR)"
-PRJ_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
+PRJ_DEFINES = -DTCL_TOMMATH -DMP_PREC=4 -Dinline=__inline -DHAVE_ZLIB=1 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
# Define compiler flags used in our private implicit rules that are
# not covered by rules.vc
@@ -698,6 +698,19 @@ install-docs: # "emacs font-lock highlighting fix
#---------------------------------------------------------------------
+# Generate the tcl.nmake file which contains the options used to build
+# Tcl itself. This is used when building extensions.
+#---------------------------------------------------------------------
+tcl-nmake: $(OUT_DIR)\tcl.nmake
+$(OUT_DIR)\tcl.nmake:
+ @type << >$@
+CORE_MACHINE = $(MACHINE)
+CORE_DEBUG = $(DEBUG)
+CORE_TCL_THREADS = $(TCL_THREADS)
+CORE_USE_THREAD_ALLOC = $(USE_THREAD_ALLOC)
+<<
+
+#---------------------------------------------------------------------
# Build tclConfig.sh for the TEA build system.
#---------------------------------------------------------------------
@@ -937,19 +950,21 @@ install-binaries: @echo Installing $(TCLSTUBLIBNAME)
@$(CPY) "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)\"
-install-libraries: tclConfig install-msgs install-tzdata
- @if not exist "$(SCRIPT_INSTALL_DIR)$(NULL)" \
+install-libraries: tclConfig tcl-nmake install-msgs install-tzdata
+ @if not exist "$(SCRIPT_INSTALL_DIR)" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8$(NULL)" \
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4$(NULL)" \
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform$(NULL)" \
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.4\platform"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5$(NULL)" \
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.5"
- @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6$(NULL)" \
+ @if not exist "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6" \
$(MKDIR) "$(SCRIPT_INSTALL_DIR)\..\tcl8\8.6"
+ @if not exist "$(LIB_INSTALL_DIR)\nmake" \
+ $(MKDIR) "$(LIB_INSTALL_DIR)\nmake"
@echo Installing header files
@$(CPY) "$(GENERICDIR)\tcl.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(GENERICDIR)\tclDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@@ -973,6 +988,9 @@ install-libraries: tclConfig install-msgs install-tzdata @$(CPY) "$(ROOT)\library\auto.tcl" "$(SCRIPT_INSTALL_DIR)\"
@$(CPY) "$(OUT_DIR)\tclConfig.sh" "$(LIB_INSTALL_DIR)\"
@$(CPY) "$(WINDIR)\tclooConfig.sh" "$(LIB_INSTALL_DIR)\"
+ @$(CPY) "$(WINDIR)\rules.vc" "$(LIB_INSTALL_DIR)\nmake\"
+ @$(CPY) "$(WINDIR)\nmakehlp.c" "$(LIB_INSTALL_DIR)\nmake\"
+ @$(CPY) "$(OUT_DIR)\tcl.nmake" "$(LIB_INSTALL_DIR)\nmake\"
@echo Installing library http1.0 directory
@$(CPY) "$(ROOT)\library\http1.0\*.tcl" \
"$(SCRIPT_INSTALL_DIR)\http1.0\"
diff --git a/win/rules.vc b/win/rules.vc index 7ae345b..f94c894 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -38,6 +38,8 @@ _RULES_VC = 1 # 12. Set up the actual options passed to compiler and linker based
# on the information gathered above.
# 13. Define some standard build targets and implicit rules.
+# 14. (For extensions only.) Compare the configuration of the target
+# Tcl and the extensions and warn against discrepancies.
#
# One final note about the macro names used. They are as they are
# for historical reasons. We would like legacy extensions to
@@ -120,13 +122,24 @@ PROGRAMFILES_X86 = $(PROGRAMFILES) ROOT = $(MAKEDIR)\..
# The following paths CANNOT have spaces in them as they appear on the
# left side of implicit rules.
+!ifndef COMPATDIR
COMPATDIR = $(ROOT)\compat
+!endif
+!ifndef DOCDIR
DOCDIR = $(ROOT)\doc
+!endif
+!ifndef GENERICDIR
GENERICDIR = $(ROOT)\generic
+!endif
+!ifndef TOOLSDIR
TOOLSDIR = $(ROOT)\tools
+!endif
+# Do NOT enclose WINDIR in a !ifndef because Windows always defines
+# WINDIR env var to point to c:\windows!
+# TBD - This is a potentially dangerous conflict, rename WINDIR to
+# something else
WINDIR = $(ROOT)\win
-
# The target directory where the built packages and binaries will be installed.
# INSTALLDIR is the (optional) path specified by the user.
# _INSTALLDIR is INSTALLDIR using the backslash separator syntax
@@ -367,8 +380,8 @@ NMAKEHLPC = nmakehlp.c !if "$(PROJECT)" != "tcl"
!if $(TCLINSTALL)
-!if exist("$(_TCLDIR)\lib\config.nmake\nmakehlp.c")
-NMAKEHLPC = $(_TCLDIR)\lib\config.nmake\nmakehlp.c
+!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c")
+NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c
!endif
!else # ! $(TCLINSTALL)
!if exist("$(_TCLDIR)\win\nmakehlp.c")
@@ -1123,17 +1136,15 @@ default_target: $(DEFAULT_BUILD_TARGET) clean:
@echo Cleaning $(TMP_DIR)\* ...
@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
- @echo Cleaning $(WINDIR)\nmakehlp.obj ...
+ @echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ...
@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
- @echo Cleaning $(WINDIR)\nmakehlp.exe ...
@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
@echo Cleaning $(WINDIR)\_junk.pch ...
@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
- @echo Cleaning $(WINDIR)\vercl.x ...
+ @echo Cleaning $(WINDIR)\vercl.x, vercl.i ...
@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
- @echo Cleaning $(WINDIR)\vercl.i ...
@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
- @echo Cleaning $(WINDIR)\versions.vc ...
+ @echo Cleaning $(WINDIR)\versions.vc, version.vc ...
@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
@@ -1168,6 +1179,43 @@ MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs)
MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs)
+################################################################
+# 14. Sanity check selected options against Tcl build options
+# When building an extension, certain configuration options should
+# match the ones used when Tcl was built. Here we check and
+# warn on a mismatch.
+!if "$(PROJECT)" != "tcl"
+
+!if $(TCLINSTALL) # Building against an installed Tcl
+!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake")
+TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake"
+!endif
+!else # ! $(TCLINSTALL) - building against Tcl source
+!if exist("$(OUT_DIR)\tcl.nmake")
+TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake"
+!endif
+!endif # TCLINSTALL
+
+!if ! $(DISABLE_CONFIG_CHECKS)
+!ifdef TCLNMAKECONFIG
+!include $(TCLMAKECONFIG)
+
+!if defined(CORE_MACHINE) && $(CORE_MACHINE) != $(MACHINE)
+!error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)).
+!endif
+!if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC)
+!message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)).
+!endif
+!if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG)
+!message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)).
+!endif
+!endif
+
+!endif # TCLNMAKECONFIG
+
+!endif # $(PROJECT) == "tcl"
+
+
#----------------------------------------------------------
# Display stats being used.
#----------------------------------------------------------
|