summaryrefslogtreecommitdiffstats
path: root/win/makefile.vc
blob: 302657b649afee24c2345e5bd0245936a2a6ca38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
#------------------------------------------------------------------------------
# makefile.vc --
#
#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
# Copyright (c) 2001 ActiveState Corporation.
# Copyright (c) 2001 Tomasoft Engineering.
#
#------------------------------------------------------------------------------
# RCS: @(#) $Id: makefile.vc,v 1.81 2002/02/20 19:06:53 davygrvy Exp $
#------------------------------------------------------------------------------

!if "$(MSVCDIR)" == ""
MSG = ^
You'll need to run vcvars32.bat from Developer Studio, first, to setup^
the environment.  Jump to this line to read the new instructions.
!error $(MSG)
!endif

#------------------------------------------------------------------------------
# HOW TO USE this makefile:
#
# 1)  It is now necessary to have MSVCDir set in the environment.  This is used
#     as a check to see if vcvars32.bat had been run prior to running nmake or
#     during the install of Microsoft Developer Studio, MSVCDir had been set
#     globally and the PATH adjusted.  Either way is valid.
#
#     You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
#     directory to setup the proper environment, if needed, for your current
#     setup.  This is a needed bootstrap requirement and allows the swapping of
#     different environments to be easier.
#
# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
#     vcvars32.bat according to the instructions for it.  This can also turn on
#     the 64-bit compiler, if your SDK has it.
#
# 3)  Targets are:
#	release  -- builds the core, the shell and the dlls. (default)
#	dlls     -- just builds the windows extensions and the 16-bit DOS
#		    pipe/thunk driver.
#	shell    -- Just builds the shell and the core.
#	core     -- Only builds the core.
#	all      -- builds everything.
#	test     -- builds and runs the test suite.
#	tcltest  -- just builds the binaries for the test suite.
#	install  -- installs the built binaries and libraries to $(INSTALLDIR)
#		    as the root of the install tree.
#	plugin   -- [currently out-dated].
#	clean    -- removes the contents of $(TMP_DIR) and $(OUT_DIR)
#	genstubs -- rebuilds the Stubs table and support files (dev only).
#	winhelp  -- builds the windows .hlp file for Tcl from the troff man
#		    files.
#
# 4)  Macros usable on the commandline:
#	INSTALLDIR=<path>
#		Sets where to install Tcl from the built binaries.
#		C:\Progra~1\Tcl is assumed when not specified.
#
#	OPTS=static,msvcrt,linkexten,threads,symbols,profile,none
#		Sets special options for the core.  The default is for none.
#		Any combination of the above may be used (comma separated).
#		'none' will over-ride everything to nothing.
#
#		static  =  Builds a static library of the core instead of a
#			   dll.  The shell will be static (and large), as well.
#		msvcrt  =  Effects 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.
#		linkexten = Effects the static option only to switch
#			   tclshXX.exe to have the dde and reg extension linked
#			   inside it.
#		threads =  Turns on full multithreading support.
#		symbols =  Adds symbols for step debugging.
#		profile =  Adds profiling hooks.  Map file is assumed.
#
#	STATS=memdbg,compdbg,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.
#
#	MACHINE=(IX86|IA64|ALPHA)
#		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.
#
#	TMP_DIR=<path>
#	OUT_DIR=<path>
#		Hooks to allow the intermediate and output directories to be
#		changed.  $(OUT_DIR) is assumed to be 
#		$(BINROOT)\(Release|Debug) based on if symbols are requested.
#		$(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
#
#	TESTPAT=<file>
#		Reads the tests requested to be run from this file.
#
# 5)  Examples:
#
#	Basic syntax of calling nmake looks like this:
#	nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
#
#                        Standard (no frills)
#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
#       Setting environment for using Microsoft Visual C++ tools.
#       c:\tcl_src\win\>nmake -f makefile.vc release
#       c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
#
#                         Building for Win64
#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
#       Setting environment for using Microsoft Visual C++ tools.
#       c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
#       Targeting Windows pre64 RETAIL
#       c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64
#
#------------------------------------------------------------------------------
#==============================================================================
###############################################################################


