summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2017-10-26 15:07:16 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2017-10-26 15:07:16 (GMT)
commitc324bb3effc60b384c19e243194f0bd3a4a61b35 (patch)
treeef2de1f1845ad77b7492fd5970cb97c546af6822 /win
parentff1c34897080fdd52c75ac01a0e020d0e8e3c557 (diff)
downloadtcl-c324bb3effc60b384c19e243194f0bd3a4a61b35.zip
tcl-c324bb3effc60b384c19e243194f0bd3a4a61b35.tar.gz
tcl-c324bb3effc60b384c19e243194f0bd3a4a61b35.tar.bz2
Reworked build command macros (MAKEBINCMD, CCPKGCMD etc.) and purged old comments.
Diffstat (limited to 'win')
-rw-r--r--win/makefile.vc40
-rw-r--r--win/rules-ext.vc5
-rw-r--r--win/rules.vc96
-rw-r--r--win/targets.vc19
4 files changed, 110 insertions, 50 deletions
diff --git a/win/makefile.vc b/win/makefile.vc
index 95161a8..7759fc3 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -17,7 +17,7 @@
# nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]]
#
# For MACRODEF, see TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md)
-# or examine Steps 6-8 in rules.vc.
+# or examine Sections 6-8 in rules.vc.
#
# Possible values of TARGET are:
# release -- Builds the core, the shell and the dlls. (default)
@@ -40,7 +40,6 @@
# have installed the HTML Help Compiler package from Microsoft
# to produce the .chm file.
#
-#
# The steps to setup a Visual C++ environment depend on which
# version of Visual Studio and/or the Windows SDK you are building
# against and are not described here. The simplest method is generally
@@ -397,42 +396,53 @@ runshell: setup $(TCLSH) dlls
set TCL_LIBRARY=$(ROOT:\=/)/library
$(DEBUGGER) $(TCLSH) $(SCRIPT)
-!if !$(STATIC_BUILD)
-$(TCLIMPLIB): $(TCLLIB)
-!endif
+!if $(STATIC_BUILD)
+
+$(TCLLIB): $(TCLOBJS)
+ $(LIBCMD) @<<
+$**
+<<
+
+!else
$(TCLLIB): $(TCLOBJS)
- $(MAKEBINCMD) @<<
+ $(DLLCMD) @<<
$**
<<
$(_VC_MANIFEST_EMBED_DLL)
+$(TCLIMPLIB): $(TCLLIB)
+
+!endif # $(STATIC_BUILD)
+
$(TCLSTUBLIB): $(TCLSTUBOBJS)
- $(MAKELIBCMD) -nodefaultlib $(TCLSTUBOBJS)
+ $(LIBCMD) -nodefaultlib $(TCLSTUBOBJS)
$(TCLSH): $(TCLSHOBJS) $(TCLSTUBLIB) $(TCLIMPLIB)
- $(MAKECONCMD) -stack:2300000 $**
+ $(CONEXECMD) -stack:2300000 $**
$(_VC_MANIFEST_EMBED_EXE)
$(TCLTEST): $(TCLTESTOBJS) $(TCLSTUBLIB) $(TCLIMPLIB)
- $(MAKECONCMD) -stack:2300000 $**
+ $(CONEXECMD) -stack:2300000 $**
$(_VC_MANIFEST_EMBED_EXE)
!if $(STATIC_BUILD)
$(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj
+ $(LIBCMD) $**
!else
$(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB)
-!endif
- $(MAKEBINCMD) $**
+ $(DLLCMD) $**
$(_VC_MANIFEST_EMBED_DLL)
+!endif
!if $(STATIC_BUILD)
$(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj
+ $(LIBCMD) $**
!else
$(TCLREGLIB): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB)
-!endif
- $(MAKEBINCMD) $**
+ $(DLLCMD) $**
$(_VC_MANIFEST_EMBED_DLL)
+!endif
pkgs:
@for /d %d in ($(PKGSDIR)\*) do \
@@ -467,8 +477,8 @@ clean-pkgs:
)
$(CAT32): $(WINDIR)\cat.c
- $(cc32) $(cflags) $(crt) -DCONSOLE -Fo$(TMP_DIR)\ $?
- $(MAKECONCMD) -stack:16384 $(TMP_DIR)\cat.obj
+ $(cc32) $(cflags) $(crt) -D_CRT_NONSTDC_NO_DEPRECATE -DCONSOLE -Fo$(TMP_DIR)\ $?
+ $(CONEXECMD) -stack:16384 $(TMP_DIR)\cat.obj
$(_VC_MANIFEST_EMBED_EXE)
#---------------------------------------------------------------------
diff --git a/win/rules-ext.vc b/win/rules-ext.vc
index 97c11b4..e0a363c 100644
--- a/win/rules-ext.vc
+++ b/win/rules-ext.vc
@@ -1,5 +1,10 @@
+#------------------------------------------------------------- -*- makefile -*-
+# rules-ext.vc --
+#
+# Part of the nmake based build system for Tcl and its extensions.
# This file should only be included in makefiles for Tcl extensions,
# NOT in the makefile for Tcl itself.
+# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs.
!ifndef _RULES_EXT_VC
diff --git a/win/rules.vc b/win/rules.vc
index 6bdfa8a..5e98d77 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -1,8 +1,13 @@
#------------------------------------------------------------- -*- makefile -*-
# rules.vc --
#
-# Microsoft Visual C++ makefile include for decoding the commandline
-# macros. This file does not need editing to build Tcl.
+# Part of the nmake based build system for Tcl and its extensions.
+# This file does all the hard work in terms of parsing build options,
+# compiler switches, defining common targets and macros. The Tcl makefile
+# directly includes this. Extensions include it via "rules-ext.vc".
+#
+# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
+# detailed documentation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,6 +21,8 @@
_RULES_VC = 1
# The following macros define the version of the rules.vc nmake build system
+# For modifications that are not backward-compatible, you *must* change
+# the major version.
RULES_VERSION_MAJOR = 1
RULES_VERSION_MINOR = 0
@@ -32,8 +39,21 @@ DOING_TCL = 1
DOING_TK = 1
!endif
-!ifndef PROJECT_REQUIRES_TK
-PROJECT_REQUIRES_TK = 0
+!ifndef NEED_TK
+# Backwards compatibility
+!ifdef PROJECT_REQUIRES_TK
+NEED_TK = $(PROJECT_REQUIRES_TK)
+!else
+NEED_TK = 0
+!endif
+!endif
+
+!ifndef NEED_TCL_SOURCE
+NEED_TCL_SOURCE = 0
+!endif
+
+!ifndef NEED_TK_SOURCE
+NEED_TK_SOURCE = 0
!endif
################################################################
@@ -266,7 +286,7 @@ Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and defa
!endif
# Now do the same to locate Tk headers and libs if project requires Tk
-!if $(PROJECT_REQUIRES_TK)
+!if $(NEED_TK)
!ifdef TKDIR
@@ -301,7 +321,24 @@ Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and defaul
!error $(MSG)
!endif
-!endif # PROJECT_REQUIRES_TK
+!endif # NEED_TK
+
+!if $(NEED_TCL_SOURCE) && $(TCLINSTALL)
+MSG = ^
+*** Warning: This extension requires the source distribution of Tcl.^
+*** Please set the TCLDIR macro to point to the Tcl sources.
+!error $(MSG)
+!endif
+
+!if $(NEED_TK_SOURCE)
+!if $(TKINSTALL)
+MSG = ^
+*** Warning: This extension requires the source distribution of Tk.^
+*** Please set the TKDIR macro to point to the Tk sources.
+!error $(MSG)
+!endif
+!endif
+
# If INSTALLDIR set to tcl installation root dir then reset to the
# lib dir for installing extensions
@@ -1026,7 +1063,7 @@ TCLSH_NATIVE = $(TCLSH)
!endif
# Do the same for Tk and Tk extensions that require the Tk libraries
-!if $(DOING_TK) || $(PROJECT_REQUIRES_TK)
+!if $(DOING_TK) || $(NEED_TK)
WISHNAMEPREFIX = wish
WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
@@ -1040,7 +1077,7 @@ TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME)
TKLIB = $(OUT_DIR)\$(TKLIBNAME)
TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)"
-!else # effectively PROJECT_REQUIRES_TK
+!else # effectively NEED_TK
!if $(TKINSTALL) # Building against installed Tk
WISH = $(_TKDIR)\bin\$(WISHNAME)
@@ -1056,7 +1093,7 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)"
!endif # $(DOING_TK)
-!endif # $(DOING_TK) || $(PROJECT_REQUIRES_TK)
+!endif # $(DOING_TK) || $(NEED_TK)
# Various output paths
PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
@@ -1158,7 +1195,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED
# test targets in tk do not use stubs
!if ! $(DOING_TCL)
USE_STUBS_DEFS = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS
-!if $(PROJECT_REQUIRES_TK)
+!if $(NEED_TK)
USE_STUBS_DEFS = $(USE_STUBS_DEFS) -DUSE_TK_STUBS
!endif
!endif
@@ -1333,7 +1370,7 @@ guilflags = $(lflags) -subsystem:windows
# Extensions should define any additional libraries with $(PRJ_LIBS)
winlibs = kernel32.lib advapi32.lib
-!if $(PROJECT_REQUIRES_TK)
+!if $(NEED_TK)
winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib
!endif
@@ -1352,19 +1389,18 @@ baselibs = $(baselibs) ucrt.lib
!endif
################################################################
-# 3. Define standard commands, common make targets and implicit rules
+# 13. Define standard commands, common make targets and implicit rules
-MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@
-MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
+CCPKGCMD = $(cc32) $(pkgcflags) -Fo$(TMP_DIR)^\
+CCAPPCMD = $(cc32) $(appcflags) -Fo$(TMP_DIR)^\
+CCSTUBSCMD = $(cc32) $(stubscflags) -Fo$(TMP_DIR)^\
-!if $(STATIC_BUILD)
-MAKEBINCMD = $(MAKELIBCMD)
-!else
-MAKEBINCMD = $(MAKEDLLCMD)
-!endif
-MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
-MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
-MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
+LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@
+DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
+
+CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
+GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
+RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
$(TCL_INCLUDES) \
-DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
-DCOMMAVERSION=$(DOTVERSION:.=,),0 \
@@ -1466,7 +1502,7 @@ default-shell: default-setup $(PROJECT)
!ifdef PRJ_RCFILE
$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc
- $(MAKERESCMD) $**
+ $(RESCMD) $**
!else
# If parent makefile has not defined a resource definition file,
@@ -1520,33 +1556,33 @@ DISABLE_IMPLICIT_RULES = 0
# main application, the master makefile should define explicit rules.
{$(ROOT)}.c{$(TMP_DIR)}.obj::
- $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
+ $(CCPKGCMD) @<<
$<
<<
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
- $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
+ $(CCPKGCMD) @<<
$<
<<
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
- $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
+ $(CCPKGCMD) @<<
$<
<<
{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
- $(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
+ $(CCPKGCMD) @<<
$<
<<
{$(RCDIR)}.rc{$(TMP_DIR)}.res:
- $(MAKERESCMD) $<
+ $(RESCMD) $<
{$(WINDIR)}.rc{$(TMP_DIR)}.res:
- $(MAKERESCMD) $<
+ $(RESCMD) $<
{$(TMP_DIR)}.rc{$(TMP_DIR)}.res:
- $(MAKERESCMD) $<
+ $(RESCMD) $<
.SUFFIXES:
.SUFFIXES:.c .rc
diff --git a/win/targets.vc b/win/targets.vc
index dbe4b82..a345b4f 100644
--- a/win/targets.vc
+++ b/win/targets.vc
@@ -1,15 +1,21 @@
#------------------------------------------------------------- -*- makefile -*-
+# targets.vc --
+#
+# Part of the nmake based build system for Tcl and its extensions.
+# This file defines some standard targets for the convenience of extensions
+# and can be optionally included by the extension makefile.
+# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs.
$(PROJECT): setup pkgindex $(PRJLIB)
!ifdef PRJ_STUBOBJS
$(PROJECT): $(PRJSTUBLIB)
$(PRJSTUBLIB): $(PRJ_STUBOBJS)
- $(MAKELIBCMD) $**
+ $(LIBCMD) $**
$(PRJ_STUBOBJS):
- $(cc32) $(stubscflags) -Fo$(TMP_DIR)\ %s
-!endif
+ $(CCSTUBSCMD) %s
+!endif # PRJ_STUBOBJS
!ifdef PRJ_MANIFEST
$(PROJECT): $(PRJLIB).manifest
@@ -19,13 +25,16 @@ $(PRJLIB).manifest: $(PRJ_MANIFEST)
<<
!endif
-
!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
# MAKEBINCMD will do shared, static and debug links as appropriate
# _VC_MANIFEST_EMBED_DLL embeds the manifest for shared libraries
# and is a no-op for static libraries
$(PRJLIB): $(PRJ_OBJS) $(RESFILE)
- $(MAKEBINCMD) $**
+!if $(STATIC_BUILD)
+ $(LIBCMD) $**
+!else
+ $(DLLCMD) $**
+!endif
$(_VC_MANIFEST_EMBED_DLL)
-@del $*.exp
!endif