Diff
Not logged in

Differences From Artifact [20dfed98e0]:

To Artifact [1947f2fb8b]:


25
26
27
28
29
30
31

32

33
34
35
36
37
38
39
40
41
42
# General usage:
#   nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]]
#
# For MACRODEF, see TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md)
# or examine Sections 6-8 in rules.vc.
#
# Possible values of TARGET are:

#	release  -- Builds the core, the shell and the dlls. (default)

#	dlls     -- Just builds the windows extensions
#	shell    -- Just builds the shell and the core.
#	core     -- Only builds the core [tclXX.(dll|lib)].
#	all      -- Builds everything.
#	test     -- Builds and runs the test suite.
#	tcltest  -- Just builds the test shell.
#	install  -- Installs the built binaries and libraries to $(INSTALLDIR)
#		    as the root of the install tree.
#	tidy/clean/hose -- varying levels of cleaning.
#	genstubs -- Rebuilds the Stubs table and support files (dev only).







>
|
>

<
<







25
26
27
28
29
30
31
32
33
34
35


36
37
38
39
40
41
42
# General usage:
#   nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]]
#
# For MACRODEF, see TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md)
# or examine Sections 6-8 in rules.vc.
#
# Possible values of TARGET are:
#	release  -- Builds everything that ships with a release. (default)
#	core     -- Builds the core [tclXX.(dll|lib)]
#	shell    -- Builds tclsh and the core.
#	dlls     -- Just builds the windows extensions


#	all      -- Builds everything.
#	test     -- Builds and runs the test suite.
#	tcltest  -- Just builds the test shell.
#	install  -- Installs the built binaries and libraries to $(INSTALLDIR)
#		    as the root of the install tree.
#	tidy/clean/hose -- varying levels of cleaning.
#	genstubs -- Rebuilds the Stubs table and support files (dev only).
146
147
148
149
150
151
152







153
154
155
156
157
158
159
# We want to use our own resource file, not the standard template one.
RCFILE = tcl.rc

# The rules.vc file does most of the hard work in terms of defining
# the build configuration, macros, output directories etc.
!include "rules.vc"








# Tcl version info based on macros set up by rules.vc
DOTVERSION      = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
VERSION         = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)

# The staticpkg option is not longer supported in Tcl 8.7
# though extensions may still be using it. If specified together
# with "static", ignore it as that is now the default for







>
>
>
>
>
>
>







146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# We want to use our own resource file, not the standard template one.
RCFILE = tcl.rc

# The rules.vc file does most of the hard work in terms of defining
# the build configuration, macros, output directories etc.
!include "rules.vc"

#
# The tclsh executable without the embedded libzip. We need this
# separately from tclsh to have dependency and build order work right.
# Ditto for the DLL and tcltest
TCLSHRAW=$(TCLSH:.exe=-raw.exe)
TCLLIBRAW=$(TCLLIB:.dll=-raw.dll)

# Tcl version info based on macros set up by rules.vc
DOTVERSION      = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
VERSION         = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)

# The staticpkg option is not longer supported in Tcl 8.7
# though extensions may still be using it. If specified together
# with "static", ignore it as that is now the default for
220
221
222
223
224
225
226

227
228
229
230
231
232
233
TCLREGLIBNAME	= $(PROJECT)9registry$(REGVERSION)$(SUFX:t=).$(EXT)
TCLREGLIB	= $(OUT_DIR)\$(TCLREGLIBNAME)

TCLDDELIBNAME	= $(PROJECT)9dde$(DDEVERSION)$(SUFX:t=).$(EXT)
TCLDDELIB	= $(OUT_DIR)\$(TCLDDELIBNAME)

TCLTEST		= $(OUT_DIR)\$(PROJECT)test.exe


TCLSHOBJS = \
	$(TMP_DIR)\tclAppInit.obj \
	$(TMP_DIR)\tclsh.res

TCLTESTOBJS = \
	$(TMP_DIR)\tclTest.obj \







>







227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
TCLREGLIBNAME	= $(PROJECT)9registry$(REGVERSION)$(SUFX:t=).$(EXT)
TCLREGLIB	= $(OUT_DIR)\$(TCLREGLIBNAME)

TCLDDELIBNAME	= $(PROJECT)9dde$(DDEVERSION)$(SUFX:t=).$(EXT)
TCLDDELIB	= $(OUT_DIR)\$(TCLDDELIBNAME)

TCLTEST		= $(OUT_DIR)\$(PROJECT)test.exe
TCLTESTRAW	= $(TCLTEST:.exe=-raw.exe)

TCLSHOBJS = \
	$(TMP_DIR)\tclAppInit.obj \
	$(TMP_DIR)\tclsh.res