#    //==================================================================\\
#   >>[               -> Do not modify below this line. <-               ]<<
#   >>[  Please, use the commandline macros to modify how Tcl is built.  ]<<
#   >>[  If you need more features, send us a patch for more macros.     ]<<
#    \\==================================================================//


###############################################################################
#==============================================================================
#------------------------------------------------------------------------------

!if !exist("makefile.vc")
MSG = ^
You must run this makefile only from the directory it is in.^
Please `cd` to its location first.
!error $(MSG) 
!endif

PROJECT	= tcl
!include "rules.vc"


STUBPREFIX = $(PROJECT)stub
DOTVERSION = 8.4
VERSION = $(DOTVERSION:.=)

DDEDOTVERSION = 1.2
DDEVERSION = $(DDEDOTVERSION:.=)

REGDOTVERSION = 1.0
REGVERSION = $(REGDOTVERSION:.=)

BINROOT		= .
ROOT		= ..

TCLIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
TCLLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
TCLLIB		= $(OUT_DIR)\$(TCLLIBNAME)

TCLSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
TCLSTUBLIB	= $(OUT_DIR)\$(TCLSTUBLIBNAME)

TCLSHNAME	= $(PROJECT)sh$(VERSION)$(SUFX).exe
TCLSH		= $(OUT_DIR)\$(TCLSHNAME)
TCLPIPEDLLNAME	= $(PROJECT)pip$(VERSION).dll
TCLPIPEDLL	= $(OUT_DIR)\$(TCLPIPEDLLNAME)

TCLREGDLLNAME	= $(PROJECT)reg$(REGVERSION)$(SUFX:t=).$(EXT)
TCLREGDLL	= $(OUT_DIR)\$(TCLREGDLLNAME)

TCLDDEDLLNAME	= $(PROJECT)dde$(DDEVERSION)$(SUFX:t=).$(EXT)
TCLDDEDLL	= $(OUT_DIR)\$(TCLDDEDLLNAME)

TCLHLPBASE	= $(PROJECT)$(VERSION)
TCLHLP		= $(OUT_DIR)\$(TCLHLPBASE).hlp
TCLHLPCNT	= $(OUT_DIR)\$(TCLHLPBASE).cnt

TCLTEST		= $(OUT_DIR)\$(PROJECT)test.exe
CAT32		= $(OUT_DIR)\cat32.exe
RMDIR		= .\rmd.bat
MKDIR		= .\mkd.bat
RM		= del

LIB_INSTALL_DIR		= $(INSTALLDIR)\lib
BIN_INSTALL_DIR		= $(INSTALLDIR)\bin
DOC_INSTALL_DIR		= $(INSTALLDIR)\doc
SCRIPT_INSTALL_DIR	= $(INSTALLDIR)\lib\tcl$(DOTVERSION)
INCLUDE_INSTALL_DIR	= $(INSTALLDIR)\include

TCLSHOBJS = \
	$(TMP_DIR)\tclAppInit.obj \
!if $(TCL_LINKWITHEXTENSIONS)
	$(TMP_DIR)\tclWinReg.obj \
	$(TMP_DIR)\tclWinDde.obj \
!endif
	$(TMP_DIR)\tclsh.res

TCLTESTOBJS = \
	$(TMP_DIR)\tclTest.obj \
	$(TMP_DIR)\tclTestObj.obj \
	$(TMP_DIR)\tclTestProcBodyObj.obj \
	$(TMP_DIR)\tclThreadTest.obj \
	$(TMP_DIR)\tclWinTest.obj \
	$(TMP_DIR)\testMain.obj

