1#------------------------------------------------------------------------------
2# makefile.vc --
3#
4#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
5#
6# See the file "license.terms" for information on usage and redistribution
7# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8#
9# Copyright (c) 1995-1996 Sun Microsystems, Inc.
10# Copyright (c) 1998-2000 Ajuba Solutions.
11# Copyright (c) 2001 ActiveState Corporation.
12# Copyright (c) 2001-2002 David Gravereaux.
13#
14#------------------------------------------------------------------------------
15# RCS: @(#) $Id: makefile.vc,v 1.67.2.5 2003/11/17 02:20:20 dgp Exp $
16#------------------------------------------------------------------------------
17
18!if "$(MSVCDIR)" == ""
19MSG = ^
20You'll need to run vcvars32.bat from Developer Studio, first, to setup^
21the environment.  Jump to this line to read the new instructions.
22!error $(MSG)
23!endif
24
25#------------------------------------------------------------------------------
26# HOW TO USE this makefile:
27#
28# 1)  It is now necessary to have MSVCDir set in the environment.  This is used
29#     as a check to see if vcvars32.bat had been run prior to running nmake or
30#     during the install of Microsoft Developer Studio, MSVCDir had been set
31#     globally and the PATH adjusted.  Either way is valid.
32#
33#     You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
34#     directory to setup the proper environment, if needed, for your current
35#     setup.  This is a needed bootstrap requirement and allows the swapping of
36#     different environments to be easier.
37#
38# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
39#     vcvars32.bat according to the instructions for it.  This can also turn on
40#     the 64-bit compiler, if your SDK has it.
41#
42# 3)  Targets are:
43#	release  -- builds the core, the shell. (default)
44#	core     -- Only builds the core.
45#	all      -- builds everything.
46#	test     -- builds and runs the test suite.
47#	tktest   -- just builds the binaries for the test suite.
48#	install  -- installs the built binaries and libraries to $(INSTALLDIR)
49#		    as the root of the install tree.
50#	cwish    -- builds a console version of wish.
51#	clean    -- removes the contents of $(TMP_DIR)
52#	hose     -- removes the contents of $(TMP_DIR) and $(OUT_DIR)
53#	genstubs -- rebuilds the Stubs table and support files (dev only).
54#	depend   -- Generates an accurate set of source dependencies for this
55#		    makefile.  Helpful to avoid problems when the sources are
56#		    refreshed and you rebuild, but can "overbuild" when common
57#		    headers like tkInt.h just get small changes.
58#	winhelp  -- builds the windows .hlp file for Tcl from the troff man
59#		    files.
60#
61# 4)  Macros usable on the commandline:
62#	TCLDIR=<path>
63#		Sets the location for where to find the Tcl headers and
64#		libraries.  The install point is assumed when not specified.
65#		Tk does need the source directory, though.  Tk comes very close
66#		to not needing the sources, but does, in fact, require them.
67#
68#	INSTALLDIR=<path>
69#		Sets where to install Tcl from the built binaries.
70#		C:\Progra~1\Tcl is assumed when not specified.
71#
72#	OPTS=static,msvcrt,linkexten,threads,symbols,profile,none
73#		Sets special options for the core.  The default is for none.
74#		Any combination of the above may be used (comma separated).
75#		'none' will over-ride everything to nothing.
76#
77#		static  =  Builds a static library of the core instead of a
78#			   dll.  The shell will be static (and large), as well.
79#		msvcrt  =  Effects the static option only to switch it from
80#			   using libcmt(d) as the C runtime [by default] to
81#			   msvcrt(d). This is useful for static embedding
82#			   support.
83#		staticpkg = Affects the static option only to switch wishXX.exe
84#			   to have the dde and reg extension linked inside it.
85#		threads =  Turns on full multithreading support.
86#		thrdalloc = Use the thread allocator (shared global free pool).
87#		symbols =  Adds symbols for step debugging.
88#		profile =  Adds profiling hooks.  Map file is assumed.
89#		loimpact =  Adds a flag for how NT treats the heap to keep memory
90#			   in use, low.  This is said to impact alloc performance.
91#
92#	STATS=memdbg,compdbg,none
93#		Sets optional memory and bytecode compiler debugging code added
94#		to the core.  The default is for none.  Any combination of the
95#		above may be used (comma separated).  'none' will over-ride
96#		everything to nothing.
97#
98#		memdbg   = Enables the debugging memory allocator.
99#		compdbg  = Enables byte compilation logging.
100#
101#	MACHINE=(IX86|IA64|ALPHA)
102#		Set the machine type used for the compiler, linker, and
103#		resource compiler.  This hook is needed to tell the tools
104#		when alternate platforms are requested.  IX86 is the default
105#		when not specified.
106#
107#	TMP_DIR=<path>
108#	OUT_DIR=<path>
109#		Hooks to allow the intermediate and output directories to be
110#		changed.  $(OUT_DIR) is assumed to be
111#		$(BINROOT)\(Release|Debug) based on if symbols are requested.
112#		$(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
113#
114#	TESTPAT=<file>
115#		Reads the tests requested to be run from this file.
116#
117# 5)  Examples:
118#
119#	Basic syntax of calling nmake looks like this:
120#	nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
121#
122#                        Standard (no frills)
123#       c:\tk_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
124#       Setting environment for using Microsoft Visual C++ tools.
125#       c:\tk_src\win\>nmake -f makefile.vc release
126#       c:\tk_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
127#
128#                         Building for Win64
129#       c:\tk_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
130#       Setting environment for using Microsoft Visual C++ tools.
131#       c:\tk_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
132#       Targeting Windows pre64 RETAIL
133#       c:\tk_src\win\>nmake -f makefile.vc MACHINE=IA64
134#
135#------------------------------------------------------------------------------
136#==============================================================================
137###############################################################################
138
139
140#    //==================================================================\\
141#   >>[               -> Do not modify below this line. <-               ]<<
142#   >>[  Please, use the commandline macros to modify how Tcl is built.  ]<<
143#   >>[  If you need more features, send us a patch for more macros.     ]<<
144#    \\==================================================================//
145
146
147###############################################################################
148#==============================================================================
149#------------------------------------------------------------------------------
150
151!if !exist("makefile.vc")
152MSG = ^
153You must run this makefile only from the directory it is in.^
154Please `cd` to its location first.
155!error $(MSG)
156!endif
157
158PROJECT	= tk
159!include "rules.vc"
160
161!if $(TCLINSTALL)
162!message *** Warning: Tk requires the source distribution of Tcl to build from,
163!message ***    at this time, sorry.  Please set the TCLDIR macro to point to the
164!message ***    Tcl sources.
165!endif
166
167STUBPREFIX = $(PROJECT)stub
168DOTVERSION = 8.4
169VERSION = $(DOTVERSION:.=)
170WISHNAMEPREFIX = wish
171
172BINROOT		= .
173ROOT		= ..
174
175#TCLIMPLIBNAME	= tcl$(VERSION)$(SUFX).lib
176#TCLLIB	= tcl$(VERSION)$(SUFX).$(EXT)
177#TCLSTUBLIBNAME	= tclstub$(VERSION).lib
178
179TKIMPLIB	= "$(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib"
180TKLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
181TKLIB		= "$(OUT_DIR)\$(TKLIBNAME)"
182
183TKSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
184TKSTUBLIB	= "$(OUT_DIR)\$(TKSTUBLIBNAME)"
185
186WISH 		= "$(OUT_DIR)\$(WISHNAMEPREFIX)$(VERSION)$(SUFX).exe"
187WISHC 		= "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe"
188
189TKTEST		= "$(OUT_DIR)\$(PROJECT)test.exe"
190CAT32		= "$(OUT_DIR)\cat32.exe"
191
192LIB_INSTALL_DIR		= $(_INSTALLDIR)\lib
193BIN_INSTALL_DIR		= $(_INSTALLDIR)\bin
194DOC_INSTALL_DIR		= $(_INSTALLDIR)\doc
195SCRIPT_INSTALL_DIR	= $(_INSTALLDIR)\lib\$(PROJECT)$(DOTVERSION)
196INCLUDE_INSTALL_DIR	= $(_INSTALLDIR)\include
197
198WISHOBJS = \
199	$(TMP_DIR)\winMain.obj \
200!if $(TCL_USE_STATIC_PACKAGES)
201	$(TCLDDELIB) \
202	$(TCLREGLIB) \
203!endif
204	$(TMP_DIR)\wish.res
205
206TKTESTOBJS = \
207	$(TMP_DIR)\tkTest.obj \
208	$(TMP_DIR)\tkSquare.obj \
209	$(TMP_DIR)\testMain.obj \
210	$(TMP_DIR)\tkWinTest.obj
211
212XLIBOBJS = \
213	$(TMP_DIR)\xcolors.obj \
214	$(TMP_DIR)\xdraw.obj \
215	$(TMP_DIR)\xgc.obj \
216	$(TMP_DIR)\ximage.obj \
217	$(TMP_DIR)\xutil.obj
218
219TKOBJS = \
220	$(TMP_DIR)\tkConsole.obj \
221	$(TMP_DIR)\tkUnixMenubu.obj \
222	$(TMP_DIR)\tkUnixScale.obj \
223	$(XLIBOBJS) \
224	$(TMP_DIR)\tkWin3d.obj \
225	$(TMP_DIR)\tkWin32Dll.obj \
226	$(TMP_DIR)\tkWinButton.obj \
227	$(TMP_DIR)\tkWinClipboard.obj \
228	$(TMP_DIR)\tkWinColor.obj \
229	$(TMP_DIR)\tkWinConfig.obj \
230	$(TMP_DIR)\tkWinCursor.obj \
231	$(TMP_DIR)\tkWinDialog.obj \
232	$(TMP_DIR)\tkWinDraw.obj \
233	$(TMP_DIR)\tkWinEmbed.obj \
234	$(TMP_DIR)\tkWinFont.obj \
235	$(TMP_DIR)\tkWinImage.obj \
236	$(TMP_DIR)\tkWinInit.obj \
237	$(TMP_DIR)\tkWinKey.obj \
238	$(TMP_DIR)\tkWinMenu.obj \
239	$(TMP_DIR)\tkWinPixmap.obj \
240	$(TMP_DIR)\tkWinPointer.obj \
241	$(TMP_DIR)\tkWinRegion.obj \
242	$(TMP_DIR)\tkWinScrlbr.obj \
243	$(TMP_DIR)\tkWinSend.obj \
244	$(TMP_DIR)\tkWinWindow.obj \
245	$(TMP_DIR)\tkWinWm.obj \
246	$(TMP_DIR)\tkWinX.obj \
247	$(TMP_DIR)\stubs.obj \
248	$(TMP_DIR)\tk3d.obj \
249	$(TMP_DIR)\tkArgv.obj \
250	$(TMP_DIR)\tkAtom.obj \
251	$(TMP_DIR)\tkBind.obj \
252	$(TMP_DIR)\tkBitmap.obj \
253	$(TMP_DIR)\tkButton.obj \
254	$(TMP_DIR)\tkCanvArc.obj \
255	$(TMP_DIR)\tkCanvBmap.obj \
256	$(TMP_DIR)\tkCanvImg.obj \
257	$(TMP_DIR)\tkCanvLine.obj \
258	$(TMP_DIR)\tkCanvPoly.obj \
259	$(TMP_DIR)\tkCanvPs.obj \
260	$(TMP_DIR)\tkCanvText.obj \
261	$(TMP_DIR)\tkCanvUtil.obj \
262	$(TMP_DIR)\tkCanvWind.obj \
263	$(TMP_DIR)\tkCanvas.obj \
264	$(TMP_DIR)\tkClipboard.obj \
265	$(TMP_DIR)\tkCmds.obj \
266	$(TMP_DIR)\tkColor.obj \
267	$(TMP_DIR)\tkConfig.obj \
268	$(TMP_DIR)\tkCursor.obj \
269	$(TMP_DIR)\tkEntry.obj \
270	$(TMP_DIR)\tkError.obj \
271	$(TMP_DIR)\tkEvent.obj \
272	$(TMP_DIR)\tkFileFilter.obj \
273	$(TMP_DIR)\tkFocus.obj \
274	$(TMP_DIR)\tkFont.obj \
275	$(TMP_DIR)\tkFrame.obj \
276	$(TMP_DIR)\tkGC.obj \
277	$(TMP_DIR)\tkGeometry.obj \
278	$(TMP_DIR)\tkGet.obj \
279	$(TMP_DIR)\tkGrab.obj \
280	$(TMP_DIR)\tkGrid.obj \
281	$(TMP_DIR)\tkImage.obj \
282	$(TMP_DIR)\tkImgBmap.obj \
283	$(TMP_DIR)\tkImgGIF.obj \
284	$(TMP_DIR)\tkImgPPM.obj \
285	$(TMP_DIR)\tkImgPhoto.obj \
286	$(TMP_DIR)\tkImgUtil.obj \
287	$(TMP_DIR)\tkListbox.obj \
288	$(TMP_DIR)\tkMacWinMenu.obj \
289	$(TMP_DIR)\tkMain.obj \
290	$(TMP_DIR)\tkMenu.obj \
291	$(TMP_DIR)\tkMenubutton.obj \
292	$(TMP_DIR)\tkMenuDraw.obj \
293	$(TMP_DIR)\tkMessage.obj \
294	$(TMP_DIR)\tkPanedWindow.obj \
295	$(TMP_DIR)\tkObj.obj \
296	$(TMP_DIR)\tkOldConfig.obj \
297	$(TMP_DIR)\tkOption.obj \
298	$(TMP_DIR)\tkPack.obj \
299	$(TMP_DIR)\tkPlace.obj \
300	$(TMP_DIR)\tkPointer.obj \
301	$(TMP_DIR)\tkRectOval.obj \
302	$(TMP_DIR)\tkScale.obj \
303	$(TMP_DIR)\tkScrollbar.obj \
304	$(TMP_DIR)\tkSelect.obj \
305	$(TMP_DIR)\tkStyle.obj \
306	$(TMP_DIR)\tkText.obj \
307	$(TMP_DIR)\tkTextBTree.obj \
308	$(TMP_DIR)\tkTextDisp.obj \
309	$(TMP_DIR)\tkTextImage.obj \
310	$(TMP_DIR)\tkTextIndex.obj \
311	$(TMP_DIR)\tkTextMark.obj \
312	$(TMP_DIR)\tkTextTag.obj \
313	$(TMP_DIR)\tkTextWind.obj \
314	$(TMP_DIR)\tkTrig.obj \
315	$(TMP_DIR)\tkUndo.obj \
316	$(TMP_DIR)\tkUtil.obj \
317	$(TMP_DIR)\tkVisual.obj \
318	$(TMP_DIR)\tkStubInit.obj \
319	$(TMP_DIR)\tkStubLib.obj \
320	$(TMP_DIR)\tkWindow.obj \
321!if !$(STATIC_BUILD)
322	$(TMP_DIR)\tk.res
323!endif
324
325TKSTUBOBJS = \
326	$(TMP_DIR)\tkStubLib.obj \
327	$(TMP_DIR)\tkStubImg.obj
328
329
330WINDIR          = $(ROOT)\win
331GENERICDIR	= $(ROOT)\generic
332XLIBDIR		= $(ROOT)\xlib
333BITMAPDIR	= $(ROOT)\bitmaps
334DOCDIR		= $(ROOT)\doc
335RCDIR		= $(WINDIR)\rc
336
337!if $(TCLINSTALL)
338TCL_INCLUDES	= -I "$(_TCLDIR)\include"
339!else
340TCL_INCLUDES	= -I "$(_TCLDIR)\win" -I "$(_TCLDIR)\generic"
341!endif
342TK_INCLUDES	= -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(BITMAPDIR)" -I"$(XLIBDIR)" \
343			$(TCL_INCLUDES)
344
345TK_DEFINES	= $(OPTDEFINES)
346
347
348#---------------------------------------------------------------------
349# Compile flags
350#---------------------------------------------------------------------
351
352!if $(DEBUG)
353!if "$(MACHINE)" == "IA64"
354cdebug = -Od -Zi
355!else
356cdebug = -Z7 -Od -WX
357!endif
358!else
359# This cranks the optimization level up.  We can't use -02 because sometimes
360# it causes problems.
361cdebug = -Oti
362!endif
363
364# declarations common to all compiler options
365cflags = -nologo -c -W3 -YX -Fp$(TMP_DIR)^\
366
367!if $(PENT_0F_ERRATA)
368cflags = $(cflags) -QI0f
369!endif
370
371!if $(ITAN_B_ERRATA)
372cflags = $(cflags) -QIA64_Bx
373!endif
374
375!if $(MSVCRT)
376!if "$(DBGX)" == ""
377crt = -MD
378!else
379crt = -MDd
380!endif
381!else
382!if "$(DBGX)" == ""
383crt = -MT
384!else
385crt = -MTd
386!endif
387!endif
388
389BASE_CLFAGS	= $(cdebug) $(cflags) $(crt) $(TK_INCLUDES)
390TK_CFLAGS	= $(BASE_CLFAGS) $(TK_DEFINES) -DUSE_TCL_STUBS
391CON_CFLAGS	= $(cdebug) $(cflags) $(crt) -DCONSOLE
392WISH_CFLAGS	= $(BASE_CLFAGS) $(TK_DEFINES)
393
394
395#---------------------------------------------------------------------
396# Link flags
397#---------------------------------------------------------------------
398
399!if $(DEBUG)
400ldebug	= -debug:full -debugtype:cv
401!else
402ldebug	= -release -opt:ref -opt:icf,3
403!endif
404
405# declarations common to all linker options
406lflags	= -nologo -machine:$(MACHINE) $(ldebug)
407
408!if $(PROFILE)
409lflags	= $(lflags) -profile
410!endif
411
412!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
413# align sections for PE size savings.
414lflags	= $(lflags) -opt:nowin98
415!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
416# align sections for speed in loading by choosing the virtual page size.
417lflags	= $(lflags) -align:4096
418!endif
419
420!if $(LOIMPACT)
421lflags	= $(lflags) -ws:aggressive
422!endif
423
424dlllflags = $(lflags) -dll
425conlflags = $(lflags) -subsystem:console
426guilflags = $(lflags) -subsystem:windows
427
428baselibs  = kernel32.lib advapi32.lib user32.lib
429guilibs	  = $(baselibs) shell32.lib gdi32.lib comdlg32.lib winspool.lib imm32.lib comctl32.lib
430
431
432#---------------------------------------------------------------------
433# TkTest flags
434#---------------------------------------------------------------------
435
436!if "$(TESTPAT)" != ""
437TESTFLAGS   = -file $(TESTPAT)
438!endif
439
440
441#---------------------------------------------------------------------
442# Project specific targets
443#---------------------------------------------------------------------
444
445release:  setup $(TKSTUBLIB) $(WISH)
446all:	  release $(CAT32)
447core:	  setup $(TKSTUBLIB) $(TKLIB)
448cwish:	  $(WISHC)
449install:  install-binaries install-libraries install-docs
450tktest:	  setup $(TKTEST) $(CAT32)
451
452
453test: setup $(TKTEST) $(TKLIB) $(CAT32)
454	set TCL_LIBRARY=$(TCL_LIBRARY)
455!if $(TCLINSTALL)
456	set PATH=$(_TCLDIR)\bin;$(PATH)
457!else
458	set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
459!endif
460!if "$(OS)" == "Windows_NT"  || "$(MSVCDIR)" == "IDE"
461	$(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) | $(CAT32)
462!else
463	$(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) | $(CAT32)
464!endif
465
466runtest: setup $(TKTEST) $(TKLIB) $(CAT32)
467	set TCL_LIBRARY=$(TCL_LIBRARY)
468!if $(TCLINSTALL)
469	set PATH=$(_TCLDIR)\bin;$(PATH)
470!else
471	set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
472!endif
473	$(TKTEST)
474
475rundemo: setup $(TKTEST) $(TKLIB) $(CAT32)
476	set TCL_LIBRARY=$(TCL_LIBRARY)
477!if $(TCLINSTALL)
478	set PATH=$(_TCLDIR)\bin;$(PATH)
479!else
480	set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
481!endif
482	$(TKTEST) $(ROOT)\library\demos\widget
483
484setup:
485	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
486	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
487
488!if !$(STATIC_BUILD)
489$(TKIMPLIB): $(TKLIB)
490!endif
491
492$(TKLIB): $(TKOBJS)
493!if $(STATIC_BUILD)
494	$(lib32) -nologo -out:$@ @<<
495$**
496<<
497!else
498	$(link32) $(dlllflags) -base:@$(COFFBASE),tk -out:$@ $(guilibs) \
499		$(TCLSTUBLIB) @<<
500$**
501<<
502	-@del $*.exp
503!endif
504
505
506$(TKSTUBLIB): $(TKSTUBOBJS)
507	$(lib32) -nologo -out:$@ $**
508
509
510$(WISH): $(WISHOBJS) $(TKIMPLIB)
511	$(link32) $(guilflags) -out:$@ $(guilibs) $(TCLIMPLIB) $**
512
513$(WISHC): $(WISHOBJS) $(TKIMPLIB)
514	$(link32) $(conlflags) -out:$@ $(guilibs) $(TCLIMPLIB) $**
515
516$(TKTEST): $(TKTESTOBJS) $(TKIMPLIB)
517	$(link32) $(guilflags) -out:$@ $(guilibs) $(TCLIMPLIB) $**
518
519
520$(CAT32): $(_TCLDIR)\win\cat.c
521	$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $?
522	$(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj $(baselibs)
523
524install-binaries:
525	@$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\"
526!if $(TKLIB) != $(TKIMPLIB)
527	@$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\"
528!endif
529	@$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\"
530	@$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\"
531!if !$(STATIC_BUILD)
532	@echo Creating package index "$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl"
533	-del "$(SCRIPT_INSTALL_DIR)\pkgIndex.tcl"
534	echo if {[package vcompare [package provide Tcl] $(TCL_DOTVERSION)] != 0} { return } > "$(OUT_DIR)\pkgIndex.tcl"
535	echo package ifneeded Tk $(DOTVERSION) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk] >>"$(OUT_DIR)\pkgIndex.tcl"
536	$(CPY) "$(OUT_DIR)\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\"
537!endif
538
539install-libraries:
540	@$(CPY) "$(GENERICDIR)\tk.h" "$(INCLUDE_INSTALL_DIR)\"
541	@$(CPY) "$(GENERICDIR)\tkDecls.h" "$(INCLUDE_INSTALL_DIR)\"
542	@$(CPY) "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\"
543	@$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\"
544	@$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\"
545	@$(CPY) "$(ROOT)\library\*" "$(SCRIPT_INSTALL_DIR)\"
546	@$(CPY) "$(ROOT)\library\*" "$(SCRIPT_INSTALL_DIR)\"
547	@$(CPY) "$(ROOT)\library\demos\*" "$(SCRIPT_INSTALL_DIR)\demos\"
548	@$(CPY) "$(ROOT)\library\demos\images\*" "$(SCRIPT_INSTALL_DIR)\demos\images\"
549	@$(CPY) "$(ROOT)\library\images\*" "$(SCRIPT_INSTALL_DIR)\images\"
550	@$(CPY) "$(ROOT)\library\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\"
551
552
553#---------------------------------------------------------------------
554# Regenerate the stubs files.
555#---------------------------------------------------------------------
556
557genstubs:
558	$(TCLSH) $(_TCLDIR)\tools\genStubs.tcl $(GENERICDIR) \
559		$(GENERICDIR)\$(PROJECT).decls $(GENERICDIR)\$(PROJECT)Int.decls
560
561
562#---------------------------------------------------------------------
563# Generate the makefile depedancies.
564#---------------------------------------------------------------------
565
566depend:
567!if !exist($(TCLSH))
568	@echo Build tclsh first!
569!else
570	$(TCLSH) $(TOOLSDIR:\=/)/mkdepend.tcl -vc32 -out:"$(OUT_DIR)\depend.mk" \
571		-passthru:"-DBUILD_tcl $(TK_INCLUDES:"="")" $(GENERICDIR) \
572		$(COMPATDIR) $(WINDIR) @<<
573$(TKOBJS)
574<<
575!endif
576
577
578#---------------------------------------------------------------------
579# Regenerate the windows help files.
580#---------------------------------------------------------------------
581
582HLPBASE		= $(PROJECT)$(VERSION)
583HELPFILE	= $(OUT_DIR)\$(HLPBASE).hlp
584HELPCNT		= $(OUT_DIR)\$(HLPBASE).cnt
585DOCTMP_DIR	= $(OUT_DIR)\$(PROJECT)_docs
586HELPRTF		= $(DOCTMP_DIR)\$(PROJECT).rtf
587MAN2HELP	= $(DOCTMP_DIR)\man2help.tcl
588MAN2HELP2	= $(DOCTMP_DIR)\man2help2.tcl
589INDEX		= $(DOCTMP_DIR)\index.tcl
590BMP		= $(DOCTMP_DIR)\lamp.bmp
591BMP_NOPATH	= lamp.bmp
592MAN2TCL		= $(DOCTMP_DIR)\man2tcl.exe
593
594winhelp: docsetup $(HELPFILE)
595
596docsetup:
597	@if not exist $(DOCTMP_DIR)\nul mkdir $(DOCTMP_DIR)
598
599$(MAN2HELP) $(MAN2HELP2) $(INDEX): $(TCLTOOLSDIR)\$$(@F)
600	$(CPY) $(TCLTOOLSDIR)\$(@F) $(@D)
601
602$(BMP):
603	$(CPY) $(WINDIR)\$(@F) $(@D)
604
605$(HELPFILE): $(HELPRTF) $(BMP)
606	cd $(DOCTMP_DIR)
607	start /wait hcrtf.exe -x <<$(PROJECT).hpj
608[OPTIONS]
609COMPRESS=12 Hall Zeck
610LCID=0x409 0x0 0x0 ; English (United States)
611TITLE=Tk Reference Manual
612BMROOT=.
613CNT=$(@B).cnt
614HLP=$(@B).hlp
615
616[FILES]
617$(PROJECT).rtf
618
619[WINDOWS]
620main="Tcl/Tk Reference Manual",,27648,(r15263976),(r4227327)
621
622[CONFIG]
623BrowseButtons()
624CreateButton(1, "Web", ExecFile("http://www.tcl.tk"))
625CreateButton(2, "SF", ExecFile("http://sf.net/projects/tcl"))
626CreateButton(3, "Wiki", ExecFile("http://wiki.tcl.tk"))
627CreateButton(4, "FAQ", ExecFile("http://www.purl.org/NET/Tcl-FAQ/"))
628<<
629	cd $(MAKEDIR)
630	$(CPY) "$(DOCTMP_DIR)\$(@B).hlp" "$(OUT_DIR)"
631	$(CPY) "$(DOCTMP_DIR)\$(@B).cnt" "$(OUT_DIR)"
632
633$(MAN2TCL): $(TCLTOOLSDIR)\$$(@B).c
634	$(cc32) -nologo -G4 -ML -O2 -Fo$(@D)\ $(TCLTOOLSDIR)\$(@B).c -link -out:$@
635
636$(HELPRTF): $(MAN2TCL) $(MAN2HELP) $(MAN2HELP2) $(INDEX)
637	$(TCLSH) $(MAN2HELP) -bitmap $(BMP_NOPATH) $(PROJECT) $(VERSION) $(DOCDIR:\=/)
638
639install-docs:
640!if exist($(HELPFILE))
641	$(CPY) "$(HELPFILE)" "$(DOC_INSTALL_DIR)\"
642	$(CPY) "$(HELPCNT)" "$(DOC_INSTALL_DIR)\"
643	$(TCLSH) <<
644puts "Installing $(PROJECT)'s helpfile contents into Tcl's ..."
645set f [open "$(DOC_INSTALL_DIR:\=/)/tcl$(VERSION).cnt" r]
646while {![eof $$f]} {
647    if {[regexp {:Include $(PROJECT)([0-9]{2}).cnt} [gets $$f] dummy ver]} {
648	if {$$ver == $(VERSION)} {
649	    puts "Already installed."
650	    exit
651	} else {
652	    # do something here logical to remove (or replace) it.
653	    puts "$$ver != $(VERSION), unfinished code path, die, die!"
654	    exit 1
655	}
656    }
657}
658close $$f
659set f [open $(DOC_INSTALL_DIR:\=/)/tcl$(VERSION).cnt a]
660puts $$f {:Include $(HLPBASE).cnt}
661close $$f
662<<
663	start /wait winhlp32 -g $(DOC_INSTALL_DIR)\tcl$(VERSION).hlp
664!endif
665
666#---------------------------------------------------------------------
667# Special case object file targets
668#---------------------------------------------------------------------
669
670$(TMP_DIR)\testMain.obj: $(WINDIR)\winMain.c
671!if $(TCL_USE_STATIC_PACKAGES)
672	$(cc32) $(WISH_CFLAGS) -DTK_TEST -DTCL_USE_STATIC_PACKAGES -Fo$@ $?
673!else
674	$(cc32) $(WISH_CFLAGS) -DTK_TEST -Fo$@ $?
675!endif
676
677$(TMP_DIR)\tkTest.obj: $(GENERICDIR)\tkTest.c
678	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
679
680$(TMP_DIR)\tkWinTest.obj: $(WINDIR)\tkWinTest.c
681	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
682
683$(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c
684	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
685
686$(TMP_DIR)\winMain.obj: $(WINDIR)\winMain.c
687!if $(TCL_USE_STATIC_PACKAGES)
688	$(cc32) $(WISH_CFLAGS) -DTCL_USE_STATIC_PACKAGES -Fo$@ $?
689!else
690	$(cc32) $(WISH_CFLAGS) -Fo$@ $?
691!endif
692
693# The following objects are part of the stub library and should not
694# be built as DLL objects but none of the symbols should be exported
695# and no reference made to a C runtime.
696
697$(TMP_DIR)\tkStubLib.obj : $(GENERICDIR)\tkStubLib.c
698	$(cc32) $(cdebug) $(cflags) $(TK_INCLUDES) -Zl -DSTATIC_BUILD -Fo$@ $?
699
700$(TMP_DIR)\tkStubImg.obj : $(GENERICDIR)\tkStubImg.c
701	$(cc32) $(cdebug) $(cflags) $(TK_INCLUDES) -Zl -DSTATIC_BUILD -Fo$@ $?
702
703
704#---------------------------------------------------------------------
705# Dedependency rules
706#---------------------------------------------------------------------
707
708$(TMP_DIR)\tk.res: \
709    $(RCDIR)\buttons.bmp \
710    $(RCDIR)\cursor*.cur \
711    $(RCDIR)\tk.ico
712
713$(GENERICDIR)/default.h: $(WINDIR)/tkWinDefault.h
714$(GENERICDIR)/tkButton.c: $(GENERICDIR)/default.h
715$(GENERICDIR)/tkCanvas.c: $(GENERICDIR)/default.h
716$(GENERICDIR)/tkEntry.c: $(GENERICDIR)/default.h
717$(GENERICDIR)/tkFrame.c: $(GENERICDIR)/default.h
718$(GENERICDIR)/tkListbox.c: $(GENERICDIR)/default.h
719$(GENERICDIR)/tkMenu.c: $(GENERICDIR)/default.h
720$(GENERICDIR)/tkMenubutton.c: $(GENERICDIR)/default.h
721$(GENERICDIR)/tkMessage.c: $(GENERICDIR)/default.h
722$(GENERICDIR)/tkPanedWindow.c: $(GENERICDIR)/default.h
723$(GENERICDIR)/tkScale.c: $(GENERICDIR)/default.h
724$(GENERICDIR)/tkScrollbar.c: $(GENERICDIR)/default.h
725$(GENERICDIR)/tkText.c: $(GENERICDIR)/default.h
726$(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/default.h
727$(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/default.h
728$(GENERICDIR)/tkUndo.c: $(GENERICDIR)/tkUndo.h
729
730$(GENERICDIR)/tkText.c: $(GENERICDIR)/tkText.h
731$(GENERICDIR)/tkTextBTree.c: $(GENERICDIR)/tkText.h
732$(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
733$(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
734$(GENERICDIR)/tkTextImage.c: $(GENERICDIR)/tkText.h
735$(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/tkText.h
736$(GENERICDIR)/tkTextMark.c: $(GENERICDIR)/tkText.h
737$(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/tkText.h
738$(GENERICDIR)/tkTextWind.c: $(GENERICDIR)/tkText.h
739
740$(GENERICDIR)/tkMacWinMenu.c: $(GENERICDIR)/tkMenu.h
741$(GENERICDIR)/tkMenu.c: $(GENERICDIR)/tkMenu.h
742$(GENERICDIR)/tkMenuDraw.c: $(GENERICDIR)/tkMenu.h
743$(WINDIR)/tkWinMenu.c: $(GENERICDIR)/tkMenu.h
744
745!if exist("$(OUT_DIR)\depend.mk")
746!include "$(OUT_DIR)\depend.mk"
747!message *** Dependency rules in effect.
748!else
749!message *** Dependency rules are not being used.
750!endif
751
752### add a spacer in the output
753!message
754
755#---------------------------------------------------------------------
756# Implicit rules
757#---------------------------------------------------------------------
758
759{$(XLIBDIR)}.c{$(TMP_DIR)}.obj::
760	$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
761$<
762<<
763
764{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
765	$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
766$<
767<<
768
769{$(WINDIR)}.c{$(TMP_DIR)}.obj::
770	$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
771$<
772<<
773
774{$(ROOT)\unix}.c{$(TMP_DIR)}.obj::
775	$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
776$<
777<<
778
779{$(RCDIR)}.rc{$(TMP_DIR)}.res:
780	$(rc32) -fo $@ -r -i "$(GENERICDIR)" $(TCL_INCLUDES) \
781!if $(DEBUG)
782		-d DEBUG \
783!endif
784!if $(TCL_THREADS)
785		-d TCL_THREADS \
786!endif
787!if $(STATIC_BUILD)
788		-d STATIC_BUILD \
789!endif
790		$<
791
792#---------------------------------------------------------------------
793# Clean up
794#---------------------------------------------------------------------
795
796clean:
797	-@$(RMDIR) $(TMP_DIR)
798
799hose: clean
800	-@$(RMDIR) $(OUT_DIR)
801
802
803.SUFFIXES:
804.SUFFIXES:.c .rc
805
806