TCLTESTOBJS = \
	$(TMP_DIR)\tclTest.obj \
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
!if "$(TESTPAT)" != ""
TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif


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

























#---------------------------------------------------------------------



release:    setup $(TCLSH) $(TCLSTUBLIB) dlls libtclzip embed pkgs
core:	    setup $(TCLLIB) $(TCLSTUBLIB)





shell:	    setup $(TCLSH)





dlls:	    setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll $(OUT_DIR)\libtommath.dll
libtclzip:  core dlls $(TCLSCRIPTZIP)
all:	    setup $(TCLSH) $(TCLSTUBLIB) dlls libtclzip embed pkgs
embed:      setup $(TCLSH) $(TCLSTUBLIB) libtclzip
!if $(TCL_EMBED_SCRIPTS)
!if $(STATIC_BUILD)

	@copy /y /b "$(TCLSH)"+"$(TCLSCRIPTZIP)" "$(TCLSH)"
!else
	@copy /y /b "$(TCLLIB)"+"$(TCLSCRIPTZIP)" "$(TCLLIB)"
!endif
!endif

tcltest:    setup $(TCLTEST) dlls
install:    install-binaries install-libraries install-docs install-pkgs
!if $(SYMBOLS)
install:    install-pdbs
!endif
setup:      default-setup

test: test-core test-pkgs
test-core: setup $(TCLTEST) dlls
	set TCL_LIBRARY=$(TCL_TEST_LIBRARY)
	$(DEBUGGER) $(TCLTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) -loadfile <<
		package ifneeded dde 1.4.5 [list load "$(TCLDDELIB:\=/)"]
		package ifneeded registry 1.3.7 [list load "$(TCLREGLIB:\=/)"]
<<

runtest: setup $(TCLTEST) dlls
	set TCL_LIBRARY=$(TCL_TEST_LIBRARY)
	$(DEBUGGER) $(TCLTEST) $(SCRIPT)

runshell: setup $(TCLSH) dlls
	set TCL_LIBRARY=$(TCL_TEST_LIBRARY)
	$(DEBUGGER) $(TCLSH) $(SCRIPT)

!if $(STATIC_BUILD)

$(TCLLIB): $(TCLOBJS)
	$(LIBCMD) @<<
$**
<<

!else

$(TCLLIB): $(TCLOBJS)
	$(DLLCMD) @<<
$**
<<
	$(_VC_MANIFEST_EMBED_DLL)




$(TCLIMPLIB): $(TCLLIB)

!endif # $(STATIC_BUILD)

$(TCLSTUBLIB): $(TCLSTUBOBJS)
	$(LIBCMD) -nodefaultlib $(TCLSTUBOBJS)

$(TCLSH): $(TCLSHOBJS) $(TCLSTUBLIB) $(TCLIMPLIB)
	$(CONEXECMD) -stack:2300000 $**
	$(_VC_MANIFEST_EMBED_EXE)





$(TCLTEST): $(TCLTESTOBJS) $(TCLSTUBLIB) $(TCLIMPLIB)
	$(CONEXECMD) -stack:2300000 $**
	$(_VC_MANIFEST_EMBED_EXE)




