rules.vc 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920
  1. #------------------------------------------------------------- -*- makefile -*-
  2. # rules.vc --
  3. #
  4. # Part of the nmake based build system for Tcl and its extensions.
  5. # This file does all the hard work in terms of parsing build options,
  6. # compiler switches, defining common targets and macros. The Tcl makefile
  7. # directly includes this. Extensions include it via "rules-ext.vc".
  8. #
  9. # See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for
  10. # detailed documentation.
  11. #
  12. # See the file "license.terms" for information on usage and redistribution
  13. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  14. #
  15. # Copyright (c) 2001-2003 David Gravereaux.
  16. # Copyright (c) 2003-2008 Patrick Thoyts
  17. # Copyright (c) 2017 Ashok P. Nadkarni
  18. #------------------------------------------------------------------------------
  19. !ifndef _RULES_VC
  20. _RULES_VC = 1
  21. # The following macros define the version of the rules.vc nmake build system
  22. # For modifications that are not backward-compatible, you *must* change
  23. # the major version.
  24. RULES_VERSION_MAJOR = 1
  25. RULES_VERSION_MINOR = 13
  26. # The PROJECT macro must be defined by parent makefile.
  27. !if "$(PROJECT)" == ""
  28. !error *** Error: Macro PROJECT not defined! Please define it before including rules.vc
  29. !endif
  30. !if "$(PRJ_PACKAGE_TCLNAME)" == ""
  31. PRJ_PACKAGE_TCLNAME = $(PROJECT)
  32. !endif
  33. # Also special case Tcl and Tk to save some typing later
  34. DOING_TCL = 0
  35. DOING_TK = 0
  36. !if "$(PROJECT)" == "tcl"
  37. DOING_TCL = 1
  38. !elseif "$(PROJECT)" == "tk"
  39. DOING_TK = 1
  40. !endif
  41. !ifndef NEED_TK
  42. # Backwards compatibility
  43. !ifdef PROJECT_REQUIRES_TK
  44. NEED_TK = $(PROJECT_REQUIRES_TK)
  45. !else
  46. NEED_TK = 0
  47. !endif
  48. !endif
  49. !ifndef NEED_TCL_SOURCE
  50. NEED_TCL_SOURCE = 0
  51. !endif
  52. !ifdef NEED_TK_SOURCE
  53. !if $(NEED_TK_SOURCE)
  54. NEED_TK = 1
  55. !endif
  56. !else
  57. NEED_TK_SOURCE = 0
  58. !endif
  59. ################################################################
  60. # Nmake is a pretty weak environment in syntax and capabilities
  61. # so this file is necessarily verbose. It's broken down into
  62. # the following parts.
  63. #
  64. # 0. Sanity check that compiler environment is set up and initialize
  65. # any built-in settings from the parent makefile
  66. # 1. First define the external tools used for compiling, copying etc.
  67. # as this is independent of everything else.
  68. # 2. Figure out our build structure in terms of the directory, whether
  69. # we are building Tcl or an extension, etc.
  70. # 3. Determine the compiler and linker versions
  71. # 4. Build the nmakehlp helper application
  72. # 5. Determine the supported compiler options and features
  73. # 6. Extract Tcl, Tk, and possibly extensions, version numbers from the
  74. # headers
  75. # 7. Parse the OPTS macro value for user-specified build configuration
  76. # 8. Parse the STATS macro value for statistics instrumentation
  77. # 9. Parse the CHECKS macro for additional compilation checks
  78. # 10. Based on this selected configuration, construct the output
  79. # directory and file paths
  80. # 11. Construct the paths where the package is to be installed
  81. # 12. Set up the actual options passed to compiler and linker based
  82. # on the information gathered above.
  83. # 13. Define some standard build targets and implicit rules. These may
  84. # be optionally disabled by the parent makefile.
  85. # 14. (For extensions only.) Compare the configuration of the target
  86. # Tcl and the extensions and warn against discrepancies.
  87. #
  88. # One final note about the macro names used. They are as they are
  89. # for historical reasons. We would like legacy extensions to
  90. # continue to work with this make include file so be wary of
  91. # changing them for consistency or clarity.
  92. # 0. Sanity check compiler environment
  93. # Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
  94. # VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
  95. !if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
  96. MSG = ^
  97. Visual C++ compiler environment not initialized.
  98. !error $(MSG)
  99. !endif
  100. # We need to run from the directory the parent makefile is located in.
  101. # nmake does not tell us what makefile was used to invoke it so parent
  102. # makefile has to set the MAKEFILEVC macro or we just make a guess and
  103. # warn if we think that is not the case.
  104. !if "$(MAKEFILEVC)" == ""
  105. !if exist("$(PROJECT).vc")
  106. MAKEFILEVC = $(PROJECT).vc
  107. !elseif exist("makefile.vc")
  108. MAKEFILEVC = makefile.vc
  109. !endif
  110. !endif # "$(MAKEFILEVC)" == ""
  111. !if !exist("$(MAKEFILEVC)")
  112. MSG = ^
  113. You must run nmake from the directory containing the project makefile.^
  114. If you are doing that and getting this message, set the MAKEFILEVC^
  115. macro to the name of the project makefile.
  116. !message WARNING: $(MSG)
  117. !endif
  118. ################################################################
  119. # 1. Define external programs being used
  120. #----------------------------------------------------------
  121. # Set the proper copy method to avoid overwrite questions
  122. # to the user when copying files and selecting the right
  123. # "delete all" method.
  124. #----------------------------------------------------------
  125. RMDIR = rmdir /S /Q
  126. CPY = xcopy /i /y >NUL
  127. CPYDIR = xcopy /e /i /y >NUL
  128. COPY = copy /y >NUL
  129. MKDIR = mkdir
  130. ######################################################################
  131. # 2. Figure out our build environment in terms of what we're building.
  132. #
  133. # (a) Tcl itself
  134. # (b) Tk
  135. # (c) a Tcl extension using libraries/includes from an *installed* Tcl
  136. # (d) a Tcl extension using libraries/includes from Tcl source directory
  137. #
  138. # This last is needed because some extensions still need
  139. # some Tcl interfaces that are not publicly exposed.
  140. #
  141. # The fragment will set the following macros:
  142. # ROOT - root of this module sources
  143. # COMPATDIR - source directory that holds compatibility sources
  144. # DOCDIR - source directory containing documentation files
  145. # GENERICDIR - platform-independent source directory
  146. # WIN_DIR - Windows-specific source directory
  147. # TESTDIR - directory containing test files
  148. # TOOLSDIR - directory containing build tools
  149. # _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set
  150. # when building Tcl itself.
  151. # _INSTALLDIR - native form of the installation path. For Tcl
  152. # this will be the root of the Tcl installation. For extensions
  153. # this will be the lib directory under the root.
  154. # TCLINSTALL - set to 1 if _TCLDIR refers to
  155. # headers and libraries from an installed Tcl, and 0 if built against
  156. # Tcl sources. Not set when building Tcl itself. Yes, not very well
  157. # named.
  158. # _TCL_H - native path to the tcl.h file
  159. #
  160. # If Tk is involved, also sets the following
  161. # _TKDIR - native form Tk installation OR Tk source. Not set if building
  162. # Tk itself.
  163. # TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources
  164. # _TK_H - native path to the tk.h file
  165. # Root directory for sources and assumed subdirectories
  166. ROOT = $(MAKEDIR)\..
  167. # The following paths CANNOT have spaces in them as they appear on the
  168. # left side of implicit rules.
  169. !ifndef COMPATDIR
  170. COMPATDIR = $(ROOT)\compat
  171. !endif
  172. !ifndef DOCDIR
  173. DOCDIR = $(ROOT)\doc
  174. !endif
  175. !ifndef GENERICDIR
  176. GENERICDIR = $(ROOT)\generic
  177. !endif
  178. !ifndef TOOLSDIR
  179. TOOLSDIR = $(ROOT)\tools
  180. !endif
  181. !ifndef TESTDIR
  182. TESTDIR = $(ROOT)\tests
  183. !endif
  184. !ifndef LIBDIR
  185. !if exist("$(ROOT)\library")
  186. LIBDIR = $(ROOT)\library
  187. !else
  188. LIBDIR = $(ROOT)\lib
  189. !endif
  190. !endif
  191. !ifndef DEMODIR
  192. !if exist("$(LIBDIR)\demos")
  193. DEMODIR = $(LIBDIR)\demos
  194. !else
  195. DEMODIR = $(ROOT)\demos
  196. !endif
  197. !endif # ifndef DEMODIR
  198. # Do NOT use WINDIR because it is Windows internal environment
  199. # variable to point to c:\windows!
  200. WIN_DIR = $(ROOT)\win
  201. !ifndef RCDIR
  202. !if exist("$(WIN_DIR)\rc")
  203. RCDIR = $(WIN_DIR)\rc
  204. !else
  205. RCDIR = $(WIN_DIR)
  206. !endif
  207. !endif
  208. RCDIR = $(RCDIR:/=\)
  209. # The target directory where the built packages and binaries will be installed.
  210. # INSTALLDIR is the (optional) path specified by the user.
  211. # _INSTALLDIR is INSTALLDIR using the backslash separator syntax
  212. !ifdef INSTALLDIR
  213. ### Fix the path separators.
  214. _INSTALLDIR = $(INSTALLDIR:/=\)
  215. !else
  216. ### Assume the normal default.
  217. _INSTALLDIR = $(HOMEDRIVE)\Tcl
  218. !endif
  219. !if $(DOING_TCL)
  220. # BEGIN Case 2(a) - Building Tcl itself
  221. # Only need to define _TCL_H
  222. _TCL_H = ..\generic\tcl.h
  223. # END Case 2(a) - Building Tcl itself
  224. !elseif $(DOING_TK)
  225. # BEGIN Case 2(b) - Building Tk
  226. TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl
  227. !if "$(TCLDIR)" == ""
  228. !if [echo TCLDIR = \> nmakehlp.out] \
  229. || [nmakehlp -L generic\tcl.h >> nmakehlp.out]
  230. !error *** Could not locate Tcl source directory.
  231. !endif
  232. !include nmakehlp.out
  233. !endif # TCLDIR == ""
  234. _TCLDIR = $(TCLDIR:/=\)
  235. _TCL_H = $(_TCLDIR)\generic\tcl.h
  236. !if !exist("$(_TCL_H)")
  237. !error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory.
  238. !endif
  239. _TK_H = ..\generic\tk.h
  240. # END Case 2(b) - Building Tk
  241. !else
  242. # BEGIN Case 2(c) or (d) - Building an extension other than Tk
  243. # If command line has specified Tcl location through TCLDIR, use it
  244. # else default to the INSTALLDIR setting
  245. !if "$(TCLDIR)" != ""
  246. _TCLDIR = $(TCLDIR:/=\)
  247. !if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined
  248. TCLINSTALL = 1
  249. _TCL_H = $(_TCLDIR)\include\tcl.h
  250. !elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined
  251. TCLINSTALL = 0
  252. _TCL_H = $(_TCLDIR)\generic\tcl.h
  253. !endif
  254. !else # # Case 2(c) for extensions with TCLDIR undefined
  255. # Need to locate Tcl depending on whether it needs Tcl source or not.
  256. # If we don't, check the INSTALLDIR for an installed Tcl first
  257. !if exist("$(_INSTALLDIR)\include\tcl.h") && !$(NEED_TCL_SOURCE)
  258. TCLINSTALL = 1
  259. TCLDIR = $(_INSTALLDIR)\..
  260. # NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions
  261. # later so the \.. accounts for the /lib
  262. _TCLDIR = $(_INSTALLDIR)\..
  263. _TCL_H = $(_TCLDIR)\include\tcl.h
  264. !else # exist(...) && !$(NEED_TCL_SOURCE)
  265. !if [echo _TCLDIR = \> nmakehlp.out] \
  266. || [nmakehlp -L generic\tcl.h >> nmakehlp.out]
  267. !error *** Could not locate Tcl source directory.
  268. !endif
  269. !include nmakehlp.out
  270. TCLINSTALL = 0
  271. TCLDIR = $(_TCLDIR)
  272. _TCL_H = $(_TCLDIR)\generic\tcl.h
  273. !endif # exist(...) && !$(NEED_TCL_SOURCE)
  274. !endif # TCLDIR
  275. !ifndef _TCL_H
  276. MSG =^
  277. Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h.
  278. !error $(MSG)
  279. !endif
  280. # Now do the same to locate Tk headers and libs if project requires Tk
  281. !if $(NEED_TK)
  282. !if "$(TKDIR)" != ""
  283. _TKDIR = $(TKDIR:/=\)
  284. !if exist("$(_TKDIR)\include\tk.h")
  285. TKINSTALL = 1
  286. _TK_H = $(_TKDIR)\include\tk.h
  287. !elseif exist("$(_TKDIR)\generic\tk.h")
  288. TKINSTALL = 0
  289. _TK_H = $(_TKDIR)\generic\tk.h
  290. !endif
  291. !else # TKDIR not defined
  292. # Need to locate Tcl depending on whether it needs Tcl source or not.
  293. # If we don't, check the INSTALLDIR for an installed Tcl first
  294. !if exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE)
  295. TKINSTALL = 1
  296. # NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions
  297. # later so the \.. accounts for the /lib
  298. _TKDIR = $(_INSTALLDIR)\..
  299. _TK_H = $(_TKDIR)\include\tk.h
  300. TKDIR = $(_TKDIR)
  301. !else # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE)
  302. !if [echo _TKDIR = \> nmakehlp.out] \
  303. || [nmakehlp -L generic\tk.h >> nmakehlp.out]
  304. !error *** Could not locate Tk source directory.
  305. !endif
  306. !include nmakehlp.out
  307. TKINSTALL = 0
  308. TKDIR = $(_TKDIR)
  309. _TK_H = $(_TKDIR)\generic\tk.h
  310. !endif # exist("$(_INSTALLDIR)\include\tk.h") && !$(NEED_TK_SOURCE)
  311. !endif # TKDIR
  312. !ifndef _TK_H
  313. MSG =^
  314. Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and default path does not contain tk.h.
  315. !error $(MSG)
  316. !endif
  317. !endif # NEED_TK
  318. !if $(NEED_TCL_SOURCE) && $(TCLINSTALL)
  319. MSG = ^
  320. *** Warning: This extension requires the source distribution of Tcl.^
  321. *** Please set the TCLDIR macro to point to the Tcl sources.
  322. !error $(MSG)
  323. !endif
  324. !if $(NEED_TK_SOURCE)
  325. !if $(TKINSTALL)
  326. MSG = ^
  327. *** Warning: This extension requires the source distribution of Tk.^
  328. *** Please set the TKDIR macro to point to the Tk sources.
  329. !error $(MSG)
  330. !endif
  331. !endif
  332. # If INSTALLDIR set to Tcl installation root dir then reset to the
  333. # lib dir for installing extensions
  334. !if exist("$(_INSTALLDIR)\include\tcl.h")
  335. _INSTALLDIR=$(_INSTALLDIR)\lib
  336. !endif
  337. # END Case 2(c) or (d) - Building an extension
  338. !endif # if $(DOING_TCL)
  339. ################################################################
  340. # 3. Determine compiler version and architecture
  341. # In this section, we figure out the compiler version and the
  342. # architecture for which we are building. This sets the
  343. # following macros:
  344. # VCVERSION - the internal compiler version as 1200, 1400, 1910 etc.
  345. # This is also printed by the compiler in dotted form 19.10 etc.
  346. # VCVER - the "marketing version", for example Visual C++ 6 for internal
  347. # compiler version 1200. This is kept only for legacy reasons as it
  348. # does not make sense for recent Microsoft compilers. Only used for
  349. # output directory names.
  350. # ARCH - set to IX86, ARM64 or AMD64 depending on 32- or 64-bit target
  351. # NATIVE_ARCH - set to IX86, ARM64 or AMD64 for the host machine
  352. # MACHINE - same as $(ARCH) - legacy
  353. # _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
  354. cc32 = $(CC) # built-in default.
  355. link32 = link
  356. lib32 = lib
  357. rc32 = $(RC) # built-in default.
  358. #----------------------------------------------------------------
  359. # Figure out the compiler architecture and version by writing
  360. # the C macros to a file, preprocessing them with the C
  361. # preprocessor and reading back the created file
  362. _HASH=^#
  363. _VC_MANIFEST_EMBED_EXE=
  364. _VC_MANIFEST_EMBED_DLL=
  365. VCVER=0
  366. !if ![echo VCVERSION=_MSC_VER > vercl.x] \
  367. && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
  368. && ![echo ARCH=IX86 >> vercl.x] \
  369. && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
  370. && ![echo ARCH=AMD64 >> vercl.x] \
  371. && ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \
  372. && ![echo ARCH=ARM64 >> vercl.x] \
  373. && ![echo $(_HASH)endif >> vercl.x] \
  374. && ![$(cc32) -nologo -TC -P vercl.x 2>NUL]
  375. !include vercl.i
  376. !if $(VCVERSION) < 1900
  377. !if ![echo VCVER= ^\> vercl.vc] \
  378. && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
  379. !include vercl.vc
  380. !endif
  381. !else
  382. # The simple calculation above does not apply to new Visual Studio releases
  383. # Keep the compiler version in its native form.
  384. VCVER = $(VCVERSION)
  385. !endif
  386. !endif
  387. !if ![del 2>NUL /q/f vercl.x vercl.i vercl.vc]
  388. !endif
  389. #----------------------------------------------------------------
  390. # The MACHINE macro is used by legacy makefiles so set it as well
  391. !ifdef MACHINE
  392. !if "$(MACHINE)" == "x86"
  393. !undef MACHINE
  394. MACHINE = IX86
  395. !elseif "$(MACHINE)" == "arm64"
  396. !undef MACHINE
  397. MACHINE = ARM64
  398. !elseif "$(MACHINE)" == "x64"
  399. !undef MACHINE
  400. MACHINE = AMD64
  401. !endif
  402. !if "$(MACHINE)" != "$(ARCH)"
  403. !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH).
  404. !endif
  405. !else
  406. MACHINE=$(ARCH)
  407. !endif
  408. #---------------------------------------------------------------
  409. # The PLATFORM_IDENTIFY macro matches the values returned by
  410. # the Tcl platform::identify command
  411. !if "$(MACHINE)" == "AMD64"
  412. PLATFORM_IDENTIFY = win32-x86_64
  413. !elseif "$(MACHINE)" == "ARM64"
  414. PLATFORM_IDENTIFY = win32-arm
  415. !else
  416. PLATFORM_IDENTIFY = win32-ix86
  417. !endif
  418. # The MULTIPLATFORM macro controls whether binary extensions are installed
  419. # in platform-specific directories. Intended to be set/used by extensions.
  420. !ifndef MULTIPLATFORM_INSTALL
  421. MULTIPLATFORM_INSTALL = 0
  422. !endif
  423. #------------------------------------------------------------
  424. # Figure out the *host* architecture by reading the registry
  425. !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
  426. NATIVE_ARCH=IX86
  427. !elseif ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i ARM | findstr /i 64-bit]
  428. NATIVE_ARCH=ARM64
  429. !else
  430. NATIVE_ARCH=AMD64
  431. !endif
  432. # Since MSVC8 we must deal with manifest resources.
  433. !if $(VCVERSION) >= 1400
  434. _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
  435. _VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
  436. !endif
  437. ################################################################
  438. # 4. Build the nmakehlp program
  439. # This is a helper app we need to overcome nmake's limiting
  440. # environment. We will call out to it to get various bits of
  441. # information about supported compiler options etc.
  442. #
  443. # Tcl itself will always use the nmakehlp.c program which is
  444. # in its own source. It will be kept updated there.
  445. #
  446. # Extensions built against an installed Tcl will use the installed
  447. # copy of Tcl's nmakehlp.c if there is one and their own version
  448. # otherwise. In the latter case, they would also be using their own
  449. # rules.vc. Note that older versions of Tcl do not install nmakehlp.c
  450. # or rules.vc.
  451. #
  452. # Extensions built against Tcl sources will use the one from the Tcl source.
  453. #
  454. # When building an extension using a sufficiently new version of Tcl,
  455. # rules-ext.vc will define NMAKEHLPC appropriately to point to the
  456. # copy of nmakehlp.c to be used.
  457. !ifndef NMAKEHLPC
  458. # Default to the one in the current directory (the extension's own nmakehlp.c)
  459. NMAKEHLPC = nmakehlp.c
  460. !if !$(DOING_TCL)
  461. !if $(TCLINSTALL)
  462. !if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c")
  463. NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c
  464. !endif
  465. !else # !$(TCLINSTALL)
  466. !if exist("$(_TCLDIR)\win\nmakehlp.c")
  467. NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
  468. !endif
  469. !endif # $(TCLINSTALL)
  470. !endif # !$(DOING_TCL)
  471. !endif # NMAKEHLPC
  472. # We always build nmakehlp even if it exists since we do not know
  473. # what source it was built from.
  474. !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
  475. !if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
  476. !endif
  477. !else
  478. !if [copy $(NMAKEHLPC:nmakehlp.c=x86_64-w64-mingw32-nmakehlp.exe) nmakehlp.exe >NUL]
  479. !endif
  480. !endif
  481. ################################################################
  482. # 5. Test for compiler features
  483. # Visual C++ compiler options have changed over the years. Check
  484. # which options are supported by the compiler in use.
  485. #
  486. # The following macros are set:
  487. # OPTIMIZATIONS - the compiler flags to be used for optimized builds
  488. # DEBUGFLAGS - the compiler flags to be used for debug builds
  489. # LINKERFLAGS - Flags passed to the linker
  490. #
  491. # Note that these are the compiler settings *available*, not those
  492. # that will be *used*. The latter depends on the OPTS macro settings
  493. # which we have not yet parsed.
  494. #
  495. # Also note that some of the flags in OPTIMIZATIONS are not really
  496. # related to optimization. They are placed there only for legacy reasons
  497. # as some extensions expect them to be included in that macro.
  498. # -Op improves float consistency. Note only needed for older compilers
  499. # Newer compilers do not need or support this option.
  500. !if [nmakehlp -c -Op]
  501. FPOPTS = -Op
  502. !endif
  503. # Strict floating point semantics - present in newer compilers in lieu of -Op
  504. !if [nmakehlp -c -fp:strict]
  505. FPOPTS = $(FPOPTS) -fp:strict
  506. !endif
  507. !if "$(MACHINE)" == "IX86"
  508. ### test for pentium errata
  509. !if [nmakehlp -c -QI0f]
  510. !message *** Compiler has 'Pentium 0x0f fix'
  511. FPOPTS = $(FPOPTS) -QI0f
  512. !else
  513. !message *** Compiler does not have 'Pentium 0x0f fix'
  514. !endif
  515. !endif
  516. ### test for optimizations
  517. # /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per
  518. # documentation. Note we do NOT want /Gs as that inserts a _chkstk
  519. # stack probe at *every* function entry, not just those with more than
  520. # a page of stack allocation resulting in a performance hit. However,
  521. # /O2 documentation is misleading as its stack probes are simply the
  522. # default page size locals allocation probes and not what is implied
  523. # by an explicit /Gs option.
  524. OPTIMIZATIONS = $(FPOPTS)
  525. !if [nmakehlp -c -O2]
  526. OPTIMIZING = 1
  527. OPTIMIZATIONS = $(OPTIMIZATIONS) -O2
  528. !else
  529. # Legacy, really. All modern compilers support this
  530. !message *** Compiler does not have 'Optimizations'
  531. OPTIMIZING = 0
  532. !endif
  533. # Checks for buffer overflows in local arrays
  534. !if [nmakehlp -c -GS]
  535. OPTIMIZATIONS = $(OPTIMIZATIONS) -GS
  536. !endif
  537. # Link time optimization. Note that this option (potentially) makes
  538. # generated libraries only usable by the specific VC++ version that
  539. # created it. Requires /LTCG linker option
  540. !if [nmakehlp -c -GL]
  541. OPTIMIZATIONS = $(OPTIMIZATIONS) -GL
  542. CC_GL_OPT_ENABLED = 1
  543. !else
  544. # In newer compilers -GL and -YX are incompatible.
  545. !if [nmakehlp -c -YX]
  546. OPTIMIZATIONS = $(OPTIMIZATIONS) -YX
  547. !endif
  548. !endif # [nmakehlp -c -GL]
  549. DEBUGFLAGS = $(FPOPTS)
  550. # Run time error checks. Not available or valid in a release, non-debug build
  551. # RTC is for modern compilers, -GZ is legacy
  552. !if [nmakehlp -c -RTC1]
  553. DEBUGFLAGS = $(DEBUGFLAGS) -RTC1
  554. !elseif [nmakehlp -c -GZ]
  555. DEBUGFLAGS = $(DEBUGFLAGS) -GZ
  556. !endif
  557. #----------------------------------------------------------------
  558. # Linker flags
  559. # LINKER_TESTFLAGS are for internal use when we call nmakehlp to test
  560. # if the linker supports a specific option. Without these flags link will
  561. # return "LNK1561: entry point must be defined" error compiling from VS-IDE:
  562. # They are not passed through to the actual application / extension
  563. # link rules.
  564. !ifndef LINKER_TESTFLAGS
  565. LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmakehlp.out
  566. !endif
  567. LINKERFLAGS =
  568. # If compiler has enabled link time optimization, linker must too with -ltcg
  569. !ifdef CC_GL_OPT_ENABLED
  570. !if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)]
  571. LINKERFLAGS = $(LINKERFLAGS) -ltcg
  572. !endif
  573. !endif
  574. ################################################################
  575. # 6. Extract various version numbers from headers
  576. # For Tcl and Tk, version numbers are extracted from tcl.h and tk.h
  577. # respectively. For extensions, versions are extracted from the
  578. # configure.in or configure.ac from the TEA configuration if it
  579. # exists, and unset otherwise.
  580. # Sets the following macros:
  581. # TCL_MAJOR_VERSION
  582. # TCL_MINOR_VERSION
  583. # TCL_RELEASE_SERIAL
  584. # TCL_PATCH_LEVEL
  585. # TCL_PATCH_LETTER
  586. # TCL_VERSION
  587. # TK_MAJOR_VERSION
  588. # TK_MINOR_VERSION
  589. # TK_RELEASE_SERIAL
  590. # TK_PATCH_LEVEL
  591. # TK_PATCH_LETTER
  592. # TK_VERSION
  593. # DOTVERSION - set as (for example) 2.5
  594. # VERSION - set as (for example 25)
  595. #--------------------------------------------------------------
  596. !if [echo REM = This file is generated from rules.vc > versions.vc]
  597. !endif
  598. !if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
  599. && [nmakehlp -V "$(_TCL_H)" "define TCL_MAJOR_VERSION" >> versions.vc]
  600. !endif
  601. !if [echo TCL_MINOR_VERSION = \>> versions.vc] \
  602. && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
  603. !endif
  604. !if [echo TCL_RELEASE_SERIAL = \>> versions.vc] \
  605. && [nmakehlp -V "$(_TCL_H)" TCL_RELEASE_SERIAL >> versions.vc]
  606. !endif
  607. !if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
  608. && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
  609. !endif
  610. !if defined(_TK_H)
  611. !if [echo TK_MAJOR_VERSION = \>> versions.vc] \
  612. && [nmakehlp -V $(_TK_H) "define TK_MAJOR_VERSION" >> versions.vc]
  613. !endif
  614. !if [echo TK_MINOR_VERSION = \>> versions.vc] \
  615. && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
  616. !endif
  617. !if [echo TK_RELEASE_SERIAL = \>> versions.vc] \
  618. && [nmakehlp -V "$(_TK_H)" TK_RELEASE_SERIAL >> versions.vc]
  619. !endif
  620. !if [echo TK_PATCH_LEVEL = \>> versions.vc] \
  621. && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
  622. !endif
  623. !endif # _TK_H
  624. !include versions.vc
  625. TCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
  626. TCL_DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
  627. !if [nmakehlp -f $(TCL_PATCH_LEVEL) "a"]
  628. TCL_PATCH_LETTER = a
  629. !elseif [nmakehlp -f $(TCL_PATCH_LEVEL) "b"]
  630. TCL_PATCH_LETTER = b
  631. !else
  632. TCL_PATCH_LETTER = .
  633. !endif
  634. !if defined(_TK_H)
  635. TK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
  636. TK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
  637. !if [nmakehlp -f $(TK_PATCH_LEVEL) "a"]
  638. TK_PATCH_LETTER = a
  639. !elseif [nmakehlp -f $(TK_PATCH_LEVEL) "b"]
  640. TK_PATCH_LETTER = b
  641. !else
  642. TK_PATCH_LETTER = .
  643. !endif
  644. !endif
  645. # Set DOTVERSION and VERSION
  646. !if $(DOING_TCL)
  647. DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
  648. VERSION = $(TCL_VERSION)
  649. !elseif $(DOING_TK)
  650. DOTVERSION = $(TK_DOTVERSION)
  651. VERSION = $(TK_VERSION)
  652. !else # Doing a non-Tk extension
  653. # If parent makefile has not defined DOTVERSION, try to get it from TEA
  654. # first from a configure.in file, and then from configure.ac
  655. !ifndef DOTVERSION
  656. !if [echo DOTVERSION = \> versions.vc] \
  657. || [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc]
  658. !if [echo DOTVERSION = \> versions.vc] \
  659. || [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc]
  660. !error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc.
  661. !endif
  662. !endif
  663. !include versions.vc
  664. !endif # DOTVERSION
  665. VERSION = $(DOTVERSION:.=)
  666. !endif # $(DOING_TCL) ... etc.
  667. # Windows RC files have 3 version components. Ensure this irrespective
  668. # of how many components the package has specified. Basically, ensure
  669. # minimum 4 components by appending 4 0's and then pick out the first 4.
  670. # Also take care of the fact that DOTVERSION may have "a" or "b" instead
  671. # of "." separating the version components.
  672. DOTSEPARATED=$(DOTVERSION:a=.)
  673. DOTSEPARATED=$(DOTSEPARATED:b=.)
  674. !if [echo RCCOMMAVERSION = \> versions.vc] \
  675. || [for /f "tokens=1,2,3,4,5* delims=." %a in ("$(DOTSEPARATED).0.0.0.0") do echo %a,%b,%c,%d >> versions.vc]
  676. !error *** Could not generate RCCOMMAVERSION ***
  677. !endif
  678. !include versions.vc
  679. ########################################################################
  680. # 7. Parse the OPTS macro to work out the requested build configuration.
  681. # Based on this, we will construct the actual switches to be passed to the
  682. # compiler and linker using the macros defined in the previous section.
  683. # The following macros are defined by this section based on OPTS
  684. # STATIC_BUILD - 0 -> Tcl is to be built as a shared library
  685. # 1 -> build as a static library and shell
  686. # TCL_THREADS - legacy but always 1 on Windows since winsock requires it.
  687. # DEBUG - 1 -> debug build, 0 -> release builds
  688. # SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's
  689. # PROFILE - 1 -> generate profiling info, 0 -> no profiling
  690. # PGO - 1 -> profile based optimization, 0 -> no
  691. # MSVCRT - 1 -> link to dynamic C runtime even when building static Tcl build
  692. # 0 -> link to static C runtime for static Tcl build.
  693. # Does not impact shared Tcl builds (STATIC_BUILD == 0)
  694. # Default: 1 for Tcl 8.7 and up, 0 otherwise.
  695. # TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions
  696. # in the Tcl and Wish shell. 0 -> keep them as shared libraries. Does
  697. # not impact shared Tcl builds. Implied by STATIC_BUILD since Tcl 8.7.
  698. # USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation.
  699. # 0 -> Use the non-thread allocator.
  700. # UNCHECKED - 1 -> when doing a debug build with symbols, use the release
  701. # C runtime, 0 -> use the debug C runtime.
  702. # USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking
  703. # CONFIG_CHECK - 1 -> check current build configuration against Tcl
  704. # configuration (ignored for Tcl itself)
  705. # _USE_64BIT_TIME_T - forces a build using 64-bit time_t for 32-bit build
  706. # (CRT library should support this, not needed for Tcl 9.x)
  707. # Further, LINKERFLAGS are modified based on above.
  708. # Default values for all the above
  709. STATIC_BUILD = 0
  710. TCL_THREADS = 1
  711. DEBUG = 0
  712. SYMBOLS = 0
  713. PROFILE = 0
  714. PGO = 0
  715. MSVCRT = 1
  716. TCL_USE_STATIC_PACKAGES = 0
  717. USE_THREAD_ALLOC = 1
  718. UNCHECKED = 0
  719. CONFIG_CHECK = 1
  720. !if $(DOING_TCL)
  721. USE_STUBS = 0
  722. !else
  723. USE_STUBS = 1
  724. !endif
  725. # If OPTS is not empty AND does not contain "none" which turns off all OPTS
  726. # set the above macros based on OPTS content
  727. !if "$(OPTS)" != "" && ![nmakehlp -f "$(OPTS)" "none"]
  728. # OPTS are specified, parse them
  729. !if [nmakehlp -f $(OPTS) "static"]
  730. !message *** Doing static
  731. STATIC_BUILD = 1
  732. !endif
  733. !if [nmakehlp -f $(OPTS) "nostubs"]
  734. !message *** Not using stubs
  735. USE_STUBS = 0
  736. !endif
  737. !if [nmakehlp -f $(OPTS) "nomsvcrt"]
  738. !message *** Doing nomsvcrt
  739. MSVCRT = 0
  740. !else
  741. !if [nmakehlp -f $(OPTS) "msvcrt"]
  742. !message *** Doing msvcrt
  743. !else
  744. !if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7 && $(STATIC_BUILD)
  745. MSVCRT = 0
  746. !endif
  747. !endif
  748. !endif # [nmakehlp -f $(OPTS) "nomsvcrt"]
  749. !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
  750. !message *** Doing staticpkg
  751. TCL_USE_STATIC_PACKAGES = 1
  752. !endif
  753. !if [nmakehlp -f $(OPTS) "nothreads"]
  754. !message *** Compile explicitly for non-threaded tcl
  755. TCL_THREADS = 0
  756. USE_THREAD_ALLOC= 0
  757. !endif
  758. !if [nmakehlp -f $(OPTS) "tcl8"]
  759. !message *** Build for Tcl8
  760. TCL_BUILD_FOR = 8
  761. !endif
  762. !if [nmakehlp -f $(OPTS) "tk8"]
  763. !message *** Build for Tk8
  764. TK_BUILD_FOR = 8
  765. !endif
  766. !if $(TCL_MAJOR_VERSION) == 8
  767. !if [nmakehlp -f $(OPTS) "time64bit"]
  768. !message *** Force 64-bit time_t
  769. _USE_64BIT_TIME_T = 1
  770. !endif
  771. !endif
  772. # Yes, it's weird that the "symbols" option controls DEBUG and
  773. # the "pdbs" option controls SYMBOLS. That's historical.
  774. !if [nmakehlp -f $(OPTS) "symbols"]
  775. !message *** Doing symbols
  776. DEBUG = 1
  777. !else
  778. DEBUG = 0
  779. !endif
  780. !if [nmakehlp -f $(OPTS) "pdbs"]
  781. !message *** Doing pdbs
  782. SYMBOLS = 1
  783. !else
  784. SYMBOLS = 0
  785. !endif
  786. !if [nmakehlp -f $(OPTS) "profile"]
  787. !message *** Doing profile
  788. PROFILE = 1
  789. !else
  790. PROFILE = 0
  791. !endif
  792. !if [nmakehlp -f $(OPTS) "pgi"]
  793. !message *** Doing profile guided optimization instrumentation
  794. PGO = 1
  795. !elseif [nmakehlp -f $(OPTS) "pgo"]
  796. !message *** Doing profile guided optimization
  797. PGO = 2
  798. !else
  799. PGO = 0
  800. !endif
  801. !if [nmakehlp -f $(OPTS) "loimpact"]
  802. !message *** Warning: ignoring option "loimpact" - deprecated on modern Windows.
  803. !endif
  804. # TBD - should get rid of this option
  805. !if [nmakehlp -f $(OPTS) "thrdalloc"]
  806. !message *** Doing thrdalloc
  807. USE_THREAD_ALLOC = 1
  808. !endif
  809. !if [nmakehlp -f $(OPTS) "tclalloc"]
  810. USE_THREAD_ALLOC = 0
  811. !endif
  812. !if [nmakehlp -f $(OPTS) "unchecked"]
  813. !message *** Doing unchecked
  814. UNCHECKED = 1
  815. !else
  816. UNCHECKED = 0
  817. !endif
  818. !if [nmakehlp -f $(OPTS) "noconfigcheck"]
  819. CONFIG_CHECK = 1
  820. !else
  821. CONFIG_CHECK = 0
  822. !endif
  823. !endif # "$(OPTS)" != "" && ... parsing of OPTS
  824. # Set linker flags based on above
  825. !if $(PGO) > 1
  826. !if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)]
  827. LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
  828. !else
  829. MSG=^
  830. This compiler does not support profile guided optimization.
  831. !error $(MSG)
  832. !endif
  833. !elseif $(PGO) > 0
  834. !if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)]
  835. LINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
  836. !else
  837. MSG=^
  838. This compiler does not support profile guided optimization.
  839. !error $(MSG)
  840. !endif
  841. !endif
  842. ################################################################
  843. # 8. Parse the STATS macro to configure code instrumentation
  844. # The following macros are set by this section:
  845. # TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation
  846. # 0 -> disables
  847. # TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging
  848. # 0 -> disables
  849. # Default both are off
  850. TCL_MEM_DEBUG = 0
  851. TCL_COMPILE_DEBUG = 0
  852. !if "$(STATS)" != "" && ![nmakehlp -f "$(STATS)" "none"]
  853. !if [nmakehlp -f $(STATS) "memdbg"]
  854. !message *** Doing memdbg
  855. TCL_MEM_DEBUG = 1
  856. !else
  857. TCL_MEM_DEBUG = 0
  858. !endif
  859. !if [nmakehlp -f $(STATS) "compdbg"]
  860. !message *** Doing compdbg
  861. TCL_COMPILE_DEBUG = 1
  862. !else
  863. TCL_COMPILE_DEBUG = 0
  864. !endif
  865. !endif
  866. ####################################################################
  867. # 9. Parse the CHECKS macro to configure additional compiler checks
  868. # The following macros are set by this section:
  869. # WARNINGS - compiler switches that control the warnings level
  870. # TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions
  871. # 0 -> enable deprecated functions
  872. # Defaults - Permit deprecated functions and warning level 3
  873. TCL_NO_DEPRECATED = 0
  874. WARNINGS = -W3
  875. !if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"]
  876. !if [nmakehlp -f $(CHECKS) "nodep"]
  877. !message *** Doing nodep check
  878. TCL_NO_DEPRECATED = 1
  879. !endif
  880. !if [nmakehlp -f $(CHECKS) "fullwarn"]
  881. !message *** Doing full warnings check
  882. WARNINGS = -W4
  883. !if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)]
  884. LINKERFLAGS = $(LINKERFLAGS) -warn:3
  885. !endif
  886. !endif
  887. !if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
  888. !message *** Doing 64bit portability warnings
  889. WARNINGS = $(WARNINGS) -Wp64
  890. !endif
  891. !endif
  892. ################################################################
  893. # 10. Construct output directory and file paths
  894. # Figure-out how to name our intermediate and output directories.
  895. # In order to avoid inadvertent mixing of object files built using
  896. # different compilers, build configurations etc.,
  897. #
  898. # Naming convention (suffixes):
  899. # t = full thread support. (Not used for Tcl >= 8.7)
  900. # s = static library (as opposed to an import library)
  901. # g = linked to the debug enabled C run-time.
  902. # x = special static build when it links to the dynamic C run-time.
  903. #
  904. # The following macros are set in this section:
  905. # SUFX - the suffix to use for binaries based on above naming convention
  906. # BUILDDIRTOP - the toplevel default output directory
  907. # is of the form {Release,Debug}[_AMD64][_COMPILERVERSION]
  908. # TMP_DIR - directory where object files are created
  909. # OUT_DIR - directory where output executables are created
  910. # Both TMP_DIR and OUT_DIR are defaulted only if not defined by the
  911. # parent makefile (or command line). The default values are
  912. # based on BUILDDIRTOP.
  913. # STUBPREFIX - name of the stubs library for this project
  914. # PRJIMPLIB - output path of the generated project import library
  915. # PRJLIBNAME - name of generated project library
  916. # PRJLIB - output path of generated project library
  917. # PRJSTUBLIBNAME - name of the generated project stubs library
  918. # PRJSTUBLIB - output path of the generated project stubs library
  919. # RESFILE - output resource file (only if not static build)
  920. SUFX = tsgx
  921. !if $(DEBUG)
  922. BUILDDIRTOP = Debug
  923. !else
  924. BUILDDIRTOP = Release
  925. !endif
  926. !if "$(MACHINE)" != "IX86"
  927. BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
  928. !endif
  929. !if $(VCVER) > 6
  930. BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
  931. !endif
  932. !if !$(DEBUG) || $(TCL_VERSION) > 86 || $(DEBUG) && $(UNCHECKED)
  933. SUFX = $(SUFX:g=)
  934. !endif
  935. TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX
  936. !if !$(STATIC_BUILD)
  937. TMP_DIRFULL = $(TMP_DIRFULL:Static=)
  938. SUFX = $(SUFX:s=)
  939. EXT = dll
  940. TMP_DIRFULL = $(TMP_DIRFULL:X=)
  941. SUFX = $(SUFX:x=)
  942. !else
  943. TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
  944. EXT = lib
  945. !if $(MSVCRT) && $(TCL_VERSION) > 86 || !$(MSVCRT) && $(TCL_VERSION) < 87
  946. TMP_DIRFULL = $(TMP_DIRFULL:X=)
  947. SUFX = $(SUFX:x=)
  948. !endif
  949. !endif
  950. !if !$(TCL_THREADS) || $(TCL_VERSION) > 86
  951. TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
  952. SUFX = $(SUFX:t=)
  953. !endif
  954. !ifndef TMP_DIR
  955. TMP_DIR = $(TMP_DIRFULL)
  956. !ifndef OUT_DIR
  957. OUT_DIR = .\$(BUILDDIRTOP)
  958. !endif
  959. !else
  960. !ifndef OUT_DIR
  961. OUT_DIR = $(TMP_DIR)
  962. !endif
  963. !endif
  964. # Relative paths -> absolute
  965. !if [echo OUT_DIR = \> nmakehlp.out] \
  966. || [nmakehlp -Q "$(OUT_DIR)" >> nmakehlp.out]
  967. !error *** Could not fully qualify path OUT_DIR=$(OUT_DIR)
  968. !endif
  969. !if [echo TMP_DIR = \>> nmakehlp.out] \
  970. || [nmakehlp -Q "$(TMP_DIR)" >> nmakehlp.out]
  971. !error *** Could not fully qualify path TMP_DIR=$(TMP_DIR)
  972. !endif
  973. !include nmakehlp.out
  974. # The name of the stubs library for the project being built
  975. STUBPREFIX = $(PROJECT)stub
  976. #
  977. # Set up paths to various Tcl executables and libraries needed by extensions
  978. #
  979. # TIP 430. Unused for 8.6 but no harm defining it to allow a common rules.vc
  980. TCL_ZIP_FILE = libtcl$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)$(TCL_PATCH_LETTER)$(TCL_RELEASE_SERIAL).zip
  981. TK_ZIP_FILE = libtk$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)$(TK_PATCH_LETTER)$(TK_RELEASE_SERIAL).zip
  982. !if $(DOING_TCL)
  983. TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe
  984. TCLSH = $(OUT_DIR)\$(TCLSHNAME)
  985. TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
  986. TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
  987. TCLLIB = $(OUT_DIR)\$(TCLLIBNAME)
  988. TCLSCRIPTZIP = $(OUT_DIR)\$(TCL_ZIP_FILE)
  989. !if $(TCL_MAJOR_VERSION) == 8
  990. TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
  991. !else
  992. TCLSTUBLIBNAME = $(STUBPREFIX).lib
  993. !endif
  994. TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME)
  995. TCL_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)"
  996. !else # !$(DOING_TCL)
  997. !if $(TCLINSTALL) # Building against an installed Tcl
  998. # When building extensions, we need to locate tclsh. Depending on version
  999. # of Tcl we are building against, this may or may not have a "t" suffix.
  1000. # Try various possibilities in turn.
  1001. TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe
  1002. !if !exist("$(TCLSH)")
  1003. TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe
  1004. !endif
  1005. !if $(TCL_MAJOR_VERSION) == 8
  1006. TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib
  1007. !else
  1008. TCLSTUBLIB = $(_TCLDIR)\lib\tclstub.lib
  1009. !endif
  1010. TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib
  1011. # When building extensions, may be linking against Tcl that does not add
  1012. # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
  1013. !if !exist("$(TCLIMPLIB)")
  1014. TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib
  1015. !endif
  1016. TCL_LIBRARY = $(_TCLDIR)\lib
  1017. TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib
  1018. TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib
  1019. TCLSCRIPTZIP = $(_TCLDIR)\lib\$(TCL_ZIP_FILE)
  1020. TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target
  1021. TCL_INCLUDES = -I"$(_TCLDIR)\include"
  1022. !else # Building against Tcl sources
  1023. TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe
  1024. !if !exist($(TCLSH))
  1025. TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe
  1026. !endif
  1027. !if $(TCL_MAJOR_VERSION) == 8
  1028. TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib
  1029. !else
  1030. TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub.lib
  1031. !endif
  1032. TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib
  1033. # When building extensions, may be linking against Tcl that does not add
  1034. # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
  1035. !if !exist("$(TCLIMPLIB)")
  1036. TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib
  1037. !endif
  1038. TCL_LIBRARY = $(_TCLDIR)\library
  1039. TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib
  1040. TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib
  1041. TCLSCRIPTZIP = $(_TCLDIR)\win\$(BUILDDIRTOP)\$(TCL_ZIP_FILE)
  1042. TCLTOOLSDIR = $(_TCLDIR)\tools
  1043. TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
  1044. !endif # TCLINSTALL
  1045. !if !$(STATIC_BUILD) && "$(TCL_BUILD_FOR)" == "8"
  1046. tcllibs = "$(TCLSTUBLIB)"
  1047. !else
  1048. tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)"
  1049. !endif
  1050. !endif # $(DOING_TCL)
  1051. # We need a tclsh that will run on the host machine as part of the build.
  1052. # IX86 runs on all architectures.
  1053. !ifndef TCLSH_NATIVE
  1054. !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
  1055. TCLSH_NATIVE = $(TCLSH)
  1056. !else
  1057. !error You must explicitly set TCLSH_NATIVE for cross-compilation
  1058. !endif
  1059. !endif
  1060. # Do the same for Tk and Tk extensions that require the Tk libraries
  1061. !if $(DOING_TK) || $(NEED_TK)
  1062. WISHNAMEPREFIX = wish
  1063. WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
  1064. TKLIBNAME8 = tk$(TK_VERSION)$(SUFX).$(EXT)
  1065. TKLIBNAME9 = tcl9tk$(TK_VERSION)$(SUFX).$(EXT)
  1066. !if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8"
  1067. TKLIBNAME = tk$(TK_VERSION)$(SUFX).$(EXT)
  1068. TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX).lib
  1069. !else
  1070. TKLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).$(EXT)
  1071. TKIMPLIBNAME = tcl9tk$(TK_VERSION)$(SUFX).lib
  1072. !endif
  1073. !if $(TK_MAJOR_VERSION) == 8
  1074. TKSTUBLIBNAME = tkstub$(TK_VERSION).lib
  1075. !else
  1076. TKSTUBLIBNAME = tkstub.lib
  1077. !endif
  1078. !if $(DOING_TK)
  1079. WISH = $(OUT_DIR)\$(WISHNAME)
  1080. TKSTUBLIB = $(OUT_DIR)\$(TKSTUBLIBNAME)
  1081. TKIMPLIB = $(OUT_DIR)\$(TKIMPLIBNAME)
  1082. TKLIB = $(OUT_DIR)\$(TKLIBNAME)
  1083. TK_INCLUDES = -I"$(WIN_DIR)" -I"$(GENERICDIR)"
  1084. TKSCRIPTZIP = $(OUT_DIR)\$(TK_ZIP_FILE)
  1085. !else # effectively NEED_TK
  1086. !if $(TKINSTALL) # Building against installed Tk
  1087. WISH = $(_TKDIR)\bin\$(WISHNAME)
  1088. TKSTUBLIB = $(_TKDIR)\lib\$(TKSTUBLIBNAME)
  1089. TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME)
  1090. # When building extensions, may be linking against Tk that does not add
  1091. # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
  1092. !if !exist("$(TKIMPLIB)")
  1093. TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib
  1094. TKIMPLIB = $(_TKDIR)\lib\$(TKIMPLIBNAME)
  1095. !endif
  1096. TK_INCLUDES = -I"$(_TKDIR)\include"
  1097. TKSCRIPTZIP = $(_TKDIR)\lib\$(TK_ZIP_FILE)
  1098. !else # Building against Tk sources
  1099. WISH = $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME)
  1100. TKSTUBLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME)
  1101. TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
  1102. # When building extensions, may be linking against Tk that does not add
  1103. # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility.
  1104. !if !exist("$(TKIMPLIB)")
  1105. TKIMPLIBNAME = tk$(TK_VERSION)$(SUFX:t=).lib
  1106. TKIMPLIB = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
  1107. !endif
  1108. TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
  1109. TKSCRIPTZIP = $(_TKDIR)\win\$(BUILDDIRTOP)\$(TK_ZIP_FILE)
  1110. !endif # TKINSTALL
  1111. tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)"
  1112. !endif # $(DOING_TK)
  1113. !endif # $(DOING_TK) || $(NEED_TK)
  1114. # Various output paths
  1115. PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
  1116. PRJLIBNAME8 = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
  1117. # Even when building against Tcl 8, PRJLIBNAME9 must not have "t"
  1118. PRJLIBNAME9 = tcl9$(PROJECT)$(VERSION)$(SUFX:t=).$(EXT)
  1119. !if $(TCL_MAJOR_VERSION) == 8 || "$(TCL_BUILD_FOR)" == "8"
  1120. PRJLIBNAME = $(PRJLIBNAME8)
  1121. !else
  1122. PRJLIBNAME = $(PRJLIBNAME9)
  1123. !endif
  1124. PRJLIB = $(OUT_DIR)\$(PRJLIBNAME)
  1125. !if $(TCL_MAJOR_VERSION) == 8
  1126. PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
  1127. !else
  1128. PRJSTUBLIBNAME = $(STUBPREFIX).lib
  1129. !endif
  1130. PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME)
  1131. # If extension parent makefile has not defined a resource definition file,
  1132. # we will generate one from standard template.
  1133. !if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD)
  1134. !ifdef RCFILE
  1135. RESFILE = $(TMP_DIR)\$(RCFILE:.rc=.res)
  1136. !else
  1137. RESFILE = $(TMP_DIR)\$(PROJECT).res
  1138. !endif
  1139. !endif
  1140. ###################################################################
  1141. # 11. Construct the paths for the installation directories
  1142. # The following macros get defined in this section:
  1143. # LIB_INSTALL_DIR - where libraries should be installed
  1144. # BIN_INSTALL_DIR - where the executables should be installed
  1145. # DOC_INSTALL_DIR - where documentation should be installed
  1146. # SCRIPT_INSTALL_DIR - where scripts should be installed
  1147. # INCLUDE_INSTALL_DIR - where C include files should be installed
  1148. # DEMO_INSTALL_DIR - where demos should be installed
  1149. # PRJ_INSTALL_DIR - where package will be installed (not set for Tcl and Tk)
  1150. !if $(DOING_TCL) || $(DOING_TK)
  1151. LIB_INSTALL_DIR = $(_INSTALLDIR)\lib
  1152. BIN_INSTALL_DIR = $(_INSTALLDIR)\bin
  1153. DOC_INSTALL_DIR = $(_INSTALLDIR)\doc
  1154. !if $(DOING_TCL)
  1155. SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
  1156. MODULE_INSTALL_DIR = $(_INSTALLDIR)\lib\tcl$(TCL_MAJOR_VERSION)
  1157. !else # DOING_TK
  1158. SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
  1159. !endif
  1160. DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos
  1161. INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include
  1162. !else # extension other than Tk
  1163. PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
  1164. !if $(MULTIPLATFORM_INSTALL)
  1165. LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY)
  1166. BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY)
  1167. !else
  1168. LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR)
  1169. BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR)
  1170. !endif
  1171. DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR)
  1172. SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR)
  1173. DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos
  1174. INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include
  1175. !endif
  1176. ###################################################################
  1177. # 12. Set up actual options to be passed to the compiler and linker
  1178. # Now we have all the information we need, set up the actual flags and
  1179. # options that we will pass to the compiler and linker. The main
  1180. # makefile should use these in combination with whatever other flags
  1181. # and switches are specific to it.
  1182. # The following macros are defined, names are for historical compatibility:
  1183. # OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS
  1184. # COMPILERFLAGS - /Dxxx C macro flags independent of any configuration options
  1185. # crt - Compiler switch that selects the appropriate C runtime
  1186. # cdebug - Compiler switches related to debug AND optimizations
  1187. # cwarn - Compiler switches that set warning levels
  1188. # cflags - complete compiler switches (subsumes cdebug and cwarn)
  1189. # ldebug - Linker switches controlling debug information and optimization
  1190. # lflags - complete linker switches (subsumes ldebug) except subsystem type
  1191. # dlllflags - complete linker switches to build DLLs (subsumes lflags)
  1192. # conlflags - complete linker switches for console program (subsumes lflags)
  1193. # guilflags - complete linker switches for GUI program (subsumes lflags)
  1194. # baselibs - minimum Windows libraries required. Parent makefile can
  1195. # define PRJ_LIBS before including rules.rc if additional libs are needed
  1196. OPTDEFINES = /DSTDC_HEADERS /DUSE_NMAKE=1
  1197. !if $(VCVERSION) > 1600
  1198. OPTDEFINES = $(OPTDEFINES) /DHAVE_STDINT_H=1
  1199. !else
  1200. OPTDEFINES = $(OPTDEFINES) /DMP_NO_STDINT=1
  1201. !endif
  1202. !if $(VCVERSION) >= 1800
  1203. OPTDEFINES = $(OPTDEFINES) /DHAVE_INTTYPES_H=1 /DHAVE_STDBOOL_H=1
  1204. !endif
  1205. !if $(TCL_MEM_DEBUG)
  1206. OPTDEFINES = $(OPTDEFINES) /DTCL_MEM_DEBUG
  1207. !endif
  1208. !if $(TCL_COMPILE_DEBUG)
  1209. OPTDEFINES = $(OPTDEFINES) /DTCL_COMPILE_DEBUG /DTCL_COMPILE_STATS
  1210. !endif
  1211. !if $(TCL_THREADS) && $(TCL_VERSION) < 87
  1212. OPTDEFINES = $(OPTDEFINES) /DTCL_THREADS=1
  1213. !if $(USE_THREAD_ALLOC) && $(TCL_VERSION) < 87
  1214. OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1
  1215. !endif
  1216. !endif
  1217. !if $(STATIC_BUILD)
  1218. OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD
  1219. !elseif $(TCL_VERSION) > 86
  1220. OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH
  1221. !if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64"
  1222. OPTDEFINES = $(OPTDEFINES) /DMP_64BIT
  1223. !endif
  1224. !endif
  1225. !if $(TCL_NO_DEPRECATED)
  1226. OPTDEFINES = $(OPTDEFINES) /DTCL_NO_DEPRECATED
  1227. !endif
  1228. !if $(USE_STUBS)
  1229. # Note we do not define USE_TCL_STUBS even when building tk since some
  1230. # test targets in tk do not use stubs
  1231. !if !$(DOING_TCL)
  1232. USE_STUBS_DEFS = /DUSE_TCL_STUBS /DUSE_TCLOO_STUBS
  1233. !if $(NEED_TK)
  1234. USE_STUBS_DEFS = $(USE_STUBS_DEFS) /DUSE_TK_STUBS
  1235. !endif
  1236. !endif
  1237. !endif # USE_STUBS
  1238. !if !$(DEBUG)
  1239. OPTDEFINES = $(OPTDEFINES) /DNDEBUG
  1240. !if $(OPTIMIZING)
  1241. OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_OPTIMIZED
  1242. !endif
  1243. !endif
  1244. !if $(PROFILE)
  1245. OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_PROFILED
  1246. !endif
  1247. !if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64"
  1248. OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_DO64BIT
  1249. !endif
  1250. !if $(VCVERSION) < 1300
  1251. OPTDEFINES = $(OPTDEFINES) /DNO_STRTOI64=1
  1252. !endif
  1253. !if $(TCL_MAJOR_VERSION) == 8
  1254. !if "$(_USE_64BIT_TIME_T)" == "1"
  1255. OPTDEFINES = $(OPTDEFINES) /D_USE_64BIT_TIME_T=1
  1256. !endif
  1257. !endif
  1258. !if "$(TCL_BUILD_FOR)" == "8"
  1259. OPTDEFINES = $(OPTDEFINES) /DTCL_MAJOR_VERSION=8
  1260. !endif
  1261. !if "$(TK_BUILD_FOR)" == "8"
  1262. OPTDEFINES = $(OPTDEFINES) /DTK_MAJOR_VERSION=8
  1263. !endif
  1264. # Like the TEA system only set this non empty for non-Tk extensions
  1265. # Note: some extensions use PACKAGE_NAME and others use PACKAGE_TCLNAME
  1266. # so we pass both
  1267. !if !$(DOING_TCL) && !$(DOING_TK)
  1268. PKGNAMEFLAGS = /DPACKAGE_NAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \
  1269. /DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \
  1270. /DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
  1271. /DMODULE_SCOPE=extern
  1272. !endif
  1273. # crt picks the C run time based on selected OPTS
  1274. !if $(MSVCRT)
  1275. !if $(DEBUG) && !$(UNCHECKED)
  1276. crt = -MDd
  1277. !else
  1278. crt = -MD
  1279. !endif
  1280. !else
  1281. !if $(DEBUG) && !$(UNCHECKED)
  1282. crt = -MTd
  1283. !else
  1284. crt = -MT
  1285. !endif
  1286. !endif
  1287. # cdebug includes compiler options for debugging as well as optimization.
  1288. !if $(DEBUG)
  1289. # In debugging mode, optimizations need to be disabled
  1290. cdebug = -Zi -Od $(DEBUGFLAGS)
  1291. !else
  1292. cdebug = $(OPTIMIZATIONS)
  1293. !if $(SYMBOLS)
  1294. cdebug = $(cdebug) -Zi
  1295. !endif
  1296. !endif # $(DEBUG)
  1297. # cwarn includes default warning levels, also C4090 (buggy) and C4146 is useless.
  1298. cwarn = $(WARNINGS) -wd4090 -wd4146
  1299. !if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64"
  1300. # Disable pointer<->int warnings related to cast between different sizes
  1301. # There are a gadzillion of these due to use of ClientData and
  1302. # clutter up compiler
  1303. # output increasing chance of a real warning getting lost. So disable them.
  1304. # Eventually some day, Tcl will be 64-bit clean.
  1305. cwarn = $(cwarn) -wd4311 -wd4312
  1306. !endif
  1307. ### Common compiler options that are architecture specific
  1308. !if "$(MACHINE)" == "ARM"
  1309. carch = /D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
  1310. !else
  1311. carch =
  1312. !endif
  1313. # cpuid is only available on intel machines
  1314. !if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "AMD64"
  1315. carch = $(carch) /DHAVE_CPUID=1
  1316. !endif
  1317. !if $(DEBUG)
  1318. # Turn warnings into errors
  1319. cwarn = $(cwarn) -WX
  1320. !endif
  1321. INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES)
  1322. !if !$(DOING_TCL) && !$(DOING_TK)
  1323. INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WIN_DIR)" -I"$(COMPATDIR)"
  1324. !endif
  1325. # These flags are defined roughly in the order of the pre-reform
  1326. # rules.vc/makefile.vc to help visually compare that the pre- and
  1327. # post-reform build logs
  1328. # cflags contains generic flags used for building practically all object files
  1329. cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug)
  1330. !if $(TCL_MAJOR_VERSION) == 8 && $(TCL_MINOR_VERSION) < 7
  1331. cflags = $(cflags) -DTcl_Size=int
  1332. !endif
  1333. # appcflags contains $(cflags) and flags for building the application
  1334. # object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus
  1335. # flags used for building shared object files The two differ in the
  1336. # BUILD_$(PROJECT) macro which should be defined only for the shared
  1337. # library *implementation* and not for its caller interface
  1338. appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES)
  1339. appcflags = $(appcflags_nostubs) $(USE_STUBS_DEFS)
  1340. pkgcflags = $(appcflags) $(PKGNAMEFLAGS) /DBUILD_$(PROJECT)
  1341. pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) /DBUILD_$(PROJECT)
  1342. # stubscflags contains $(cflags) plus flags used for building a stubs
  1343. # library for the package. Note: /DSTATIC_BUILD is defined in
  1344. # $(OPTDEFINES) only if the OPTS configuration indicates a static
  1345. # library. However the stubs library is ALWAYS static hence included
  1346. # here irrespective of the OPTS setting.
  1347. #
  1348. # TBD - tclvfs has a comment that stubs libs should not be compiled with -GL
  1349. # without stating why. Tcl itself compiled stubs libs with this flag.
  1350. # so we do not remove it from cflags. -GL may prevent extensions
  1351. # compiled with one VC version to fail to link against stubs library
  1352. # compiled with another VC version. Check for this and fix accordingly.
  1353. stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) /Zl /GL- /DSTATIC_BUILD $(INCLUDES) $(USE_STUBS_DEFS)
  1354. # Link flags
  1355. !if $(DEBUG)
  1356. ldebug = -debug -debugtype:cv
  1357. !else
  1358. ldebug = -release -opt:ref -opt:icf,3
  1359. !if $(SYMBOLS)
  1360. ldebug = $(ldebug) -debug -debugtype:cv
  1361. !endif
  1362. !endif
  1363. # Note: Profiling is currently only possible with the Visual Studio Enterprise
  1364. !if $(PROFILE)
  1365. ldebug= $(ldebug) -profile
  1366. !endif
  1367. ### Declarations common to all linker versions
  1368. lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
  1369. !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
  1370. lflags = $(lflags) -nodefaultlib:libucrt.lib
  1371. !endif
  1372. dlllflags = $(lflags) -dll
  1373. conlflags = $(lflags) -subsystem:console
  1374. guilflags = $(lflags) -subsystem:windows
  1375. # Libraries that are required for every image.
  1376. # Extensions should define any additional libraries with $(PRJ_LIBS)
  1377. winlibs = kernel32.lib advapi32.lib
  1378. !if $(NEED_TK)
  1379. winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib
  1380. !endif
  1381. # Avoid 'unresolved external symbol __security_cookie' errors.
  1382. # c.f. http://support.microsoft.com/?id=894573
  1383. !if "$(MACHINE)" == "AMD64"
  1384. !if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
  1385. winlibs = $(winlibs) bufferoverflowU.lib
  1386. !endif
  1387. !endif
  1388. baselibs = $(winlibs) $(PRJ_LIBS)
  1389. !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
  1390. baselibs = $(baselibs) ucrt.lib
  1391. !endif
  1392. ################################################################
  1393. # 13. Define standard commands, common make targets and implicit rules
  1394. CCPKGCMD = $(cc32) $(pkgcflags) -Fo$(TMP_DIR)^\
  1395. CCAPPCMD = $(cc32) $(appcflags) -Fo$(TMP_DIR)^\
  1396. CCSTUBSCMD = $(cc32) $(stubscflags) -Fo$(TMP_DIR)^\
  1397. LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@
  1398. DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
  1399. CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
  1400. GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
  1401. RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
  1402. $(TCL_INCLUDES) /DSTATIC_BUILD=$(STATIC_BUILD) \
  1403. /DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
  1404. /DCOMMAVERSION=$(RCCOMMAVERSION) \
  1405. /DDOTVERSION=\"$(DOTVERSION)\" \
  1406. /DVERSION=\"$(VERSION)\" \
  1407. /DSUFX=\"$(SUFX)\" \
  1408. /DPROJECT=\"$(PROJECT)\" \
  1409. /DPRJLIBNAME=\"$(PRJLIBNAME)\"
  1410. !ifndef DEFAULT_BUILD_TARGET
  1411. DEFAULT_BUILD_TARGET = $(PROJECT)
  1412. !endif
  1413. default-target: $(DEFAULT_BUILD_TARGET)
  1414. !if $(MULTIPLATFORM_INSTALL)
  1415. default-pkgindex:
  1416. @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl
  1417. @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
  1418. [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl
  1419. @echo } else { >> $(OUT_DIR)\pkgIndex.tcl
  1420. @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
  1421. [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl
  1422. @echo } >> $(OUT_DIR)\pkgIndex.tcl
  1423. !else
  1424. default-pkgindex:
  1425. @echo if {[package vsatisfies [package provide Tcl] 9.0-]} { > $(OUT_DIR)\pkgIndex.tcl
  1426. @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
  1427. [list load [file join $$dir $(PRJLIBNAME9)]] >> $(OUT_DIR)\pkgIndex.tcl
  1428. @echo } else { >> $(OUT_DIR)\pkgIndex.tcl
  1429. @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
  1430. [list load [file join $$dir $(PRJLIBNAME8)]] >> $(OUT_DIR)\pkgIndex.tcl
  1431. @echo } >> $(OUT_DIR)\pkgIndex.tcl
  1432. !endif
  1433. default-pkgindex-tea:
  1434. @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl
  1435. @PACKAGE_VERSION@ $(DOTVERSION)
  1436. @PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME)
  1437. @PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME)
  1438. @PKG_LIB_FILE@ $(PRJLIBNAME)
  1439. @PKG_LIB_FILE8@ $(PRJLIBNAME8)
  1440. @PKG_LIB_FILE9@ $(PRJLIBNAME9)
  1441. <<
  1442. default-install: default-install-binaries default-install-libraries
  1443. !if $(SYMBOLS)
  1444. default-install: default-install-pdbs
  1445. !endif
  1446. # Again to deal with historical brokenness, there is some confusion
  1447. # in terminlogy. For extensions, the "install-binaries" was used to
  1448. # locate target directory for *binary shared libraries* and thus
  1449. # the appropriate macro is LIB_INSTALL_DIR since BIN_INSTALL_DIR is
  1450. # for executables (exes). On the other hand the "install-libraries"
  1451. # target is for *scripts* and should have been called "install-scripts".
  1452. default-install-binaries: $(PRJLIB)
  1453. @echo Installing binaries to '$(LIB_INSTALL_DIR)'
  1454. @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)"
  1455. @$(CPY) $(PRJLIB) "$(LIB_INSTALL_DIR)" >NUL
  1456. # Alias for default-install-scripts
  1457. default-install-libraries: default-install-scripts
  1458. default-install-scripts: $(OUT_DIR)\pkgIndex.tcl
  1459. @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
  1460. @if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
  1461. @echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
  1462. @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR)
  1463. default-install-stubs:
  1464. @echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)'
  1465. @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
  1466. @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
  1467. default-install-pdbs:
  1468. @echo Installing PDBs to '$(LIB_INSTALL_DIR)'
  1469. @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)"
  1470. @$(CPY) "$(OUT_DIR)\*.pdb" "$(LIB_INSTALL_DIR)\"
  1471. # "emacs font-lock highlighting fix
  1472. default-install-docs-html:
  1473. @echo Installing documentation files to '$(DOC_INSTALL_DIR)'
  1474. @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)"
  1475. @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)"
  1476. default-install-docs-n:
  1477. @echo Installing documentation files to '$(DOC_INSTALL_DIR)'
  1478. @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)"
  1479. @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)"
  1480. default-install-demos:
  1481. @echo Installing demos to '$(DEMO_INSTALL_DIR)'
  1482. @if not exist "$(DEMO_INSTALL_DIR)" mkdir "$(DEMO_INSTALL_DIR)"
  1483. @if exist $(DEMODIR) $(CPYDIR) "$(DEMODIR)" "$(DEMO_INSTALL_DIR)"
  1484. default-clean:
  1485. @echo Cleaning $(TMP_DIR)\* ...
  1486. @if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
  1487. @echo Cleaning $(WIN_DIR)\nmakehlp.obj, nmakehlp.exe ...
  1488. @if exist $(WIN_DIR)\nmakehlp.obj del $(WIN_DIR)\nmakehlp.obj
  1489. @if exist $(WIN_DIR)\nmakehlp.exe del $(WIN_DIR)\nmakehlp.exe
  1490. @if exist $(WIN_DIR)\nmakehlp.out del $(WIN_DIR)\nmakehlp.out
  1491. @echo Cleaning $(WIN_DIR)\nmhlp-out.txt ...
  1492. @if exist $(WIN_DIR)\nmhlp-out.txt del $(WIN_DIR)\nmhlp-out.txt
  1493. @echo Cleaning $(WIN_DIR)\_junk.pch ...
  1494. @if exist $(WIN_DIR)\_junk.pch del $(WIN_DIR)\_junk.pch
  1495. @echo Cleaning $(WIN_DIR)\vercl.x, vercl.i ...
  1496. @if exist $(WIN_DIR)\vercl.x del $(WIN_DIR)\vercl.x
  1497. @if exist $(WIN_DIR)\vercl.i del $(WIN_DIR)\vercl.i
  1498. @echo Cleaning $(WIN_DIR)\versions.vc, version.vc ...
  1499. @if exist $(WIN_DIR)\versions.vc del $(WIN_DIR)\versions.vc
  1500. @if exist $(WIN_DIR)\version.vc del $(WIN_DIR)\version.vc
  1501. default-hose: default-clean
  1502. @echo Hosing $(OUT_DIR)\* ...
  1503. @if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
  1504. # Only for backward compatibility
  1505. default-distclean: default-hose
  1506. default-setup:
  1507. @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
  1508. @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
  1509. !if "$(TESTPAT)" != ""
  1510. TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
  1511. !endif
  1512. default-test: default-setup $(PROJECT)
  1513. @set TCLLIBPATH=$(OUT_DIR:\=/)
  1514. @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)"
  1515. cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS)
  1516. default-shell: default-setup $(PROJECT)
  1517. @set TCLLIBPATH=$(OUT_DIR:\=/)
  1518. @if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)"
  1519. $(DEBUGGER) $(TCLSH)
  1520. # Generation of Windows version resource
  1521. !ifdef RCFILE
  1522. # Note: don't use $** in below rule because there may be other dependencies
  1523. # and only the "main" rc must be passed to the resource compiler
  1524. $(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc
  1525. $(RESCMD) $(RCDIR)\$(PROJECT).rc
  1526. !else
  1527. # If parent makefile has not defined a resource definition file,
  1528. # we will generate one from standard template.
  1529. $(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc
  1530. $(TMP_DIR)\$(PROJECT).rc:
  1531. @$(COPY) << $(TMP_DIR)\$(PROJECT).rc
  1532. #include <winver.h>
  1533. VS_VERSION_INFO VERSIONINFO
  1534. FILEVERSION COMMAVERSION
  1535. PRODUCTVERSION COMMAVERSION
  1536. FILEFLAGSMASK 0x3fL
  1537. #ifdef DEBUG
  1538. FILEFLAGS VS_FF_DEBUG
  1539. #else
  1540. FILEFLAGS 0x0L
  1541. #endif
  1542. FILEOS VOS_NT_WINDOWS32
  1543. FILETYPE VFT_DLL
  1544. FILESUBTYPE 0x0L
  1545. BEGIN
  1546. BLOCK "StringFileInfo"
  1547. BEGIN
  1548. BLOCK "040904b0"
  1549. BEGIN
  1550. VALUE "FileDescription", "Tcl extension " PROJECT
  1551. VALUE "OriginalFilename", PRJLIBNAME
  1552. VALUE "FileVersion", DOTVERSION
  1553. VALUE "ProductName", "Package " PROJECT " for Tcl"
  1554. VALUE "ProductVersion", DOTVERSION
  1555. END
  1556. END
  1557. BLOCK "VarFileInfo"
  1558. BEGIN
  1559. VALUE "Translation", 0x409, 1200
  1560. END
  1561. END
  1562. <<
  1563. !endif # ifdef RCFILE
  1564. !ifndef DISABLE_IMPLICIT_RULES
  1565. DISABLE_IMPLICIT_RULES = 0
  1566. !endif
  1567. !if !$(DISABLE_IMPLICIT_RULES)
  1568. # Implicit rule definitions - only for building library objects. For stubs and
  1569. # main application, the makefile should define explicit rules.
  1570. {$(ROOT)}.c{$(TMP_DIR)}.obj::
  1571. $(CCPKGCMD) @<<
  1572. $<
  1573. <<
  1574. {$(WIN_DIR)}.c{$(TMP_DIR)}.obj::
  1575. $(CCPKGCMD) @<<
  1576. $<
  1577. <<
  1578. {$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
  1579. $(CCPKGCMD) @<<
  1580. $<
  1581. <<
  1582. {$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
  1583. $(CCPKGCMD) @<<
  1584. $<
  1585. <<
  1586. {$(RCDIR)}.rc{$(TMP_DIR)}.res:
  1587. $(RESCMD) $<
  1588. {$(WIN_DIR)}.rc{$(TMP_DIR)}.res:
  1589. $(RESCMD) $<
  1590. {$(TMP_DIR)}.rc{$(TMP_DIR)}.res:
  1591. $(RESCMD) $<
  1592. .SUFFIXES:
  1593. .SUFFIXES:.c .rc
  1594. !endif
  1595. ################################################################
  1596. # 14. Sanity check selected options against Tcl build options
  1597. # When building an extension, certain configuration options should
  1598. # match the ones used when Tcl was built. Here we check and
  1599. # warn on a mismatch.
  1600. !if !$(DOING_TCL)
  1601. !if $(TCLINSTALL) # Building against an installed Tcl
  1602. !if exist("$(_TCLDIR)\lib\nmake\tcl.nmake")
  1603. TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake"
  1604. !endif
  1605. !else # !$(TCLINSTALL) - building against Tcl source
  1606. !if exist("$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake")
  1607. TCLNMAKECONFIG = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl.nmake"
  1608. !endif
  1609. !endif # TCLINSTALL
  1610. !if $(CONFIG_CHECK)
  1611. !ifdef TCLNMAKECONFIG
  1612. !include $(TCLNMAKECONFIG)
  1613. !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)"
  1614. !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)).
  1615. !endif
  1616. !if $(TCL_VERSION) < 87 && defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC)
  1617. !message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)).
  1618. !endif
  1619. !if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG)
  1620. !message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)).
  1621. !endif
  1622. !endif
  1623. !endif # TCLNMAKECONFIG
  1624. !endif # !$(DOING_TCL)
  1625. #----------------------------------------------------------
  1626. # Display stats being used.
  1627. #----------------------------------------------------------
  1628. !if !$(DOING_TCL)
  1629. !message *** Building against Tcl at '$(_TCLDIR)'
  1630. !endif
  1631. !if !$(DOING_TK) && $(NEED_TK)
  1632. !message *** Building against Tk at '$(_TKDIR)'
  1633. !endif
  1634. !message *** Intermediate directory will be '$(TMP_DIR)'
  1635. !message *** Output directory will be '$(OUT_DIR)'
  1636. !message *** Installation, if selected, will be in '$(_INSTALLDIR)'
  1637. !message *** Suffix for binaries will be '$(SUFX)'
  1638. !message *** Compiler version $(VCVER). Target $(MACHINE), host $(NATIVE_ARCH).
  1639. !endif # ifdef _RULES_VC