︙ | | |
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
|
!ifndef _RULES_VC
_RULES_VC = 1
# The following macros define the version of the rules.vc nmake build system
RULES_VERSION_MAJOR = 1
RULES_VERSION_MINOR = 0
# The PROJECT macro must be defined by parent makefile.
# Also special case Tcl and Tk to save some typing later
!ifndef PROJECT
!error *** Error: Macro PROJECT not defined! Please define it before including rules.vc
!endif
DOING_TCL = 0
DOING_TK = 0
!if "$(PROJECT)" == "tcl"
DOING_TCL = 1
!elseif "$(PROJECT)" == "tk"
DOING_TK = 1
!endif
!ifndef PROJECT_REQUIRES_TK
PROJECT_REQUIRES_TK = 0
!endif
################################################################
# Nmake is a pretty weak environment in syntax and capabilities
# so this file is necessarily verbose. It's broken down into
# the following parts.
#
# 0. Sanity check that compiler environment is set up.
# 0. Sanity check that compiler environment is set up and initialize
# any built-in settings from the parent makefile
# 1. First define the external tools used for compiling, copying etc.
# as this is independent of everything else.
# 2. Figure out our build structure in terms of the directory, whether
# we are building Tcl or an extension, etc.
# 3. Determine the compiler and linker versions
# 4. Build the nmakehlp helper application
# 5. Determine the supported compiler options and features
|
︙ | | |
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
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
-
-
-
-
-
-
-
-
-
-
-
-
|
#----------------------------------------------------------
RMDIR = rmdir /S /Q
ERRNULL = 2>NUL
CPY = xcopy /i /y >NUL
COPY = copy /y >NUL
MKDIR = mkdir
# The ProgramFiles(x86) environment variable is not accessible
# from nmake since it has the parenthesis which nmake does not like
# within a macro name. So define our own in terms of the
# ProgramFiles environment variable.
# Note: env variables are always UPPER CASE in nmake
!if defined(PROCESSOR_ARCHITECTURE) && "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
PROGRAMFILES_X86 = $(PROGRAMFILES) (x86)
!else
PROGRAMFILES_X86 = $(PROGRAMFILES)
!endif
######################################################################
# 2. Figure out our build environment in terms of what we're building.
#
# (a) Tcl itself
# (b) Tk
# (c) a Tcl extension using libraries/includes from an *installed* Tcl
|
︙ | | |
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
|
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
|
+
-
+
-
+
-
+
|
# WINDIR env var to point to c:\windows!
# TBD - This is a potentially dangerous conflict, rename WINDIR to
# something else
WINDIR = $(ROOT)\win
!ifndef RCDIR
RCDIR = $(WINDIR)\rc
!endif
RCDIR = $(RCDIR:/=\)
# The target directory where the built packages and binaries will be installed.
# INSTALLDIR is the (optional) path specified by the user.
# _INSTALLDIR is INSTALLDIR using the backslash separator syntax
!ifdef INSTALLDIR
### Fix the path separators.
_INSTALLDIR = $(INSTALLDIR:/=\)
!else
### Assume the normal default.
_INSTALLDIR = C:\Program Files\Tcl
_INSTALLDIR = $(HOMEDRIVE)\Tcl
!endif
!if "$(PROJECT)" == "tcl"
!if $(DOING_TCL)
# BEGIN Case 2(a) - Building Tcl itself
# Only need to define _TCL_H
_TCL_H = ..\generic\tcl.h
# END Case 2(a) - Building Tcl itself
!elseif "$(PROJECT)" == "tk"
!elseif $(DOING_TK)
# BEGIN Case 2(b) - Building Tk
TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl
!ifndef TCLDIR
TCLDIR = ../../tcl
!endif
|
︙ | | |
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
-
+
|
!ifndef _TCL_H
MSG =^
Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h.
!error $(MSG)
!endif
# Now do the same to locate Tk headers and libs if project requires Tk
!ifdef PROJECT_REQUIRES_TK
!if $(PROJECT_REQUIRES_TK)
!ifdef TKDIR
_TKDIR = $(TKDIR:/=\)
!if exist("$(_TKDIR)\include\tk.h")
TKINSTALL = 1
_TK_H = $(_TKDIR)\include\tk.h
|
︙ | | |
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
-
+
|
# If INSTALLDIR set to tcl installation root dir then reset to the
# lib dir for installing extensions
!if exist("$(_INSTALLDIR)\include\tcl.h")
_INSTALLDIR=$(_INSTALLDIR)\lib
!endif
# END Case 2(c) or (d) - Building an extension
!endif # if $(PROJECT) == "tcl"
!endif # if $(DOING_TCL)
################################################################
# 3. Determine compiler version and architecture
# In this section, we figure out the compiler version and the
# architecture for which we are building. This sets the
# following macros:
# VCVERSION - the internal compiler version as 1200, 1400, 1910 etc.
|
︙ | | |
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
|
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
|
-
-
+
-
-
+
+
-
-
+
-
+
|
_VC_MANIFEST_EMBED_DLL=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:$@;2
!endif
!ifndef CFG_ENCODING
CFG_ENCODING = \"cp1252\"
!endif
!message =====================================================================
################################################################
# 4. Build the nmakehlp program
# This is a helper app we need to overcome nmake's limiting
# environment. We will call out to it to get various bits of
# information about supported compiler options etc.
#
# Tcl itself will always use the nmakehlp.c program which is
# in its own source. This is the "master" copy and kept updated.
#
# Extensions built against an installed Tcl will use the installed
# copy of Tcl's nmakehlp.c if there is one and their own version
# otherwise. In the latter case, they would also be using their own
# rules.vc. Note that older versions of Tcl do not install nmakehlp.c
# or rules.vc.
#
# Extensions built against Tcl sources will use the one from the Tcl source.
#
# When building an extension using a sufficiently new version of Tcl,
# This can all be overridden by defining the NMAKEHLPC macro to point
# to the nmakehlp.c file to be used, either from the command line or
# rules-ext.vc will define NMAKEHLPC appropriately to point to the
# copy of nmakehlp.c to be used.
# the containing makefile.
!ifndef NMAKEHLPC
# Default to the one in the current directory (the extension's own nmakehlp.c)
NMAKEHLPC = nmakehlp.c
!if "$(PROJECT)" != "tcl"
!if !$(DOING_TCL)
!if $(TCLINSTALL)
!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c")
NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c
!endif
!else # ! $(TCLINSTALL)
!if exist("$(_TCLDIR)\win\nmakehlp.c")
NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
!endif
!endif # $(TCLINSTALL)
!endif # $(PROJECT) != "tcl"
!endif # !$(DOING_TCL)
!endif # NMAKEHLPC
# We always build nmakehlp even if it exists since we do not know
# what source it was built from.
!message *** Using $(NMAKEHLPC)
!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
|
︙ | | |
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
|
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
|
-
+
|
PGO = 0
MSVCRT = 1
LOIMPACT = 0
TCL_USE_STATIC_PACKAGES = 0
USE_THREAD_ALLOC = 1
UNCHECKED = 0
CONFIG_CHECK = 1
!if "$(PROJECT)" == "tcl"
!if $(DOING_TCL)
USE_STUBS = 0
!else
USE_STUBS = 1
!endif
# If OPTS is not empty AND does not contain "none" which turns off all OPTS
# set the above macros based on OPTS content
|
︙ | | |
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
|
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
|
-
+
+
+
+
+
+
+
|
!message *** Doing 64bit portability warnings
WARNINGS = $(WARNINGS) -Wp64
!endif
!endif
################################################################
# 9. Extract various version numbers from tcl headers
# 9. Extract various version numbers
# For Tcl and Tk, version numbers are exctracted from tcl.h and tk.h
# respectively. For extensions, versions are extracted from the
# configure.in or configure.ac from the TEA configuration if it
# exists, and unset otherwise.
# Sets the following macros:
# TCL_MAJOR_VERSION
# TCL_MINOR_VERSION
# TCL_PATCH_LEVEL
# TCL_VERSION
# TK_MAJOR_VERSION
# TK_MINOR_VERSION
# TK_PATCH_LEVEL
# TK_VERSION
# DOTVERSION - set as (for example) 2.5
# VERSION - set as (for example 25)
#--------------------------------------------------------------
!if [echo REM = This file is generated from rules.vc > versions.vc]
!endif
!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
&& [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
!endif
|
︙ | | |
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
|
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
|
&& [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
!endif
!endif # _TK_H
!include versions.vc
TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
!if defined(_TK_H)
TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
!endif
# Set DOTVERSION and VERSION
!if $(DOING_TCL)
DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
VERSION = $(TCL_VERSION)
!elseif $(DOING_TK)
DOTVERSION = $(TK_DOTVERSION)
VERSION = $(TK_VERSION)
!else # Doing a non-Tk extension
# If parent makefile has not defined DOTVERSION, try to get it from TEA
# first from a configure.in file, and then from configure.ac
!ifndef DOTVERSION
!if [echo DOTVERSION = \> versions.vc] \
|| [nmakehlp -V $(ROOT)\configure.in AC_INIT >> versions.vc]
!if [echo DOTVERSION = \> versions.vc] \
|| [nmakehlp -V $(ROOT)\configure.ac AC_INIT >> versions.vc]
!error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc.
!endif
!endif
!include versions.vc
!endif # DOTVERSION
VERSION = $(DOTVERSION:.=)
!endif # $(DOING_TCL) ... etc.
################################################################
# 10. Construct output directory and file paths
# Figure-out how to name our intermediate and output directories.
# In order to avoid inadvertent mixing of object files built using
# different compilers, build configurations etc.,
#
# Naming convention (suffixes):
# t = full thread support.
# s = static library (as opposed to an import library)
# g = linked to the debug enabled C run-time.
# x = special static build when it links to the dynamic C run-time.
#
# The following macros are set in this section:
# SUFX - the suffix to use for binaries based on above naming convention
# BUILDDIRTOP - the toplevel default output directory
# is of the form {Release,Debug}[_AMD64][_COMPILERVERSION]
# TMP_DIR - directory where object files are created
# OUT_DIR - directory where output executables are created
# STUBPREFIX - name of the stubs library for this project
# Both TMP_DIR and OUT_DIR are defaulted only if not defined by the
# parent makefile (or command line). The default values are
# based on BUILDDIRTOP.
# STUBPREFIX - name of the stubs library for this project
# PRJIMPLIB - output path of the generated project import library
# PRJLIBNAME - name of generated project library
# PRJLIB - output path of generated project library
# PRJSTUBLIBNAME - name of the generated project stubs library
# PRJSTUBLIB - output path of the generated project stubs library
# RESFILE - output resource file (only if not static build)
SUFX = tsgx
!if $(DEBUG)
BUILDDIRTOP = Debug
!else
BUILDDIRTOP = Release
|
︙ | | |
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
|
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
|
-
+
-
+
|
!endif
!endif
# The name of the stubs library for the project being built
STUBPREFIX = $(PROJECT)stub
# Set up paths to various Tcl executables and libraries needed by extensions
!if "$(PROJECT)" == "tcl"
!if $(DOING_TCL)
TCLSHNAME = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe
TCLSH = $(OUT_DIR)\$(TCLSHNAME)
TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
TCLLIB = $(OUT_DIR)\$(TCLLIBNAME)
TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME)
TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)"
!else # $(PROJECT) is not "tcl"
!else # ! $(DOING_TCL)
!if $(TCLINSTALL) # Building against an installed Tcl
TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe
!if !exist("$(TCLSH)") && $(TCL_THREADS)
TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe
!endif
|
︙ | | |
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
|
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
|
-
+
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
|
TCLTOOLSDIR = $(_TCLDIR)\tools
TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
!endif # TCLINSTALL
tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)"
!endif $(PROJECT) != "tcl"
!endif # $(DOING_TCL)
# We need a tclsh that will run on the host machine as part of the build.
# IX86 runs on all architectures.
!ifndef TCLSH_NATIVE
!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
TCLSH_NATIVE = $(TCLSH)
!else
!error You must explicitly set TCLSH_NATIVE for cross-compilation
!endif
!endif
# Do the same for Tk and Tk extensions that require the Tk libraries
!if "$(PROJECT)" == "tk" || defined(PROJECT_REQUIRES_TK)
!if $(DOING_TK) || $(PROJECT_REQUIRES_TK)
WISHNAMEPREFIX = wish
WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
TKSTUBLIBNAME = tkstub$(TK_VERSION).lib
TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib
!if "$(PROJECT)" == "tk"
!if $(DOING_TK)
WISH = $(OUT_DIR)\$(WISHNAME)
TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME)
TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME)
TKLIB = $(OUT_DIR)\$(TKLIBNAME)
TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)"
!else # effectively PROJECT_REQUIRES_TK
!if $(TKINSTALL) # Building against installed Tk
WISH = $(_TKDIR)\bin\$(WISHNAME)
TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME)
TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME)
TK_INCLUDES = -I"$(_TKDIR)\include"
!else # Building against Tk sources
WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME)
TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME)
TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
!endif # TKINSTALL
!endif # $(PROJECT) == tk
!endif # $(PROJECT) == tk || PROJECT_REQUIRES_TK
!endif # $(DOING_TK)
!endif # $(DOING_TK) || $(PROJECT_REQUIRES_TK)
# Various output paths
PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
PRJLIB = $(OUT_DIR)\$(PRJLIBNAME)
PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME)
# If extension parent makefile has not defined a resource definition file,
# we will generate one from standard template.
!if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD)
!ifdef RCFILE
RESFILE = $(RCFILE:.rc=.res)
!else
RESFILE = $(TMP_DIR)\$(PROJECT).res
!endif
!endif
###################################################################
# 11. Construct the paths for the installation directories
# The following macros get defined in this section:
# LIB_INSTALL_DIR - where libraries should be installed
# BIN_INSTALL_DIR - where the executables should be installed
# DOC_INSTALL_DIR - where documentation should be installed
# SCRIPT_INSTALL_DIR - where scripts should be installed
# INCLUDE_INSTALL_DIR - where C include files should be installed
# DEMO_INSTALL_DIR - where demos should be installed
# PRJ_INSTALL_DIR - where package will be installed (not set for tcl and tk)
!if "$(PROJECT)" == "tcl" || "$(PROJECT)" == "tk"
!if $(DOING_TCL) || $(DOING_TK)
LIB_INSTALL_DIR = $(_INSTALLDIR)\lib
BIN_INSTALL_DIR = $(_INSTALLDIR)\bin
DOC_INSTALL_DIR = $(_INSTALLDIR)\doc
!if "$(PROJECT)" == "tcl"
!if $(DOING_TCL)
SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
!else
!else # DOING_TK
SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
!endif
DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos
INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include
!else
!else # extension other than Tk
PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR)
BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR)
DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR)
SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR)
DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos
|
︙ | | |
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
|
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
|
-
+
-
+
|
!if $(TCL_NO_DEPRECATED)
OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED
!endif
!if $(USE_STUBS)
# Note we do not define USE_TCL_STUBS even when building tk since some
# test targets in tk do not use stubs
!if "$(PROJECT)" != "tcl"
!if ! $(DOING_TCL)
USE_STUBS_DEFS = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS
!ifdef PROJECT_REQUIRES_TK
!if $(PROJECT_REQUIRES_TK)
USE_STUBS_DEFS = $(USE_STUBS_DEFS) -DUSE_TK_STUBS
!endif
!endif
!endif # USE_STUBS
!if !$(DEBUG)
OPTDEFINES = $(OPTDEFINES) -DNDEBUG
|
︙ | | |
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
|
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
|
-
+
+
+
+
+
+
+
|
!if $(VCVERSION) < 1300
OPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64
!endif
# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
COMPILERFLAGS = /D_ATL_XP_TARGETING
# Following is primarily for the benefit of extensions. Tcl 8.5 builds
# Tcl without /DUNICODE, while 8.6 builds with it defined. When building
# an extension, it is advisable (but not mandated) to use the same Windows
# API as the Tcl build. This is accordingly defaulted below. A particular
# extension can override this by pre-definining USE_WIDECHAR_API.
!ifndef USE_WIDECHAR_API
!if $(TCL_VERSION) > 85
USE_WIDECHAR_API = 1
!else
USE_WIDECHAR_API = 0
!endif
!endif
!if $(USE_WIDECHAR_API)
COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE
!endif
# Like the TEA system only set this non empty for non-Tk extensions
!if !$(DOING_TCL) && !$(DOING_TK)
PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \
-DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
-DMODULE_SCOPE=extern
!endif
# crt picks the C run time based on selected OPTS
!if $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
|
︙ | | |
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
|
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
|
-
-
+
+
|
# object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus
# flags used for building shared object files The two differ in the
# BUILD_$(PROJECT) macro which should be defined only for the shared
# library *implementation* and not for its caller interface
appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS)
appcflags_nostubs = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES)
pkgcflags = $(appcflags) -DBUILD_$(PROJECT)
pkgcflags_nostubs = $(appcflags_nostubs) -DBUILD_$(PROJECT)
pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT)
pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT)
# stubscflags contains $(cflags) plus flags used for building a stubs
# library for the package. Note: -DSTATIC_BUILD is defined in
# $(OPTDEFINES) only if the OPTS configuration indicates a static
# library. However the stubs library is ALWAYS static hence included
# here irrespective of the OPTS setting.
|
︙ | | |
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
|
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
|
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
-
+
|
!else
MAKEBINCMD = $(MAKEDLLCMD)
!endif
MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs)
MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs)
MAKERESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
$(TCL_INCLUDES) \
-d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
-d TCL_THREADS=$(TCL_THREADS) \
-d STATIC_BUILD=$(STATIC_BUILD) \
$<
!ifndef DISABLE_DEFAULT_TARGETS
-DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
-DCOMMAVERSION=$(DOTVERSION:.=,),0 \
-DDOTVERSION=\"$(DOTVERSION)\" \
-DVERSION=\"$(VERSION)\" \
-DSUFX=\"$(SUFX)\" \
-DPROJECT=\"$(PROJECT)\" \
-DPRJLIBNAME=\"$(PRJLIBNAME)\"
!ifndef DEFAULT_BUILD_TARGET
DEFAULT_BUILD_TARGET = all
DEFAULT_BUILD_TARGET = $(PROJECT)
!endif
default_target: $(DEFAULT_BUILD_TARGET)
default-target: $(DEFAULT_BUILD_TARGET)
default-pkgindex:
@echo package ifneeded $(PROJECT) $(DOTVERSION) \
[list load [file join $$dir $(PRJLIBNAME)]] >> $(OUT_DIR)\pkgIndex.tcl
setup:
@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
default-pkgindex-tea:
@if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl
@PACKAGE_VERSION@ $(DOTVERSION)
@PACKAGE_NAME@ $(PROJECT)
@PKG_LIB_FILE@ $(PRJLIBNAME)
<<
default-install: default-install-binaries default-install-libraries
default-install-binaries: $(PRJLIB)
@echo Installing binaries to '$(SCRIPT_INSTALL_DIR)'
@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
@$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
default-install-libraries: $(OUT_DIR)\pkgIndex.tcl
@echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
@if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
@echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
@$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR)
clean:
default-clean:
@echo Cleaning $(TMP_DIR)\* ...
@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
@echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ...
@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
@echo Cleaning $(WINDIR)\_junk.pch ...
@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
@echo Cleaning $(WINDIR)\vercl.x, vercl.i ...
@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
@echo Cleaning $(WINDIR)\versions.vc, version.vc ...
@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
realclean: hose
hose:
default-hose:
@echo Hosing $(OUT_DIR)\* ...
@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
default-distclean: default-hose
@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
default-setup:
@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
!ifndef RCFILE
# If parent makefile has not defined a resource definition file,
# we will generate one from standard template.
$(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc
$(TMP_DIR)\$(PROJECT).rc:
@$(COPY) << $(TMP_DIR)\$(PROJECT).rc
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION COMMAVERSION
PRODUCTVERSION COMMAVERSION
FILEFLAGSMASK 0x3fL
#ifdef DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
!endif
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Tcl extension " PROJECT
VALUE "OriginalFilename", PRJLIBNAME
VALUE "FileVersion", DOTVERSION
VALUE "ProductName", "Package " PROJECT " for Tcl"
VALUE "ProductVersion", DOTVERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
<<
!endif # ifndef RCFILE
!ifndef DISABLE_IMPLICIT_RULES
DISABLE_IMPLICIT_RULES = 0
!endif
!if !$(DISABLE_IMPLICIT_RULES)
# Implicit rule definitions - only for building library objects. For stubs and
# main application, the master makefile should define explicit rules.
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
$<
<<
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
$<
<<
{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
$<
<<
{$(RCDIR)}.rc{$(TMP_DIR)}.res:
$(MAKERESCMD)
$(MAKERESCMD) $<
{$(WINDIR)}.rc{$(TMP_DIR)}.res:
$(MAKERESCMD)
$(MAKERESCMD) $<
{$(TMP_DIR)}.rc{$(TMP_DIR)}.res:
$(MAKERESCMD) $<
.SUFFIXES:
.SUFFIXES:.c .rc
!endif
################################################################
# 14. Sanity check selected options against Tcl build options
# When building an extension, certain configuration options should
# match the ones used when Tcl was built. Here we check and
# warn on a mismatch.
!if "$(PROJECT)" != "tcl"
!if ! $(DOING_TCL)
!if $(TCLINSTALL) # Building against an installed Tcl
!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake")
TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake"
!endif
!else # ! $(TCLINSTALL) - building against Tcl source
!if exist("$(OUT_DIR)\tcl.nmake")
|
︙ | | |
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
|
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
|
-
+
|
!if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG)
!message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)).
!endif
!endif
!endif # TCLNMAKECONFIG
!endif # $(PROJECT) == "tcl"
!endif # ! $(DOING_TCL)
#----------------------------------------------------------
# Display stats being used.
#----------------------------------------------------------
!message *** Intermediate directory will be '$(TMP_DIR)'
|
︙ | | |