!if $(STATIC_BUILD)
$(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj
	$(LIBCMD) $**
!else
$(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB)
	$(DLLCMD) $**







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


>
>
|
|
>
>
>
>
>
|
>
>
>
>
>

|
|
|
|
<
>
|
<
<

<

<







|










|

















>
>
>











>
>
>
>




>
>
>







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
!if "$(TESTPAT)" != ""
TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif


#---------------------------------------------------------------------
# Project specific targets
# There are 4 primary build configurations to consider from the combination
# of static/shared and embed/noembed of the library zip. The targets are
# done in the following order.
# $(TCLLIB) - this is either the core static .lib or the .dll. The target
#             build does not embed the library zip in the DLL irrespective
#             of the noembed setting. A copy is made as $(TCLLIBRAW)
#             as the $(TCLLIB) binary is potentially modified later.
# dlls      - these are the registry and dde DLL's or static libraries
# $(TCLSH)  - the Tcl shell WITHOUT any embedded zip. This needs $(TCLLIB)
#             to be built first as it links against it. A copy is made
#             as $(TCLSHRAW) as $(TCLSH) binary may be modified later.
# $(TCLSCRIPTZIP) - the zip file that is to be embedded. Note this also
#             ships separately and needs to be built irrespective of the
#             whether it is embedded or not. All above targets need to
#             be built prior as they are used to build the zip (unlike
#             Unix where the external zip program is used.)
# core      - this virtual target builds the final release ready Tcl
#             library. For shared, embedded builds it appends $(TCLSCRIPTZIP)
#             to the $(TCLLIB). For other build configurations, this
#             is a no-op.
# shell     - this virtual target builds the final release ready tclsh shell.
#             For static, embedded builds it appends $(TCLSCRIPTZIP)
#             to the $(TCLSH). For other build configurations, this
#             is a no-op.
# release   - Everything that builds as part of a release
#---------------------------------------------------------------------

release:    setup libtclzip core dlls shell pkgs
all:        setup libtclzip core dlls shell pkgs

core:	    setup $(TCLLIB)
!if $(TCL_EMBED_SCRIPTS) && !$(STATIC_BUILD)
core:	    libtclzip
	@$(COPY) /b "$(TCLLIBRAW)"+"$(TCLSCRIPTZIP)" "$(TCLLIB)"
!endif

shell:	    setup core $(TCLSH)
!if $(TCL_EMBED_SCRIPTS) && $(STATIC_BUILD)
shell:      libtclzip
	@$(COPY) /b "$(TCLSHRAW)"+"$(TCLSCRIPTZIP)" "$(TCLSH)"
!endif

dlls:	    setup $(TCLREGLIB) $(TCLDDELIB) $(OUT_DIR)\zlib1.dll $(OUT_DIR)\libtommath.dll
libtclzip:  $(TCLSCRIPTZIP)

tcltest:    setup core $(TCLTEST) dlls
!if $(TCL_EMBED_SCRIPTS) && $(STATIC_BUILD)

tcltest:      libtclzip
	@$(COPY) /b "$(TCLTESTRAW)"+"$(TCLSCRIPTZIP)" "$(TCLTEST)"


!endif



install:    install-binaries install-libraries install-docs install-pkgs
!if $(SYMBOLS)
install:    install-pdbs
!endif
setup:      default-setup

test: test-core test-pkgs
test-core: tcltest
	set TCL_LIBRARY=$(TCL_TEST_LIBRARY)
	$(DEBUGGER) $(TCLTEST) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) -loadfile <<
		package ifneeded dde 1.4.5 [list load "$(TCLDDELIB:\=/)"]
		package ifneeded registry 1.3.7 [list load "$(TCLREGLIB:\=/)"]
<<

runtest: setup $(TCLTEST) dlls
	set TCL_LIBRARY=$(TCL_TEST_LIBRARY)
	$(DEBUGGER) $(TCLTEST) $(SCRIPT)

runshell: setup core shell dlls
	set TCL_LIBRARY=$(TCL_TEST_LIBRARY)
	$(DEBUGGER) $(TCLSH) $(SCRIPT)

!if $(STATIC_BUILD)

$(TCLLIB): $(TCLOBJS)
	$(LIBCMD) @<<
$**
<<

!else

$(TCLLIB): $(TCLOBJS)
	$(DLLCMD) @<<
$**
<<
	$(_VC_MANIFEST_EMBED_DLL)
!if $(TCL_EMBED_SCRIPTS) && !$(STATIC_BUILD)
	$(COPY) $@ $(TCLLIBRAW)
!endif

$(TCLIMPLIB): $(TCLLIB)

!endif # $(STATIC_BUILD)

$(TCLSTUBLIB): $(TCLSTUBOBJS)
	$(LIBCMD) -nodefaultlib $(TCLSTUBOBJS)

$(TCLSH): $(TCLSHOBJS) $(TCLSTUBLIB) $(TCLIMPLIB)
	$(CONEXECMD) -stack:2300000 $**
	$(_VC_MANIFEST_EMBED_EXE)
!if $(TCL_EMBED_SCRIPTS) && $(STATIC_BUILD)
	$(COPY) $@ $(TCLSHRAW)
!endif


$(TCLTEST): $(TCLTESTOBJS) $(TCLSTUBLIB) $(TCLIMPLIB)
	$(CONEXECMD) -stack:2300000 $**
	$(_VC_MANIFEST_EMBED_EXE)
!if $(TCL_EMBED_SCRIPTS) && $(STATIC_BUILD)
	$(COPY) $@ $(TCLTESTRAW)
!endif

!if $(STATIC_BUILD)
$(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj
	$(LIBCMD) $**
!else
$(TCLDDELIB): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB)
	$(DLLCMD) $**
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
	$(COPY) $(COMPATDIR)\zlib\win64\zdll.lib $(OUT_DIR)\zdll.lib
$(OUT_DIR)\libtommath.dll:	$(TOMMATHDIR)\win64\libtommath.dll
	$(COPY) $(TOMMATHDIR)\win64\libtommath.dll $(OUT_DIR)\libtommath.dll
