xref: /freebsd/contrib/sqlite3/tea/win/rules.vc (revision cd0d51baaa4509a1db83251a601d34404d20c990)
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 -DUNICODE -D_UNICODE
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	= 1
217DEBUG		= 0
218SYMBOLS		= 0
219PROFILE		= 0
220PGO		= 0
221MSVCRT		= 0
222LOIMPACT	= 0
223TCL_USE_STATIC_PACKAGES	= 0
224USE_THREAD_ALLOC = 1
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
237MSVCRT		= 0
238!endif
239!if [nmakehlp -f $(OPTS) "staticpkg"]
240!message *** Doing staticpkg
241TCL_USE_STATIC_PACKAGES	= 1
242!else
243TCL_USE_STATIC_PACKAGES	= 0
244!endif
245!if [nmakehlp -f $(OPTS) "nothreads"]
246!message *** Compile explicitly for non-threaded tcl
247TCL_THREADS	= 0
248!else
249TCL_THREADS	= 1
250USE_THREAD_ALLOC= 1
251!endif
252!if [nmakehlp -f $(OPTS) "symbols"]
253!message *** Doing symbols
254DEBUG		= 1
255!else
256DEBUG		= 0
257!endif
258!if [nmakehlp -f $(OPTS) "pdbs"]
259!message *** Doing pdbs
260SYMBOLS		= 1
261!else
262SYMBOLS		= 0
263!endif
264!if [nmakehlp -f $(OPTS) "profile"]
265!message *** Doing profile
266PROFILE		= 1
267!else
268PROFILE		= 0
269!endif
270!if [nmakehlp -f $(OPTS) "pgi"]
271!message *** Doing profile guided optimization instrumentation
272PGO		= 1
273!elseif [nmakehlp -f $(OPTS) "pgo"]
274!message *** Doing profile guided optimization
275PGO		= 2
276!else
277PGO		= 0
278!endif
279!if [nmakehlp -f $(OPTS) "loimpact"]
280!message *** Doing loimpact
281LOIMPACT	= 1
282!else
283LOIMPACT	= 0
284!endif
285!if [nmakehlp -f $(OPTS) "thrdalloc"]
286!message *** Doing thrdalloc
287USE_THREAD_ALLOC = 1
288!endif
289!if [nmakehlp -f $(OPTS) "tclalloc"]
290!message *** Doing tclalloc
291USE_THREAD_ALLOC = 0
292!endif
293!if [nmakehlp -f $(OPTS) "unchecked"]
294!message *** Doing unchecked
295UNCHECKED = 1
296!else
297UNCHECKED = 0
298!endif
299!endif
300
301
302!if !$(STATIC_BUILD)
303# Make sure we don't build overly fat DLLs.
304MSVCRT		= 1
305# We shouldn't statically put the extensions inside the shell when dynamic.
306TCL_USE_STATIC_PACKAGES = 0
307!endif
308
309
310#----------------------------------------------------------
311# Figure-out how to name our intermediate and output directories.
312# We wouldn't want different builds to use the same .obj files
313# by accident.
314#----------------------------------------------------------
315
316#----------------------------------------
317# Naming convention:
318#   t = full thread support.
319#   s = static library (as opposed to an
320#	import library)
321#   g = linked to the debug enabled C
322#	run-time.
323#   x = special static build when it
324#	links to the dynamic C run-time.
325#----------------------------------------
326SUFX	    = tsgx
327
328!if $(DEBUG)
329BUILDDIRTOP = Debug
330!else
331BUILDDIRTOP = Release
332!endif
333
334!if "$(MACHINE)" != "IX86"
335BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
336!endif
337!if $(VCVER) > 6
338BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
339!endif
340
341!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
342SUFX	    = $(SUFX:g=)
343!endif
344
345TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX
346
347!if !$(STATIC_BUILD)
348TMP_DIRFULL = $(TMP_DIRFULL:Static=)
349SUFX	    = $(SUFX:s=)
350EXT	    = dll
351!if $(MSVCRT)
352TMP_DIRFULL = $(TMP_DIRFULL:X=)
353SUFX	    = $(SUFX:x=)
354!endif
355!else
356TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
357EXT	    = lib
358!if !$(MSVCRT)
359TMP_DIRFULL = $(TMP_DIRFULL:X=)
360SUFX	    = $(SUFX:x=)
361!endif
362!endif
363
364!if !$(TCL_THREADS)
365TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
366SUFX	    = $(SUFX:t=)
367!endif
368
369!ifndef TMP_DIR
370TMP_DIR	    = $(TMP_DIRFULL)
371!ifndef OUT_DIR
372OUT_DIR	    = .\$(BUILDDIRTOP)
373!endif
374!else
375!ifndef OUT_DIR
376OUT_DIR	    = $(TMP_DIR)
377!endif
378!endif
379
380
381#----------------------------------------------------------
382# Decode the statistics requested.
383#----------------------------------------------------------
384
385!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"]
386TCL_MEM_DEBUG	    = 0
387TCL_COMPILE_DEBUG   = 0
388!else
389!if [nmakehlp -f $(STATS) "memdbg"]
390!message *** Doing memdbg
391TCL_MEM_DEBUG	    = 1
392!else
393TCL_MEM_DEBUG	    = 0
394!endif
395!if [nmakehlp -f $(STATS) "compdbg"]
396!message *** Doing compdbg
397TCL_COMPILE_DEBUG   = 1
398!else
399TCL_COMPILE_DEBUG   = 0
400!endif
401!endif
402
403
404#----------------------------------------------------------
405# Decode the checks requested.
406#----------------------------------------------------------
407
408!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
409TCL_NO_DEPRECATED	    = 0
410WARNINGS		    = -W3
411!else
412!if [nmakehlp -f $(CHECKS) "nodep"]
413!message *** Doing nodep check
414TCL_NO_DEPRECATED	    = 1
415!else
416TCL_NO_DEPRECATED	    = 0
417!endif
418!if [nmakehlp -f $(CHECKS) "fullwarn"]
419!message *** Doing full warnings check
420WARNINGS		    = -W4
421!if [nmakehlp -l -warn:3]
422LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
423!endif
424!else
425WARNINGS		    = -W3
426!endif
427!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
428!message *** Doing 64bit portability warnings
429WARNINGS		    = $(WARNINGS) -Wp64
430!endif
431!endif
432
433!if $(PGO) > 1
434!if [nmakehlp -l -ltcg:pgoptimize]
435LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
436!else
437MSG=^
438This compiler does not support profile guided optimization.
439!error $(MSG)
440!endif
441!elseif $(PGO) > 0
442!if [nmakehlp -l -ltcg:pginstrument]
443LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
444!else
445MSG=^
446This compiler does not support profile guided optimization.
447!error $(MSG)
448!endif
449!endif
450
451#----------------------------------------------------------
452# Set our defines now armed with our options.
453#----------------------------------------------------------
454
455OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
456
457!if $(TCL_MEM_DEBUG)
458OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
459!endif
460!if $(TCL_COMPILE_DEBUG)
461OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
462!endif
463!if $(TCL_THREADS)
464OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
465!if $(USE_THREAD_ALLOC)
466OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
467!endif
468!endif
469!if $(STATIC_BUILD)
470OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
471!endif
472!if $(TCL_NO_DEPRECATED)
473OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
474!endif
475
476!if !$(DEBUG)
477OPTDEFINES	= $(OPTDEFINES) -DNDEBUG
478!if $(OPTIMIZING)
479OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
480!endif
481!endif
482!if $(PROFILE)
483OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
484!endif
485!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
486OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
487!endif
488!if $(VCVERSION) < 1300
489OPTDEFINES	= $(OPTDEFINES) -DNO_STRTOI64
490!endif
491
492#----------------------------------------------------------
493# Locate the Tcl headers to build against
494#----------------------------------------------------------
495
496!if "$(PROJECT)" == "tcl"
497
498_TCL_H          = ..\generic\tcl.h
499
500!else
501
502# If INSTALLDIR set to tcl root dir then reset to the lib dir.
503!if exist("$(_INSTALLDIR)\include\tcl.h")
504_INSTALLDIR=$(_INSTALLDIR)\lib
505!endif
506
507!if !defined(TCLDIR)
508!if exist("$(_INSTALLDIR)\..\include\tcl.h")
509TCLINSTALL	= 1
510_TCLDIR		= $(_INSTALLDIR)\..
511_TCL_H          = $(_INSTALLDIR)\..\include\tcl.h
512TCLDIR          = $(_INSTALLDIR)\..
513!else
514MSG=^
515Failed to find tcl.h.  Set the TCLDIR macro.
516!error $(MSG)
517!endif
518!else
519_TCLDIR	= $(TCLDIR:/=\)
520!if exist("$(_TCLDIR)\include\tcl.h")
521TCLINSTALL	= 1
522_TCL_H          = $(_TCLDIR)\include\tcl.h
523!elseif exist("$(_TCLDIR)\generic\tcl.h")
524TCLINSTALL	= 0
525_TCL_H          = $(_TCLDIR)\generic\tcl.h
526!else
527MSG =^
528Failed to find tcl.h.  The TCLDIR macro does not appear correct.
529!error $(MSG)
530!endif
531!endif
532!endif
533
534#--------------------------------------------------------------
535# Extract various version numbers from tcl headers
536# The generated file is then included in the makefile.
537#--------------------------------------------------------------
538
539!if [echo REM = This file is generated from rules.vc > versions.vc]
540!endif
541!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
542   && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
543!endif
544!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
545   && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
546!endif
547!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
548   && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
549!endif
550
551# If building the tcl core then we need additional package versions
552!if "$(PROJECT)" == "tcl"
553!if [echo PKG_HTTP_VER = \>> versions.vc] \
554   && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc]
555!endif
556!if [echo PKG_TCLTEST_VER = \>> versions.vc] \
557   && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc]
558!endif
559!if [echo PKG_MSGCAT_VER = \>> versions.vc] \
560   && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc]
561!endif
562!if [echo PKG_PLATFORM_VER = \>> versions.vc] \
563   && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc]
564!endif
565!if [echo PKG_SHELL_VER = \>> versions.vc] \
566   && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc]
567!endif
568!if [echo PKG_DDE_VER = \>> versions.vc] \
569   && [nmakehlp -V ..\library\dde\pkgIndex.tcl "dde " >> versions.vc]
570!endif
571!if [echo PKG_REG_VER =\>> versions.vc] \
572   && [nmakehlp -V ..\library\reg\pkgIndex.tcl registry >> versions.vc]
573!endif
574!endif
575
576!include versions.vc
577
578#--------------------------------------------------------------
579# Setup tcl version dependent stuff headers
580#--------------------------------------------------------------
581
582!if "$(PROJECT)" != "tcl"
583
584TCL_VERSION	= $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
585
586!if $(TCL_VERSION) < 81
587TCL_DOES_STUBS	= 0
588!else
589TCL_DOES_STUBS	= 1
590!endif
591
592!if $(TCLINSTALL)
593TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
594!if !exist($(TCLSH)) && $(TCL_THREADS)
595TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe"
596!endif
597TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
598TCLIMPLIB	= "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
599TCL_LIBRARY	= $(_TCLDIR)\lib
600TCLREGLIB	= "$(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib"
601TCLDDELIB	= "$(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib"
602COFFBASE	= \must\have\tcl\sources\to\build\this\target
603TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
604TCL_INCLUDES    = -I"$(_TCLDIR)\include"
605!else
606TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
607!if !exist($(TCLSH)) && $(TCL_THREADS)
608TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe"
609!endif
610TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
611TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
612TCL_LIBRARY	= $(_TCLDIR)\library
613TCLREGLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib"
614TCLDDELIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib"
615COFFBASE	= "$(_TCLDIR)\win\coffbase.txt"
616TCLTOOLSDIR	= $(_TCLDIR)\tools
617TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
618!endif
619
620!endif
621
622#-------------------------------------------------------------------------
623# Locate the Tk headers to build against
624#-------------------------------------------------------------------------
625
626!if "$(PROJECT)" == "tk"
627_TK_H          = ..\generic\tk.h
628_INSTALLDIR    = $(_INSTALLDIR)\..
629!endif
630
631!ifdef PROJECT_REQUIRES_TK
632!if !defined(TKDIR)
633!if exist("$(_INSTALLDIR)\..\include\tk.h")
634TKINSTALL      = 1
635_TKDIR         = $(_INSTALLDIR)\..
636_TK_H          = $(_TKDIR)\include\tk.h
637TKDIR          = $(_TKDIR)
638!elseif exist("$(_TCLDIR)\include\tk.h")
639TKINSTALL      = 1
640_TKDIR         = $(_TCLDIR)
641_TK_H          = $(_TKDIR)\include\tk.h
642TKDIR          = $(_TKDIR)
643!endif
644!else
645_TKDIR = $(TKDIR:/=\)
646!if exist("$(_TKDIR)\include\tk.h")
647TKINSTALL      = 1
648_TK_H          = $(_TKDIR)\include\tk.h
649!elseif exist("$(_TKDIR)\generic\tk.h")
650TKINSTALL      = 0
651_TK_H          = $(_TKDIR)\generic\tk.h
652!else
653MSG =^
654Failed to find tk.h. The TKDIR macro does not appear correct.
655!error $(MSG)
656!endif
657!endif
658!endif
659
660#-------------------------------------------------------------------------
661# Extract Tk version numbers
662#-------------------------------------------------------------------------
663
664!if defined(PROJECT_REQUIRES_TK) || "$(PROJECT)" == "tk"
665
666!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
667   && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
668!endif
669!if [echo TK_MINOR_VERSION = \>> versions.vc] \
670   && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
671!endif
672!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
673   && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
674!endif
675
676!include versions.vc
677
678TK_DOTVERSION	= $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
679TK_VERSION	= $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
680
681!if "$(PROJECT)" != "tk"
682!if $(TKINSTALL)
683WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe"
684TKSTUBLIB	= "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib"
685TKIMPLIB	= "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib"
686TK_INCLUDES     = -I"$(_TKDIR)\include"
687!else
688WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe"
689TKSTUBLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib"
690TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib"
691TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
692!endif
693!endif
694
695!endif
696
697#----------------------------------------------------------
698# Display stats being used.
699#----------------------------------------------------------
700
701!message *** Intermediate directory will be '$(TMP_DIR)'
702!message *** Output directory will be '$(OUT_DIR)'
703!message *** Suffix for binaries will be '$(SUFX)'
704!message *** Optional defines are '$(OPTDEFINES)'
705!message *** Compiler version $(VCVER). Target machine is $(MACHINE)
706!message *** Host architecture is $(NATIVE_ARCH)
707!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
708!message *** Link options '$(LINKERFLAGS)'
709
710!endif
711
712