TCLOBJS = \
	$(TMP_DIR)\regcomp.obj \
	$(TMP_DIR)\regexec.obj \
	$(TMP_DIR)\regfree.obj \
	$(TMP_DIR)\regerror.obj \
	$(TMP_DIR)\strftime.obj \
	$(TMP_DIR)\strtoll.obj \
	$(TMP_DIR)\strtoull.obj \
	$(TMP_DIR)\tclAlloc.obj \
	$(TMP_DIR)\tclAsync.obj \
	$(TMP_DIR)\tclBasic.obj \
	$(TMP_DIR)\tclBinary.obj \
	$(TMP_DIR)\tclCkalloc.obj \
	$(TMP_DIR)\tclClock.obj \
	$(TMP_DIR)\tclCmdAH.obj \
	$(TMP_DIR)\tclCmdIL.obj \
	$(TMP_DIR)\tclCmdMZ.obj \
	$(TMP_DIR)\tclCompCmds.obj \
	$(TMP_DIR)\tclCompExpr.obj \
	$(TMP_DIR)\tclCompile.obj \
	$(TMP_DIR)\tclDate.obj \
	$(TMP_DIR)\tclEncoding.obj \
	$(TMP_DIR)\tclEnv.obj \
	$(TMP_DIR)\tclEvent.obj \
	$(TMP_DIR)\tclExecute.obj \
	$(TMP_DIR)\tclFCmd.obj \
	$(TMP_DIR)\tclFileName.obj \
	$(TMP_DIR)\tclGet.obj \
	$(TMP_DIR)\tclHash.obj \
	$(TMP_DIR)\tclHistory.obj \
	$(TMP_DIR)\tclIndexObj.obj \
	$(TMP_DIR)\tclInterp.obj \
	$(TMP_DIR)\tclIO.obj \
	$(TMP_DIR)\tclIOCmd.obj \
	$(TMP_DIR)\tclIOGT.obj \
	$(TMP_DIR)\tclIOSock.obj \
	$(TMP_DIR)\tclIOUtil.obj \
	$(TMP_DIR)\tclLink.obj \
	$(TMP_DIR)\tclLiteral.obj \
	$(TMP_DIR)\tclListObj.obj \
	$(TMP_DIR)\tclLoad.obj \
	$(TMP_DIR)\tclMain.obj \
	$(TMP_DIR)\tclNamesp.obj \
	$(TMP_DIR)\tclNotify.obj \
	$(TMP_DIR)\tclObj.obj \
	$(TMP_DIR)\tclPanic.obj \
	$(TMP_DIR)\tclParse.obj \
	$(TMP_DIR)\tclParseExpr.obj \
	$(TMP_DIR)\tclPipe.obj \
	$(TMP_DIR)\tclPkg.obj \
	$(TMP_DIR)\tclPosixStr.obj \
	$(TMP_DIR)\tclPreserve.obj \
	$(TMP_DIR)\tclProc.obj \
	$(TMP_DIR)\tclRegexp.obj \
	$(TMP_DIR)\tclResolve.obj \
	$(TMP_DIR)\tclResult.obj \
	$(TMP_DIR)\tclScan.obj \
	$(TMP_DIR)\tclStringObj.obj \
	$(TMP_DIR)\tclStubInit.obj \
	$(TMP_DIR)\tclStubLib.obj \
	$(TMP_DIR)\tclThread.obj \
	$(TMP_DIR)\tclThreadJoin.obj \
	$(TMP_DIR)\tclTimer.obj \
	$(TMP_DIR)\tclUtf.obj \
	$(TMP_DIR)\tclUtil.obj \
	$(TMP_DIR)\tclVar.obj \
	$(TMP_DIR)\tclWin32Dll.obj \
	$(TMP_DIR)\tclWinChan.obj \
	$(TMP_DIR)\tclWinConsole.obj \
	$(TMP_DIR)\tclWinSerial.obj \
	$(TMP_DIR)\tclWinError.obj \
	$(TMP_DIR)\tclWinFCmd.obj \
	$(TMP_DIR)\tclWinFile.obj \
	$(TMP_DIR)\tclWinInit.obj \
	$(TMP_DIR)\tclWinLoad.obj \
	$(TMP_DIR)\tclWinMtherr.obj \
	$(TMP_DIR)\tclWinNotify.obj \
	$(TMP_DIR)\tclWinPipe.obj \
	$(TMP_DIR)\tclWinSock.obj \
	$(TMP_DIR)\tclWinThrd.obj \
	$(TMP_DIR)\tclWinTime.obj \
