1#------------------------------------------------------------------------------
2# rules.vc --
3#
4#	Microsoft Visual C++ makefile include for decoding the commandline
5#	macros.  This file does not need editing to build Tcl.
6#
7# See the file "license.terms" for information on usage and redistribution
8# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9#
10# Copyright (c) 2001-2003 David Gravereaux.
11# Copyright (c) 2003-2008 Patrick Thoyts
12#------------------------------------------------------------------------------
13
14!ifndef _RULES_VC
15_RULES_VC = 1
16
17cc32		= $(CC)   # built-in default.
18link32		= link
19lib32		= lib
20rc32		= $(RC)   # built-in default.
21
22!ifndef INSTALLDIR
23### Assume the normal default.
24_INSTALLDIR	= C:\Program Files\Tcl
25!else
26### Fix the path separators.
27_INSTALLDIR	= $(INSTALLDIR:/=\)
28!endif
29
30#----------------------------------------------------------
31# Set the proper copy method to avoid overwrite questions
32# to the user when copying files and selecting the right
33# "delete all" method.
34#----------------------------------------------------------
35
36!if "$(OS)" == "Windows_NT"
37RMDIR	= rmdir /S /Q
38ERRNULL  = 2>NUL
39!if ![ver | find "4.0" > nul]
40CPY	= echo y | xcopy /i >NUL
41COPY	= copy >NUL
42!else
43CPY	= xcopy /i /y >NUL
44COPY	= copy /y >NUL
45!endif
46!else # "$(OS)" != "Windows_NT"
47CPY	= xcopy /i >_JUNK.OUT # On Win98 NUL does not work here.
48COPY	= copy >_JUNK.OUT # On Win98 NUL does not work here.
49RMDIR	= deltree /Y
50NULL    = \NUL # Used in testing directory existence
51ERRNULL = >NUL # Win9x shell cannot redirect stderr
52!endif
53MKDIR   = mkdir
54
55#------------------------------------------------------------------------------
56# Determine the host and target architectures and compiler version.
57#------------------------------------------------------------------------------
58
59_HASH=^#
60_VC_MANIFEST_EMBED_EXE=
61_VC_MANIFEST_EMBED_DLL=
62VCVER=0
63!if ![echo VCVERSION=_MSC_VER > vercl.x] \
64    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
65    && ![echo ARCH=IX86 >> vercl.x] \
66    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
67    && ![echo ARCH=AMD64 >> vercl.x] \
68    && ![echo $(_HASH)endif >> vercl.x] \
69    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
70!include vercl.i
71!if ![echo VCVER= ^\> vercl.vc] \
72    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
73!include vercl.vc
74!endif
75!endif
76!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
77!endif
78
79!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
80NATIVE_ARCH=IX86
81!else
82NATIVE_ARCH=AMD64
83!endif
84
85# Since MSVC8 we must deal with manifest resources.
86!if $(VCVERSION) >= 1400
87_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
88_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
89!endif
90
91!ifndef MACHINE
92MACHINE=$(ARCH)
93!endif
94
95!ifndef CFG_ENCODING
96CFG_ENCODING	= \"cp1252\"
97!endif
98
99!message ===============================================================================
100
101#----------------------------------------------------------
102# build the helper app we need to overcome nmake's limiting
103# environment.
104#----------------------------------------------------------
105
106!if !exist(nmakehlp.exe)
107!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul]
108!endif
109!endif
110
111#----------------------------------------------------------
112# Test for compiler features
113#----------------------------------------------------------
114
115### test for optimizations
116!if [nmakehlp -c -Ot]
117!message *** Compiler has 'Optimizations'
118OPTIMIZING	= 1
119!else
120!message *** Compiler does not have 'Optimizations'
121OPTIMIZING	= 0
122!endif
123
124OPTIMIZATIONS   =
125
126!if [nmakehlp -c -Ot]
127OPTIMIZATIONS  = $(OPTIMIZATIONS) -Ot
128!endif
129
130!if [nmakehlp -c -Oi]
131OPTIMIZATIONS  = $(OPTIMIZATIONS) -Oi
132!endif
133
134!if [nmakehlp -c -Op]
135OPTIMIZATIONS  = $(OPTIMIZATIONS) -Op
136!endif
137
138!if [nmakehlp -c -fp:strict]
139OPTIMIZATIONS  = $(OPTIMIZATIONS) -fp:strict
140!endif
141
142!if [nmakehlp -c -Gs]
143OPTIMIZATIONS  = $(OPTIMIZATIONS) -Gs
144!endif
145
146!if [nmakehlp -c -GS]
147OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
148!endif
149
150!if [nmakehlp -c -GL]
151OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
152!endif
153
154DEBUGFLAGS     =
155
156!if [nmakehlp -c -RTC1]
157DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
158!elseif [nmakehlp -c -GZ]
159DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
160!endif
161
162COMPILERFLAGS  =-W3
163
164# In v13 -GL and -YX are incompatible.
165!if [nmakehlp -c -YX]
166!if ![nmakehlp -c -GL]
167OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
168!endif
169!endif
170
171!if "$(MACHINE)" == "IX86"
172### test for pentium errata
173!if [nmakehlp -c -QI0f]
174!message *** Compiler has 'Pentium 0x0f fix'
175COMPILERFLAGS  = $(COMPILERFLAGS) -QI0f
176!else
177!message *** Compiler does not have 'Pentium 0x0f fix'
178!endif
179!endif
180
181!if "$(MACHINE)" == "IA64"
182### test for Itanium errata
183!if [nmakehlp -c -QIA64_Bx]
184!message *** Compiler has 'B-stepping errata workarounds'
185COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
186!else
187!message *** Compiler does not have 'B-stepping errata workarounds'
188!endif
189!endif
190
191!if "$(MACHINE)" == "IX86"
192### test for -align:4096, when align:512 will do.
193!if [nmakehlp -l -opt:nowin98]
194!message *** Linker has 'Win98 alignment problem'
195ALIGN98_HACK	= 1
196!else
197!message *** Linker does not have 'Win98 alignment problem'
198ALIGN98_HACK	= 0
199!endif
200!else
201ALIGN98_HACK	= 0
202!endif
203
204LINKERFLAGS     =
205
206!if [nmakehlp -l -ltcg]
207LINKERFLAGS     =-ltcg
208!endif
209
210#----------------------------------------------------------
211# Decode the options requested.
212#----------------------------------------------------------
213
214!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
215STATIC_BUILD	= 0
216TCL_THREADS	= 0
217DEBUG		= 0
218SYMBOLS		= 0
219PROFILE		= 0
220PGO		= 0
221MSVCRT		= 1
222LOIMPACT	= 0
223TCL_USE_STATIC_PACKAGES	= 0
224USE_THREAD_ALLOC = 0
225UNCHECKED	= 0
226!else
227!if [nmakehlp -f $(OPTS) "static"]
228!message *** Doing static
229STATIC_BUILD	= 1
230!else
231STATIC_BUILD	= 0
232!endif
233!if [nmakehlp -f $(OPTS) "msvcrt"]
234!message *** Doing msvcrt
235MSVCRT		= 1
236!else
237!if !$(STATIC_BUILD)
238MSVCRT		= 1
239!else
240MSVCRT		= 0
241!endif
242!endif
243!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
244!message *** Doing staticpkg
245TCL_USE_STATIC_PACKAGES	= 1
246!else
247TCL_USE_STATIC_PACKAGES	= 0
248!endif
249!if [nmakehlp -f $(OPTS) "threads"]
250!message *** Doing threads
251TCL_THREADS	= 1
252USE_THREAD_ALLOC = 1
253!else
254TCL_THREADS	= 0
255USE_THREAD_ALLOC = 0
256!endif
257!if [nmakehlp -f $(OPTS) "symbols"]
258!message *** Doing symbols
259DEBUG		= 1
260!else
261DEBUG		= 0
262!endif
263!if [nmakehlp -f $(OPTS) "pdbs"]
264!message *** Doing pdbs
265SYMBOLS		= 1
266!else
267SYMBOLS		= 0
268!endif
269!if [nmakehlp -f $(OPTS) "profile"]
270!message *** Doing profile
271PROFILE		= 1
272!else
273PROFILE		= 0
274!endif
275!if [nmakehlp -f $(OPTS) "pgi"]
276!message *** Doing profile guided optimization instrumentation
277PGO		= 1
278!elseif [nmakehlp -f $(OPTS) "pgo"]
279!message *** Doing profile guided optimization
280PGO		= 2
281!else
282PGO		= 0
283!endif
284!if [nmakehlp -f $(OPTS) "loimpact"]
285!message *** Doing loimpact
286LOIMPACT	= 1
287!else
288LOIMPACT	= 0
289!endif
290!if [nmakehlp -f $(OPTS) "thrdalloc"]
291!message *** Doing thrdalloc
292USE_THREAD_ALLOC = 1
293!endif
294!if [nmakehlp -f $(OPTS) "tclalloc"]
295!message *** Doing tclalloc
296USE_THREAD_ALLOC = 0
297!endif
298!if [nmakehlp -f $(OPTS) "unchecked"]
299!message *** Doing unchecked
300UNCHECKED = 1
301!else
302UNCHECKED = 0
303!endif
304!endif
305
306#----------------------------------------------------------
307# Figure-out how to name our intermediate and output directories.
308# We wouldn't want different builds to use the same .obj files
309# by accident.
310#----------------------------------------------------------
311
312#----------------------------------------
313# Naming convention:
314#   t = full thread support.
315#   s = static library (as opposed to an
316#	import library)
317#   g = linked to the debug enabled C
318#	run-time.
319#   x = special static build when it
320#	links to the dynamic C run-time.
321#----------------------------------------
322SUFX	    = tsgx
323
324!if $(DEBUG)
325BUILDDIRTOP = Debug
326!else
327BUILDDIRTOP = Release
328!endif
329
330!if "$(MACHINE)" != "IX86"
331BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
332!endif
333!if $(VCVER) > 6
334BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
335!endif
336
337!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
338SUFX	    = $(SUFX:g=)
339!endif
340
341TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX
342
343!if !$(STATIC_BUILD)
344TMP_DIRFULL = $(TMP_DIRFULL:Static=)
345SUFX	    = $(SUFX:s=)
346EXT	    = dll
347TMP_DIRFULL = $(TMP_DIRFULL:X=)
348SUFX	    = $(SUFX:x=)
349!else
350TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
351EXT	    = lib
352!if !$(MSVCRT)
353TMP_DIRFULL = $(TMP_DIRFULL:X=)
354SUFX	    = $(SUFX:x=)
355!endif
356!endif
357
358!if !$(TCL_THREADS)
359TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
360SUFX	    = $(SUFX:t=)
361!endif
362
363!ifndef TMP_DIR
364TMP_DIR	    = $(TMP_DIRFULL)
365!ifndef OUT_DIR
366OUT_DIR	    = .\$(BUILDDIRTOP)
367!endif
368!else
369!ifndef OUT_DIR
370OUT_DIR	    = $(TMP_DIR)
371!endif
372!endif
373
374
375#----------------------------------------------------------
376# Decode the statistics requested.
377#----------------------------------------------------------
378
379!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"]
380TCL_MEM_DEBUG	    = 0
381TCL_COMPILE_DEBUG   = 0
382!else
383!if [nmakehlp -f $(STATS) "memdbg"]
384!message *** Doing memdbg
385TCL_MEM_DEBUG	    = 1
386!else
387TCL_MEM_DEBUG	    = 0
388!endif
389!if [nmakehlp -f $(STATS) "compdbg"]
390!message *** Doing compdbg
391TCL_COMPILE_DEBUG   = 1
392!else
393TCL_COMPILE_DEBUG   = 0
394!endif
395!endif
396
397
398#----------------------------------------------------------
399# Decode the checks requested.
400#----------------------------------------------------------
401
402!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
403TCL_NO_DEPRECATED	    = 0
404WARNINGS		    = -W3
405!else
406!if [nmakehlp -f $(CHECKS) "nodep"]
407!message *** Doing nodep check
408TCL_NO_DEPRECATED	    = 1
409!else
410TCL_NO_DEPRECATED	    = 0
411!endif
412!if [nmakehlp -f $(CHECKS) "fullwarn"]
413!message *** Doing full warnings check
414WARNINGS		    = -W4
415!if [nmakehlp -l -warn:3]
416LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
417!endif
418!else
419WARNINGS		    = -W3
420!endif
421!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
422!message *** Doing 64bit portability warnings
423WARNINGS		    = $(WARNINGS) -Wp64
424!endif
425!endif
426
427!if $(PGO) > 1
428!if [nmakehlp -l -ltcg:pgoptimize]
429LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
430!else
431MSG=^
432This compiler does not support profile guided optimization.
433!error $(MSG)
434!endif
435!elseif $(PGO) > 0
436!if [nmakehlp -l -ltcg:pginstrument]
437LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
438!else
439MSG=^
440This compiler does not support profile guided optimization.
441!error $(MSG)
442!endif
443!endif
444
445#----------------------------------------------------------
446# Set our defines now armed with our options.
447#----------------------------------------------------------
448
449OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
450
451!if $(TCL_MEM_DEBUG)
452OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
453!endif
454!if $(TCL_COMPILE_DEBUG)
455OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
456!endif
457!if $(TCL_THREADS)
458OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
459!if $(USE_THREAD_ALLOC)
460OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
461!endif
462!endif
463!if $(STATIC_BUILD)
464OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
465!endif
466!if $(TCL_NO_DEPRECATED)
467OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
468!endif
469
470!if !$(DEBUG)
471OPTDEFINES	= $(OPTDEFINES) -DNDEBUG
472!if $(OPTIMIZING)
473OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
474!endif
475!endif
476!if $(PROFILE)
477OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
478!endif
479!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
480OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
481!endif
482!if $(VCVERSION) < 1300
483OPTDEFINES	= $(OPTDEFINES) -DNO_STRTOI64
484!endif
485
486#----------------------------------------------------------
487# Locate the Tcl headers to build against
488#----------------------------------------------------------
489
490!if "$(PROJECT)" == "tcl"
491
492_TCL_H          = ..\generic\tcl.h
493
494!else
495
496# If INSTALLDIR set to tcl root dir then reset to the lib dir.
497!if exist("$(_INSTALLDIR)\include\tcl.h")
498_INSTALLDIR=$(_INSTALLDIR)\lib
499!endif
500
501!if !defined(TCLDIR)
502!if exist("$(_INSTALLDIR)\..\include\tcl.h")
503TCLINSTALL	= 1
504_TCLDIR		= $(_INSTALLDIR)\..
505_TCL_H          = $(_INSTALLDIR)\..\include\tcl.h
506TCLDIR          = $(_INSTALLDIR)\..
507!else
508MSG=^
509Failed to find tcl.h.  Set the TCLDIR macro.
510!error $(MSG)
511!endif
512!else
513_TCLDIR	= $(TCLDIR:/=\)
514!if exist("$(_TCLDIR)\include\tcl.h")
515TCLINSTALL	= 1
516_TCL_H          = $(_TCLDIR)\include\tcl.h
517!elseif exist("$(_TCLDIR)\generic\tcl.h")
518TCLINSTALL	= 0
519_TCL_H          = $(_TCLDIR)\generic\tcl.h
520!else
521MSG =^
522Failed to find tcl.h.  The TCLDIR macro does not appear correct.
523!error $(MSG)
524!endif
525!endif
526!endif
527
528#--------------------------------------------------------------
529# Extract various version numbers from tcl headers
530# The generated file is then included in the makefile.
531#--------------------------------------------------------------
532
533!if [echo REM = This file is generated from rules.vc > versions.vc]
534!endif
535!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
536   && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
537!endif
538!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
539   && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
540!endif
541!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
542   && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
543!endif
544
545# If building the tcl core then we need additional package versions
546!if "$(PROJECT)" == "tcl"
547!if [echo PKG_HTTP_VER = \>> versions.vc] \
548   && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc]
549!endif
550!if [echo PKG_TCLTEST_VER = \>> versions.vc] \
551   && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc]
552!endif
553!if [echo PKG_MSGCAT_VER = \>> versions.vc] \
554   && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc]
555!endif
556!if [echo PKG_PLATFORM_VER = \>> versions.vc] \
557   && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc]
558!endif
559!if [echo PKG_SHELL_VER = \>> versions.vc] \
560   && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc]
561!endif
562!if [echo PKG_DDE_VER = \>> versions.vc] \
563   && [nmakehlp -V ..\library\dde\pkgIndex.tcl "dde " >> versions.vc]
564!endif
565!if [echo PKG_REG_VER =\>> versions.vc] \
566   && [nmakehlp -V ..\library\reg\pkgIndex.tcl registry >> versions.vc]
567!endif
568!endif
569
570!include versions.vc
571
572#--------------------------------------------------------------
573# Setup tcl version dependent stuff headers
574#--------------------------------------------------------------
575
576!if "$(PROJECT)" != "tcl"
577
578TCL_VERSION	= $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
579
580!if $(TCLINSTALL)
581TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
582!if !exist($(TCLSH))
583TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:x=).exe"
584!endif
585TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
586TCLIMPLIB	= "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
587!if !exist($(TCLIMPLIB))
588TCLIMPLIB	= "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:x=).lib"
589!endif
590TCL_LIBRARY	= $(_TCLDIR)\lib
591TCLREGLIB	= "$(_TCLDIR)\lib\tclreg12$(SUFX:t=).lib"
592TCLDDELIB	= "$(_TCLDIR)\lib\tcldde13$(SUFX:t=).lib"
593COFFBASE	= \must\have\tcl\sources\to\build\this\target
594TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
595TCL_INCLUDES    = -I"$(_TCLDIR)\include"
596!else
597TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
598!if !exist($(TCLSH))
599TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:x=).exe"
600!endif
601TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
602TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
603!if !exist($(TCLIMPLIB))
604TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:x=).lib"
605!endif
606TCL_LIBRARY	= $(_TCLDIR)\library
607TCLREGLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg12$(SUFX:t=).lib"
608TCLDDELIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde13$(SUFX:t=).lib"
609COFFBASE	= "$(_TCLDIR)\win\coffbase.txt"
610TCLTOOLSDIR	= $(_TCLDIR)\tools
611TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
612!endif
613
614!endif
615
616#-------------------------------------------------------------------------
617# Locate the Tk headers to build against
618#-------------------------------------------------------------------------
619
620!if "$(PROJECT)" == "tk"
621_TK_H          = ..\generic\tk.h
622_INSTALLDIR    = $(_INSTALLDIR)\..
623!endif
624
625!ifdef PROJECT_REQUIRES_TK
626!if !defined(TKDIR)
627!if exist("$(_INSTALLDIR)\..\include\tk.h")
628TKINSTALL      = 1
629_TKDIR         = $(_INSTALLDIR)\..
630_TK_H          = $(_TKDIR)\include\tk.h
631TKDIR          = $(_TKDIR)
632!elseif exist("$(_TCLDIR)\include\tk.h")
633TKINSTALL      = 1
634_TKDIR         = $(_TCLDIR)
635_TK_H          = $(_TKDIR)\include\tk.h
636TKDIR          = $(_TKDIR)
637!endif
638!else
639_TKDIR = $(TKDIR:/=\)
640!if exist("$(_TKDIR)\include\tk.h")
641TKINSTALL      = 1
642_TK_H          = $(_TKDIR)\include\tk.h
643!elseif exist("$(_TKDIR)\generic\tk.h")
644TKINSTALL      = 0
645_TK_H          = $(_TKDIR)\generic\tk.h
646!else
647MSG =^
648Failed to find tk.h. The TKDIR macro does not appear correct.
649!error $(MSG)
650!endif
651!endif
652!endif
653
654#-------------------------------------------------------------------------
655# Extract Tk version numbers
656#-------------------------------------------------------------------------
657
658!if defined(PROJECT_REQUIRES_TK) || "$(PROJECT)" == "tk"
659
660!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
661   && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
662!endif
663!if [echo TK_MINOR_VERSION = \>> versions.vc] \
664   && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
665!endif
666!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
667   && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
668!endif
669
670!include versions.vc
671
672TK_DOTVERSION	= $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
673TK_VERSION	= $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
674
675!if "$(PROJECT)" != "tk"
676!if $(TKINSTALL)
677WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe"
678!if !exist($(WISH))
679WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX:x=).exe"
680!endif
681TKSTUBLIB	= "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib"
682TKIMPLIB	= "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib"
683!if !exist($(TKIMPLIB))
684TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX:x=).lib"
685!endif
686TK_INCLUDES     = -I"$(_TKDIR)\include"
687!else
688WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe"
689!if !exist($(WISH))
690WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX:x=).exe"
691!endif
692TKSTUBLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib"
693TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib"
694!if !exist($(TKIMPLIB))
695TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX:x=).lib"
696!endif
697TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
698!endif
699!endif
700
701!endif
702
703#----------------------------------------------------------
704# Display stats being used.
705#----------------------------------------------------------
706
707!message *** Intermediate directory will be '$(TMP_DIR)'
708!message *** Output directory will be '$(OUT_DIR)'
709!message *** Suffix for binaries will be '$(SUFX)'
710!message *** Optional defines are '$(OPTDEFINES)'
711!message *** Compiler version $(VCVER). Target machine is $(MACHINE)
712!message *** Host architecture is $(NATIVE_ARCH)
713!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
714!message *** Link options '$(LINKERFLAGS)'
715
716!endif
717