$(OUT_DIR)\tommath.lib:	$(TOMMATHDIR)\win64\tommath.lib
	$(COPY) $(TOMMATHDIR)\win64\tommath.lib $(OUT_DIR)\tommath.lib
!endif

$(TCLSCRIPTZIP): $(TCLDDELIB) $(TCLREGLIB)
	@echo Building Tcl library zip file

	@if exist "$(LIBTCLVFS)" $(RMDIR) "$(LIBTCLVFS)"
	@$(MKDIR) "$(LIBTCLVFS)"
	@$(CPYDIR) $(LIBDIR) "$(LIBTCLVFS)\tcl_library"
	@move /y "$(LIBTCLVFS)\tcl_library\manifest.txt"  "$(LIBTCLVFS)\tcl_library\pkgIndex.tcl" > NUL
!if $(STATIC_BUILD)
# Remove the registry and dde directories as the DLLS are still external
	@del "$(LIBTCLVFS)\tcl_library\registry\pkgIndex.tcl"
	@rmdir "$(LIBTCLVFS)\tcl_library\registry"
	@del "$(LIBTCLVFS)\tcl_library\dde\pkgIndex.tcl"
	@rmdir "$(LIBTCLVFS)\tcl_library\dde"
!else
    @$(COPY) $(TCLDDELIB) "$(LIBTCLVFS)\tcl_library\dde
    @$(COPY) $(TCLREGLIB) "$(LIBTCLVFS)\tcl_library\registry
!endif
	@echo file delete -force {$@} > "$(OUT_DIR)\zipper.tcl"
	@echo zipfs mkzip {$@} {$(LIBTCLVFS)} {$(LIBTCLVFS)} >> "$(OUT_DIR)\zipper.tcl"
	@cd "$(OUT_DIR)" && $(TCLSH_NATIVE) zipper.tcl


pkgs:
	@for /d %d in ($(PKGSDIR)\*) do \
	  @if exist "%~fd\win\makefile.vc" ( \
	    pushd "%~fd\win" & \
	    $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) &\
	    popd \







|
|
>

















<







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
	$(COPY) $(COMPATDIR)\zlib\win64\zdll.lib $(OUT_DIR)\zdll.lib
$(OUT_DIR)\libtommath.dll:	$(TOMMATHDIR)\win64\libtommath.dll
	$(COPY) $(TOMMATHDIR)\win64\libtommath.dll $(OUT_DIR)\libtommath.dll
$(OUT_DIR)\tommath.lib:	$(TOMMATHDIR)\win64\tommath.lib
	$(COPY) $(TOMMATHDIR)\win64\tommath.lib $(OUT_DIR)\tommath.lib
!endif

$(TCLSCRIPTZIP): $(TCLLIB) $(TCLSH) dlls
	@echo Building Tcl library zip file $(TCLSCRIPTZIP)
	@set TCL_LIBRARY=$(ROOT:\=/)/library
	@if exist "$(LIBTCLVFS)" $(RMDIR) "$(LIBTCLVFS)"
	@$(MKDIR) "$(LIBTCLVFS)"
	@$(CPYDIR) $(LIBDIR) "$(LIBTCLVFS)\tcl_library"
	@move /y "$(LIBTCLVFS)\tcl_library\manifest.txt"  "$(LIBTCLVFS)\tcl_library\pkgIndex.tcl" > NUL
!if $(STATIC_BUILD)
# Remove the registry and dde directories as the DLLS are still external
	@del "$(LIBTCLVFS)\tcl_library\registry\pkgIndex.tcl"
	@rmdir "$(LIBTCLVFS)\tcl_library\registry"
	@del "$(LIBTCLVFS)\tcl_library\dde\pkgIndex.tcl"
	@rmdir "$(LIBTCLVFS)\tcl_library\dde"
!else
    @$(COPY) $(TCLDDELIB) "$(LIBTCLVFS)\tcl_library\dde
    @$(COPY) $(TCLREGLIB) "$(LIBTCLVFS)\tcl_library\registry
!endif
	@echo file delete -force {$@} > "$(OUT_DIR)\zipper.tcl"
	@echo zipfs mkzip {$@} {$(LIBTCLVFS)} {$(LIBTCLVFS)} >> "$(OUT_DIR)\zipper.tcl"
	@cd "$(OUT_DIR)" && $(TCLSH_NATIVE) zipper.tcl


pkgs:
	@for /d %d in ($(PKGSDIR)\*) do \
	  @if exist "%~fd\win\makefile.vc" ( \
	    pushd "%~fd\win" & \
	    $(MAKE) -$(MAKEFLAGS) -f makefile.vc TCLDIR=$(ROOT) &\
	    popd \