!if !$(STATIC_BUILD)
	$(TMP_DIR)\tcl.res
!endif

TCLSTUBOBJS = $(TMP_DIR)\tclStubLib.obj

COMPATDIR	= $(ROOT)\compat
GENERICDIR	= $(ROOT)\generic
TOOLSDIR	= $(ROOT)\tools
WINDIR		= $(ROOT)\win

TCL_INCLUDES	= -I"$(WINDIR)" -I"$(GENERICDIR)"
TCL_DEFINES	= $(OPTDEFINES)


#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------

!if !$(DEBUG)
!if $(OPTIMIZING)
# This cranks the optimization level to maximize speed
cdebug	= -O2 -Op -Gs
!else
cdebug	=
!endif
!else if "$(MACHINE)" == "IA64"
# Warnings are too many to support warnings into errors.
cdebug	= -Z7 -Od
!else
cdebug	= -Z7 -WX -Od
!endif

# declarations common to all compiler options
cflags = -nologo -c -W3 -YX -Fp$(TMP_DIR)^\

!if $(PENT_0F_ERRATA)
cflags = $(cflags) -QI0f
!endif

!if $(ITAN_B_ERRATA)
cflags = $(cflags) -QIA64_Bx
!endif

!if $(MSVCRT)
crt = -MD$(DBGX)
!else
crt = -MT$(DBGX)
!endif

BASE_CLFAGS	= $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES)
TCL_CFLAGS	= $(BASE_CLFAGS) $(TCL_DEFINES)
CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE


#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------

!if $(DEBUG)
ldebug	= -debug:full -debugtype:cv
!else
ldebug	= -release -opt:ref -opt:icf,3
!endif

# declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE) $(ldebug)

!if $(PROFILE)
lflags	= $(lflags) -profile
!endif

!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
# align sections for PE size savings.
lflags	= $(lflags) -opt:nowin98
!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
# align sections for speed in loading by choosing the page size.
lflags	= $(lflags) -align:4096
!endif

dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows

baselibs   = kernel32.lib advapi32.lib user32.lib
winlibs	   = $(baselibs) gdi32.lib


#---------------------------------------------------------------------
# TclTest flags
#---------------------------------------------------------------------

!IF "$(TESTPAT)" != ""
TESTFLAGS = -file $(TESTPAT)
!ENDIF


#---------------------------------------------------------------------
# Project specific targets
#---------------------------------------------------------------------

release:    setup $(TCLSH) $(TCLSTUBLIB) dlls
core:	    setup $(TCLLIB) $(TCLSTUBLIB)
shell:	    setup $(TCLSH)
dlls:	    setup $(TCLPIPEDLL) $(TCLREGDLL) $(TCLDDEDLL)
all:	    setup $(TCLSH) $(TCLSTUBLIB) dlls $(CAT32) 
tcltest:    setup $(TCLTEST) dlls $(CAT32)
plugin:	    setup $(TCLPLUGINDLL) $(TCLSHP)
install:    install-binaries install-libraries


test: setup $(TCLTEST) dlls $(CAT32)
	set TCL_LIBRARY=$(ROOT)/library
!if "$(OS)" == "Windows_NT"  || "$(MSVCDIR)" == "IDE"
	$(TCLTEST) $(ROOT)/tests/all.tcl $(TESTFLAGS)
