summaryrefslogtreecommitdiffstats
path: root/win/makefile.vc
diff options
context:
space:
mode:
Diffstat (limited to 'win/makefile.vc')
-rw-r--r--win/makefile.vc156
1 files changed, 103 insertions, 53 deletions
diff --git a/win/makefile.vc b/win/makefile.vc
index 8557923..584a11b 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -43,22 +43,27 @@ the build instructions.
#
# 3) Targets are:
# release -- Builds the core, the shell. (default)
-# core -- Only builds the core.
+# dlls -- Just builds the windows extensions.
+# shell -- Just builds the shell and the core.
+# core -- Only builds the core [tkXX.(dll|lib)].
# all -- Builds everything.
# test -- Builds and runs the test suite.
# tktest -- Just builds the binaries for the test suite.
# install -- Installs the built binaries and libraries to $(INSTALLDIR)
# as the root of the install tree.
# cwish -- Builds a console version of wish.
-# clean -- Removes the contents of $(TMP_DIR)
-# hose -- Removes the contents of $(TMP_DIR) and $(OUT_DIR)
+# tidy/clean/hose -- varying levels of cleaning.
# genstubs -- Rebuilds the Stubs table and support files (dev only).
# depend -- Generates an accurate set of source dependancies for this
# makefile. Helpful to avoid problems when the sources are
# refreshed and you rebuild, but can "overbuild" when common
# headers like tkInt.h just get small changes.
-# winhelp -- builds the windows .hlp file for Tcl from the troff man
-# files.
+# htmlhelp -- Builds a Windows .chm help file for Tcl and Tk from the
+# troff manual pages found in $(ROOT)\doc. You need to
+# have installed the HTML Help Compiler package from Microsoft
+# to produce the .chm file.
+# winhelp -- Builds the windows .hlp file for Tcl from the troff man
+# files found in $(ROOT)\doc.
#
# 4) Macros usable on the commandline:
# TCLDIR=<path>
@@ -78,19 +83,18 @@ the build instructions.
#
# loimpact = Adds a flag for how NT treats the heap to keep memory
# in use, low. This is said to impact alloc performance.
-# msvcrt = Affects the static option only to switch it from
+# msvcrt = Affects the static option only to switch it from
# using libcmt(d) as the C runtime [by default] to
# msvcrt(d). This is useful for static embedding
# support.
-# nothreads = Turns off full multithreading support.
+# nothreads= Turns off full multithreading support.
# noxp = If you do not have the uxtheme.h header then you
# cannot include support for XP themeing.
# square = Include the demo square widget.
-# static = Builds a static library of the core instead of a
+# static = Builds a static library of the core instead of a
# dll. The shell will be static (and large), as well.
-# staticpkg = Affects the static option only to switch
-# wishXX.exe to have the dde and reg extension linked
-# inside it.
+# staticpkg= Affects the static option only to switch wishXX.exe
+# to have the dde and reg extension linked inside it.
# pdbs = Build detached symbols for release builds.
# profile = Adds profiling hooks. Map file is assumed.
# thrdalloc = Use the thread allocator (shared global free pool)
@@ -102,29 +106,30 @@ the build instructions.
# enabled runtime (msvcrt.dll not msvcrtd.dll
# or libcmt.lib not libcmtd.lib).
#
-# STATS=memdbg,compdbg,none
+# STATS=compdbg,memdbg,none
# Sets optional memory and bytecode compiler debugging code added
# to the core. The default is for none. Any combination of the
# above may be used (comma separated). 'none' will over-ride
# everything to nothing.
#
-# memdbg = Enables the debugging memory allocator.
# compdbg = Enables byte compilation logging.
+# memdbg = Enables the debugging memory allocator.
#
-# CHECKS=nodep,fullwarn,64bit,none
+# CHECKS=64bit,fullwarn,nodep,none
# Sets special macros for checking compatability.
#
-# nodep = Turns off compatability macros to ensure Tk isn't
-# being built with deprecated functions.
+# 64bit = Enable 64bit portability warnings (if available)
# fullwarn = Builds with full compiler and link warnings enabled.
# Very verbose.
-# 64bit = Enable 64bit portability warnings (if available)
+# nodep = Turns off compatability macros to ensure the core
+# isn't being built with deprecated functions.
#
# MACHINE=(ALPHA|AMD64|IA64|IX86)
# Set the machine type used for the compiler, linker, and
# resource compiler. This hook is needed to tell the tools
# when alternate platforms are requested. IX86 is the default
-# when not specified.
+# when not specified. If the CPU environment variable has been
+# set (ie: recent Platform SDK) then MACHINE is set from CPU.
#
# TMP_DIR=<path>
# OUT_DIR=<path>
@@ -177,7 +182,7 @@ Please `cd` to its location first.
!error $(MSG)
!endif
-PROJECT = tk
+PROJECT = tk
!include "rules.vc"
!if $(TCLINSTALL)
@@ -237,7 +242,6 @@ WISHOBJS = \
!if $(TCL_USE_STATIC_PACKAGES)
$(TCLDDELIB) \
$(TCLREGLIB) \
- $(TCLSTUBLIB) \
!endif
$(TMP_DIR)\wish.res
@@ -361,7 +365,7 @@ TKOBJS = \
$(TMP_DIR)\tkVisual.obj \
$(TMP_DIR)\tkStubInit.obj \
$(TMP_DIR)\tkWindow.obj \
- $(TTK_OBJS) \
+ $(TTK_OBJS) \
!if !$(STATIC_BUILD)
$(TMP_DIR)\tk.res
!endif
@@ -402,7 +406,8 @@ TTK_OBJS = \
$(TMP_DIR)\ttkStubInit.obj
TKSTUBOBJS = \
- $(TMP_DIR)\tkStubLib.obj $(TMP_DIR)\ttkStubLib.obj
+ $(TMP_DIR)\tkStubLib.obj \
+ $(TMP_DIR)\ttkStubLib.obj
WINDIR = $(ROOT)\win
@@ -442,7 +447,7 @@ cdebug = $(OPTIMIZATIONS)
cdebug =
!endif
!if $(SYMBOLS)
-cdebug = $(cdebug) -Zi
+cdebug = $(cdebug) -Zi
!endif
!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
### Warnings are too many, can't support warnings into errors.
@@ -470,15 +475,10 @@ crt = -MT
!endif
BASE_CFLAGS = $(cdebug) $(cflags) $(crt) $(TK_INCLUDES)
-TK_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES)
+TK_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES) -DUSE_TCL_STUBS
CON_CFLAGS = $(cdebug) $(cflags) $(crt) -DCONSOLE
WISH_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES)
-### Stubs files should not be compiled with -GL
-STUB_CFLAGS = $(cflags) $(cdebug:-GL=) $(TK_DEFINES)
-
-!if !$(STATIC_BUILD)
-TK_CFLAGS = $(TK_CFLAGS) -DUSE_TCL_STUBS
-!endif
+STUB_CFLAGS = $(cflags) $(cdebug) $(TK_DEFINES)
#---------------------------------------------------------------------
# Link flags
@@ -516,10 +516,7 @@ dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows
-tcllibs = $(TCLIMPLIB)
-!if !$(STATIC_BUILD)
-tcllibs = $(TCLSTUBLIB) $(tcllibs)
-!endif
+tcllibs = $(TCLSTUBLIB) $(TCLIMPLIB)
baselibs = netapi32.lib kernel32.lib user32.lib advapi32.lib ws2_32.lib
# Avoid 'unresolved external symbol __security_cookie' errors.
@@ -537,7 +534,7 @@ guilibs = $(baselibs) gdi32.lib
#---------------------------------------------------------------------
!if "$(TESTPAT)" != ""
-TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
+TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif
@@ -564,11 +561,7 @@ test-classic: setup $(TKTEST) $(TKLIB) $(CAT32)
!else
@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
!endif
-!if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE"
- $(DEBUGGER) $(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) | $(CAT32)
-!else
- $(DEBUGGER) $(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) | $(CAT32)
-!endif
+ $(DEBUGGER) $(TKTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) | $(CAT32)
test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@@ -579,11 +572,7 @@ test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32)
!else
@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
!endif
-!if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE"
- $(DEBUGGER) $(TKTEST) "$(ROOT)/tests/ttk/all.tcl" $(TESTFLAGS) | $(CAT32)
-!else
- $(DEBUGGER) $(TKTEST) "$(ROOT)/tests/ttk/all.tcl" $(TESTFLAGS) | $(CAT32)
-!endif
+ $(DEBUGGER) $(TKTEST) "$(ROOT:\=/)/tests/ttk/all.tcl" $(TESTFLAGS) | $(CAT32)
runtest: setup $(TKTEST) $(TKLIB) $(CAT32)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@@ -605,7 +594,7 @@ rundemo: setup $(TKTEST) $(TKLIB) $(CAT32)
!else
@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
!endif
- $(TKTEST) $(ROOT)\library\demos\widget
+ $(TKTEST) $(ROOT:\=/)\library\demos\widget
shell: setup $(WISH)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@@ -620,6 +609,17 @@ shell: setup $(WISH)
console show
<<
+dbgshell: setup $(WISH)
+ @set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
+ @set TK_LIBRARY=$(TK_LIBRARY:\=/)
+ @set TCLLIBPATH=
+!if $(TCLINSTALL)
+ @set PATH=$(_TCLDIR)\bin;$(PATH)
+!else
+ @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
+!endif
+ windbg $(WISH)
+
setup:
@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
@@ -682,9 +682,49 @@ genstubs:
#---------------------------------------------------------------------
-# Regenerate the windows help files.
+# Build the Windows HTML help file.
#---------------------------------------------------------------------
+# NOTE: you can define HHC on the command-line to override this
+!ifndef HHC
+HHC=""%ProgramFiles%\HTML Help Workshop\hhc.exe""
+!endif
+HTMLDIR=$(ROOT)\html
+HTMLBASE=TclTk$(VERSION)
+HHPFILE=$(HTMLDIR)\$(HTMLBASE).hhp
+CHMFILE=$(HTMLDIR)\$(HTMLBASE).chm
+
+htmlhelp: chmsetup $(CHMFILE)
+
+$(CHMFILE): $(DOCDIR)\*
+ @$(TCLSH) $(TOOLSDIR)\tcltk-man2html.tcl
+ @echo Compiling HTML help project
+ @$(HHC) <<$(HHPFILE) >NUL
+[OPTIONS]
+Compatibility=1.1 or later
+Compiled file=$(HTMLBASE).chm
+Display compile progress=no
+Error log file=$(HTMLBASE).log
+Language=0x409 English (United States)
+Title=Tcl/Tk $(DOT_VERSION) Help
+[FILES]
+contents.htm
+docs.css
+Keywords
+TclCmd
+TclLib
+TkCmd
+TkLib
+UserCmd
+<<
+
+chmsetup:
+ @if not exist $(HTMLDIR)\nul mkdir $(HTMLDIR)
+
+#-------------------------------------------------------------------------
+# Build the old-style Windows .hlp file
+#-------------------------------------------------------------------------
+
HLPBASE = $(PROJECT)$(TK_VERSION)
HELPFILE = $(OUT_DIR)\$(HLPBASE).hlp
HELPCNT = $(OUT_DIR)\$(HLPBASE).cnt
@@ -811,11 +851,15 @@ $(TMP_DIR)\tkStubLib.obj : $(GENERICDIR)\tkStubLib.c
$(TMP_DIR)\wish.exe.manifest: $(WINDIR)\wish.exe.manifest.in
@nmakehlp -s << $** >$@
@MACHINE@ $(MACHINE:IX86=X86)
-@TK_WIN_VERSION@ $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION).0.0
+@TK_WIN_VERSION@ $(TK_DOTVERSION).0.0
<<
#---------------------------------------------------------------------
-# Generate the makefile depedancies.
+# Generate the source dependencies. Having dependency rules will
+# improve incremental build accuracy without having to resort to a
+# full rebuild just because some non-global header file like
+# tclCompile.h was changed. These rules aren't needed when building
+# from scratch.
#---------------------------------------------------------------------
depend:
@@ -823,7 +867,7 @@ depend:
@echo Build tclsh first!
!else
set TCL_LIBRARY=$(TCL_LIBRARY)
- $(TCLSH) $(TCLTOOLSDIR)\mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \
+ $(TCLSH) $(TCLTOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \
-passthru:"-DBUILD_tk $(TK_INCLUDES)" $(GENERICDIR),$$(GENERICDIR) \
$(WINDIR),$$(WINDIR) $(TTKDIR),$$(TTKDIR) $(XLIBDIR),$$(XLIBDIR) \
$(BITMAPDIR),$$(BITMAPDIR) @<<
@@ -831,7 +875,6 @@ $(TKOBJS)
<<
!endif
-
#---------------------------------------------------------------------
# Dependency rules
#---------------------------------------------------------------------
@@ -909,8 +952,13 @@ install-binaries:
!if !$(STATIC_BUILD)
@echo creating package index
@type << > $(OUT_DIR)\pkgIndex.tcl
-if {[package vcompare [package provide Tcl] $(TCL_PATCH_LEVEL)] != 0} { return }
-package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk]
+if {[catch {package present Tcl $(TCL_PATCH_LEVEL)}]} { return }
+if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)]
+ || ([info exists ::argv] && ("-display" in $$::argv)))} {
+ package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(TK_DOTVERSION).dll] Tk]
+} else {
+ package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk]
+}
<<
@$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)\"
!endif
@@ -972,6 +1020,8 @@ clean:
@echo Cleaning $(WINDIR)\versions.vc ...
@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
+realclean: hose
+
hose:
@echo Hosing $(OUT_DIR)\* ...
@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)