!else
	$(TCLTEST) $(ROOT)/tests/all.tcl $(TESTFLAGS) > tests.log
	type tests.log | more
!endif

setup:
	@$(MKDIR) $(TMP_DIR)
	@$(MKDIR) $(OUT_DIR)

!if !$(STATIC_BUILD)
$(TCLIMPLIB): $(TCLLIB)
!endif

$(TCLLIB): $(TCLOBJS)
!if $(STATIC_BUILD)
	$(lib32) -nologo -out:$@ @<<
$**
<<
!else
	$(link32) $(dlllflags) -out:$@ $(winlibs) @<<
$**
<<
	-@del $*.exp
!endif


$(TCLSTUBLIB): $(TCLSTUBOBJS)
	$(lib32) -nologo -out:$@ $(TCLSTUBOBJS)

$(TCLSH): $(TCLSHOBJS) $(TCLIMPLIB)
	$(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) @<<
$**
<<


$(TCLTEST): $(TCLTESTOBJS) $(TCLIMPLIB)
	$(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) @<<
$**
<<


$(TCLPIPEDLL): $(WINDIR)\stub16.c
	$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $(WINDIR)\stub16.c
	$(link32) $(conlflags) -out:$@ $(TMP_DIR)\stub16.obj \
		$(baselibs)


!if $(STATIC_BUILD)
$(TCLDDEDLL): $(TMP_DIR)\tclWinDde.obj
	$(lib32) -nologo -out:$@ $(TMP_DIR)\tclWinDde.obj
!else
$(TCLDDEDLL): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB)
	$(link32) $(dlllflags) -out:$@ $** $(baselibs)
	-@del $*.exp
	-@del $*.lib
!endif


!if $(STATIC_BUILD)
$(TCLREGDLL): $(TMP_DIR)\tclWinReg.obj
	$(lib32) -nologo -out:$@ $(TMP_DIR)\tclWinReg.obj
!else
$(TCLREGDLL): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB)
	$(link32) $(dlllflags) -out:$@ $** $(baselibs)
	-@del $*.exp
	-@del $*.lib
!endif


$(CAT32): $(WINDIR)\cat.c
	$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $?
	$(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj \
		$(baselibs)

install-binaries:
	@echo installing $(TCLLIBNAME)
!if "$(TCLLIB)" != "$(TCLIMPLIB)"
	@xcopy /i /y "$(TCLLIB)" "$(BIN_INSTALL_DIR)\"
!endif
	@xcopy /i /y "$(TCLIMPLIB)" "$(LIB_INSTALL_DIR)\"
!if exist($(TCLSH))
	@echo installing $(TCLSHNAME)
	@xcopy /i /y "$(TCLSH)" "$(BIN_INSTALL_DIR)\"
!endif
!if exist($(TCLPIPEDLL))
	@echo installing $(TCLPIPEDLLNAME)
	@xcopy /i /y "$(TCLPIPEDLL)" "$(BIN_INSTALL_DIR)\"
!endif
	@echo installing $(TCLSTUBLIBNAME)
	@xcopy /i /y "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)\"
!if exist($(TCLHLP))
	@xcopy /i /y "$(TCLHLP)" "$(DOC_INSTALL_DIR)\"
	@xcopy /i /y "$(TCLHLPCNT)" "$(DOC_INSTALL_DIR)\"
!endif

install-libraries:
	@echo installing http1.0
	@xcopy /i /y "$(ROOT)\library\http1.0\*.tcl" \
		"$(SCRIPT_INSTALL_DIR)\http1.0\"
	@echo installing http2.4
	@xcopy /i /y "$(ROOT)\library\http\*.tcl" \
		"$(SCRIPT_INSTALL_DIR)\http2.4\"
	@echo installing opt0.4
	@xcopy /i /y "$(ROOT)\library\opt\*.tcl" \
		"$(SCRIPT_INSTALL_DIR)\opt0.4\"
	@echo installing msgcat1.2
	@xcopy /i /y "$(ROOT)\library\msgcat\*.tcl" \
	    "$(SCRIPT_INSTALL_DIR)\msgcat1.2\"
	@echo installing $(TCLDDEDLLNAME)
!if $(STATIC_BUILD)
	@xcopy /i /y "$(TCLDDEDLL)" "$(LIB_INSTALL_DIR)\"
!else
	@xcopy /i /y "$(TCLDDEDLL)" "$(LIB_INSTALL_DIR)\dde$(DDEDOTVERSION)\"
	@xcopy /i /y "$(ROOT)\library\dde\pkgIndex.tcl" \
	    "$(LIB_INSTALL_DIR)\dde$(DDEDOTVERSION)\"
!endif
	@echo installing $(TCLREGDLLNAME)
!if $(STATIC_BUILD)
	@xcopy /i /y "$(TCLREGDLL)" "$(LIB_INSTALL_DIR)\"
!else
	@xcopy /i /y "$(TCLREGDLL)" "$(LIB_INSTALL_DIR)\reg$(REGDOTVERSION)\"
	@xcopy /i /y "$(ROOT)\library\reg\pkgIndex.tcl" \
	    "$(LIB_INSTALL_DIR)\reg$(REGDOTVERSION)\"
!endif
	@echo installing encoding files
	@xcopy /i /y "$(ROOT)\library\encoding\*.enc" \
		"$(SCRIPT_INSTALL_DIR)\encoding\"
	@echo installing library files
	@xcopy /i /y "$(GENERICDIR)\tcl.h"          "$(INCLUDE_INSTALL_DIR)\"
	@xcopy /i /y "$(GENERICDIR)\tclDecls.h"     "$(INCLUDE_INSTALL_DIR)\"
	@xcopy /i /y "$(GENERICDIR)\tclPlatDecls.h" "$(INCLUDE_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\history.tcl"  "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\init.tcl"     "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\ldAout.tcl"   "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\parray.tcl"   "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\safe.tcl"     "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\tclIndex"     "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\package.tcl"  "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\word.tcl"     "$(SCRIPT_INSTALL_DIR)\"
	@xcopy /i /y "$(ROOT)\library\auto.tcl"     "$(SCRIPT_INSTALL_DIR)\"


#---------------------------------------------------------------------
# Regenerate the stubs files.
#---------------------------------------------------------------------

genstubs:
	tclsh$(VERSION) $(ROOT)\tools\genStubs.tcl $(GENERICDIR) \
		$(GENERICDIR)\tcl.decls $(GENERICDIR)\tclInt.decls


#---------------------------------------------------------------------
# Regenerate the windows help files.
#---------------------------------------------------------------------

MAN2TCL		= $(TOOLSDIR)\man2tcl
TCLRTF		= $(TOOLSDIR)\tcl.rtf
MAN2HELP	= $(TOOLSDIR)\man2help.tcl
TCLHPJ		= $(TOOLSDIR)\tcl.hpj

winhelp: $(TCLHLP)

$(TCLHLP): $(TCLRTF)
	cd $(TOOLSDIR)
	start /wait hcrtf.exe -x tcl.hpj
	cd $(MAKEDIR)
	copy $(TOOLSDIR)\$(TCLHLPBASE).hlp $(OUT_DIR)
	copy $(TOOLSDIR)\$(TCLHLPBASE).cnt $(OUT_DIR)

$(TCLHPJ): $(TCLHPJ).in
	copy $(TCLHPJ).in $(TCLHPJ)

$(MAN2TCL).exe: $(MAN2TCL).obj 
	cd $(TOOLSDIR)
	$(cc32) -nologo -G4 -ML -O2 $(MAN2TCL).c
	cd $(MAKEDIR)

$(TCLRTF): $(MAN2TCL).exe $(TCLSH)
	cd $(TOOLSDIR)
	..\win\$(TCLSH) $(MAN2HELP) $(PROJECT) $(VERSION) $(ROOT)/doc
	cd $(MAKEDIR)


#---------------------------------------------------------------------
# Special case object file targets
#---------------------------------------------------------------------

$(TMP_DIR)\testMain.obj: $(WINDIR)\tclAppInit.c
!if $(TCL_LINKWITHEXTENSIONS)
	$(cc32) $(TCL_CFLAGS) -DTCL_TEST -DTCL_LINKWITHEXTENSIONS -Fo$@ $?
!else
	$(cc32) $(TCL_CFLAGS) -DTCL_TEST -Fo$@ $?
!endif

$(TMP_DIR)\tclTest.obj: $(GENERICDIR)\tclTest.c
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?

$(TMP_DIR)\tclTestObj.obj: $(GENERICDIR)\tclTestObj.c
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?

$(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?

$(TMP_DIR)\tclAppInit.obj: $(WINDIR)\tclAppInit.c
!if $(TCL_LINKWITHEXTENSIONS)
	$(cc32) $(TCL_CFLAGS) -DTCL_LINKWITHEXTENSIONS -Fo$@ $?
!else
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?
!endif

# The following objects should be built using the stub interfaces

$(TMP_DIR)\tclWinReg.obj: $(WINDIR)\tclWinReg.c
!if $(STATIC_BUILD)
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DSTATIC_BUILD -Fo$@ $?
!else
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DUSE_TCL_STUBS -Fo$@ $?
!endif


$(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c
!if $(STATIC_BUILD)
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DSTATIC_BUILD -Fo$@ $?
!else
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DUSE_TCL_STUBS -Fo$@ $?
!endif


# The following objects are part of the stub library and should not
# be built as DLL objects but none of the symbols should be exported

$(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c
	$(cc32) $(cdebug) $(cflags) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $?


#---------------------------------------------------------------------
# Dedependency rules
#---------------------------------------------------------------------

$(GENERICDIR)\regcomp.c: \
	$(GENERICDIR)\regguts.h \
	$(GENERICDIR)\regc_lex.c \
	$(GENERICDIR)\regc_color.c \
	$(GENERICDIR)\regc_nfa.c \
	$(GENERICDIR)\regc_cvec.c \
	$(GENERICDIR)\regc_locale.c
$(GENERICDIR)\regcustom.h: \
	$(GENERICDIR)\tclInt.h \
	$(GENERICDIR)\tclPort.h \
	$(GENERICDIR)\regex.h
$(GENERICDIR)\regexec.c: \
	$(GENERICDIR)\rege_dfa.c \
	$(GENERICDIR)\regguts.h
$(GENERICDIR)\regerror.c: $(GENERICDIR)\regguts.h
$(GENERICDIR)\regfree.c: $(GENERICDIR)\regguts.h
$(GENERICDIR)\regfronts.c: $(GENERICDIR)\regguts.h
$(GENERICDIR)\regguts.h: $(GENERICDIR)\regcustom.h


#---------------------------------------------------------------------
# Implicit rules
#---------------------------------------------------------------------

{$(WINDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<

{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<

{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<

{$(WINDIR)}.rc{$(TMP_DIR)}.res:
	$(rc32) -fo $@ -r -i $(GENERICDIR) -D__WIN32__ \
!if $(DEBUG)
	-d DEBUG \
!endif
!if $(TCL_THREADS)
	-d TCL_THREADS \
!endif
!if $(STATIC_BUILD)
	-d STATIC_BUILD \
!endif
	$<


#---------------------------------------------------------------------
# Clean up
#---------------------------------------------------------------------

clean:
	-@$(RMDIR) $(TMP_DIR)

hose: clean
	-@$(RMDIR) $(OUT_DIR)


.SUFFIXES:
.SUFFIXES:.c .rc