rules.vc
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:13k
源码类别:

通讯编程

开发平台:

Visual C++

  1. #------------------------------------------------------------------------------
  2. # rules.vc --
  3. #
  4. # Microsoft Visual C++ makefile include for decoding the commandline
  5. # macros.  This file does not need editing to build Tcl.
  6. #
  7. # See the file "license.terms" for information on usage and redistribution
  8. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  9. # Copyright (c) 2001-2003 David Gravereaux.
  10. # Copyright (c) 2003-2006 Patrick Thoyts
  11. #
  12. #------------------------------------------------------------------------------
  13. # RCS: @(#) $Id: rules.vc,v 1.11.2.7 2007/09/11 00:10:48 patthoyts Exp $
  14. #------------------------------------------------------------------------------
  15. !ifndef _RULES_VC
  16. _RULES_VC = 1
  17. cc32 = $(CC)   # built-in default.
  18. link32 = link
  19. lib32 = lib
  20. rc32 = $(RC)   # built-in default.
  21. !ifndef INSTALLDIR
  22. ### Assume the normal default.
  23. _INSTALLDIR = C:Program FilesTcl
  24. !else
  25. ### Fix the path separators.
  26. _INSTALLDIR = $(INSTALLDIR:/=)
  27. !endif
  28. !ifndef MACHINE
  29. !if "$(CPU)" == "" || "$(CPU)" == "i386"
  30. MACHINE = IX86
  31. !else
  32. MACHINE         = $(CPU)
  33. !endif
  34. !endif
  35. !ifndef CFG_ENCODING
  36. CFG_ENCODING = "cp1252"
  37. !endif
  38. #----------------------------------------------------------
  39. # Set the proper copy method to avoid overwrite questions
  40. # to the user when copying files and selecting the right
  41. # "delete all" method.
  42. #----------------------------------------------------------
  43. !if "$(OS)" == "Windows_NT"
  44. RMDIR = rmdir /S /Q
  45. !if ![ver | find "4.0" > nul]
  46. CPY = echo y | xcopy /i
  47. !else
  48. CPY = xcopy /i /y >NUL
  49. !endif
  50. !else
  51. CPY = xcopy /i
  52. RMDIR = deltree /Y
  53. !endif
  54. MKDIR   = mkdir
  55. COPY    = copy /y >NUL
  56. !message ===============================================================================
  57. #----------------------------------------------------------
  58. # build the helper app we need to overcome nmake's limiting
  59. # environment.
  60. #----------------------------------------------------------
  61. !if !exist(nmakehlp.exe)
  62. !if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul]
  63. !endif
  64. !endif
  65. #----------------------------------------------------------
  66. # Test for compiler features
  67. #----------------------------------------------------------
  68. ### test for optimizations
  69. !if [nmakehlp -c -Ot]
  70. !message *** Compiler has 'Optimizations'
  71. OPTIMIZING = 1
  72. !else
  73. !message *** Compiler doesn't have 'Optimizations'
  74. OPTIMIZING = 0
  75. !endif
  76. OPTIMIZATIONS   =
  77. !if [nmakehlp -c -Ot]
  78. OPTIMIZATIONS  = $(OPTIMIZATIONS) -Ot
  79. !endif
  80. !if [nmakehlp -c -Oi]
  81. OPTIMIZATIONS  = $(OPTIMIZATIONS) -Oi
  82. !endif
  83. !if [nmakehlp -c -Op]
  84. OPTIMIZATIONS  = $(OPTIMIZATIONS) -Op
  85. !endif
  86. !if [nmakehlp -c -fp:strict]
  87. OPTIMIZATIONS  = $(OPTIMIZATIONS) -fp:strict
  88. !endif
  89. !if [nmakehlp -c -Gs]
  90. OPTIMIZATIONS  = $(OPTIMIZATIONS) -Gs
  91. !endif
  92. !if [nmakehlp -c -GS]
  93. OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
  94. !endif
  95. !if [nmakehlp -c -GL]
  96. OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
  97. !endif
  98. DEBUGFLAGS     =
  99. #  the platform SDK has broken headers that break the runtime checks for amd64
  100. !if "$(MACHINE)" != "AMD64"
  101. !if [nmakehlp -c -RTC1]
  102. DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
  103. !elseif [nmakehlp -c -GZ]
  104. DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
  105. !endif
  106. !endif
  107. COMPILERFLAGS  =-W3
  108. # In v13 -GL and -YX are incompatible.
  109. !if [nmakehlp -c -YX]
  110. !if ![nmakehlp -c -GL]
  111. OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
  112. !endif
  113. !endif
  114. !if "$(MACHINE)" == "IX86"
  115. ### test for pentium errata
  116. !if [nmakehlp -c -QI0f]
  117. !message *** Compiler has 'Pentium 0x0f fix'
  118. COMPILERFLAGS  = $(COMPILERFLAGSS) -QI0f
  119. !else
  120. !message *** Compiler doesn't have 'Pentium 0x0f fix'
  121. !endif
  122. !endif
  123. !if "$(MACHINE)" == "IA64"
  124. ### test for Itanium errata
  125. !if [nmakehlp -c -QIA64_Bx]
  126. !message *** Compiler has 'B-stepping errata workarounds'
  127. COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
  128. !else
  129. !message *** Compiler does not have 'B-stepping errata workarounds'
  130. !endif
  131. !endif
  132. !if "$(MACHINE)" == "IX86"
  133. ### test for -align:4096, when align:512 will do.
  134. !if [nmakehlp -l -opt:nowin98]
  135. !message *** Linker has 'Win98 alignment problem'
  136. ALIGN98_HACK = 1
  137. !else
  138. !message *** Linker doesn't have 'Win98 alignment problem'
  139. ALIGN98_HACK = 0
  140. !endif
  141. !else
  142. ALIGN98_HACK = 0
  143. !endif
  144. LINKERFLAGS     =
  145. !if [nmakehlp -l -ltcg]
  146. LINKERFLAGS     =-ltcg
  147. !endif
  148. #----------------------------------------------------------
  149. # MSVC8 (ships with Visual Studio 2005) generates a manifest
  150. # file that we should link into the binaries. This is how.
  151. #----------------------------------------------------------
  152. _VC_MANIFEST_EMBED_EXE=
  153. _VC_MANIFEST_EMBED_DLL=
  154. !if ![cl /Zs /Tc NUL 2>&1 | find "Version 12" > NUL]
  155. VCVER=6
  156. !elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 13" > NUL]
  157. VCVER=7
  158. !elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 14" > NUL]
  159. VCVER=8
  160. _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
  161. _VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
  162. !else
  163. VCVER=0
  164. !endif
  165. #----------------------------------------------------------
  166. # Decode the options requested.
  167. #----------------------------------------------------------
  168. !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
  169. STATIC_BUILD = 0
  170. TCL_THREADS = 0
  171. DEBUG = 0
  172. PROFILE = 0
  173. MSVCRT = 0
  174. LOIMPACT = 0
  175. TCL_USE_STATIC_PACKAGES = 0
  176. USE_THREAD_ALLOC = 0
  177. UNCHECKED = 0
  178. !else
  179. !if [nmakehlp -f $(OPTS) "static"]
  180. !message *** Doing static
  181. STATIC_BUILD = 1
  182. !else
  183. STATIC_BUILD = 0
  184. !endif
  185. !if [nmakehlp -f $(OPTS) "msvcrt"]
  186. !message *** Doing msvcrt
  187. MSVCRT = 1
  188. !else
  189. MSVCRT = 0
  190. !endif
  191. !if [nmakehlp -f $(OPTS) "staticpkg"]
  192. !message *** Doing staticpkg
  193. TCL_USE_STATIC_PACKAGES = 1
  194. !else
  195. TCL_USE_STATIC_PACKAGES = 0
  196. !endif
  197. !if [nmakehlp -f $(OPTS) "threads"]
  198. !message *** Doing threads
  199. TCL_THREADS = 1
  200. !else
  201. TCL_THREADS = 0
  202. !endif
  203. !if [nmakehlp -f $(OPTS) "symbols"]
  204. !message *** Doing symbols
  205. DEBUG = 1
  206. !else
  207. DEBUG = 0
  208. !endif
  209. !if [nmakehlp -f $(OPTS) "profile"]
  210. !message *** Doing profile
  211. PROFILE = 1
  212. !else
  213. PROFILE = 0
  214. !endif
  215. !if [nmakehlp -f $(OPTS) "loimpact"]
  216. !message *** Doing loimpact
  217. LOIMPACT = 1
  218. !else
  219. LOIMPACT = 0
  220. !endif
  221. !if [nmakehlp -f $(OPTS) "thrdalloc"]
  222. !message *** Doing thrdalloc
  223. USE_THREAD_ALLOC = 1
  224. !else
  225. USE_THREAD_ALLOC = 0
  226. !endif
  227. !if [nmakehlp -f $(OPTS) "unchecked"]
  228. !message *** Doing unchecked
  229. UNCHECKED = 1
  230. !else
  231. UNCHECKED = 0
  232. !endif
  233. !endif
  234. !if !$(STATIC_BUILD)
  235. # Make sure we don't build overly fat DLLs.
  236. MSVCRT = 1
  237. # We shouldn't statically put the extensions inside the shell when dynamic.
  238. TCL_USE_STATIC_PACKAGES = 0
  239. !endif
  240. #----------------------------------------------------------
  241. # Figure-out how to name our intermediate and output directories.
  242. # We wouldn't want different builds to use the same .obj files
  243. # by accident.
  244. #----------------------------------------------------------
  245. #----------------------------------------
  246. # Naming convention:
  247. #   t = full thread support.
  248. #   s = static library (as opposed to an
  249. # import library)
  250. #   g = linked to the debug enabled C
  251. # run-time.
  252. #   x = special static build when it
  253. # links to the dynamic C run-time.
  254. #----------------------------------------
  255. SUFX     = tsgx
  256. !if $(DEBUG)
  257. BUILDDIRTOP = Debug
  258. DBGX     = g
  259. !else
  260. BUILDDIRTOP = Release
  261. DBGX     =
  262. SUFX     = $(SUFX:g=)
  263. !endif
  264. !if "$(MACHINE)" != "IX86"
  265. BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
  266. !endif
  267. !if $(VCVER) > 6
  268. BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
  269. !endif
  270. TMP_DIRFULL = .$(BUILDDIRTOP)$(PROJECT)_ThreadedDynamicStaticX
  271. !if !$(STATIC_BUILD)
  272. TMP_DIRFULL = $(TMP_DIRFULL:Static=)
  273. SUFX     = $(SUFX:s=)
  274. EXT     = dll
  275. !if $(MSVCRT)
  276. TMP_DIRFULL = $(TMP_DIRFULL:X=)
  277. SUFX     = $(SUFX:x=)
  278. !endif
  279. !else
  280. TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
  281. EXT     = lib
  282. !if !$(MSVCRT)
  283. TMP_DIRFULL = $(TMP_DIRFULL:X=)
  284. SUFX     = $(SUFX:x=)
  285. !endif
  286. !endif
  287. !if !$(TCL_THREADS)
  288. TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
  289. SUFX     = $(SUFX:t=)
  290. !endif
  291. !ifndef TMP_DIR
  292. TMP_DIR     = $(TMP_DIRFULL)
  293. !ifndef OUT_DIR
  294. OUT_DIR     = .$(BUILDDIRTOP)
  295. !endif
  296. !else
  297. !ifndef OUT_DIR
  298. OUT_DIR     = $(TMP_DIR)
  299. !endif
  300. !endif
  301. #----------------------------------------------------------
  302. # Decode the statistics requested.
  303. #----------------------------------------------------------
  304. !if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"]
  305. TCL_MEM_DEBUG     = 0
  306. TCL_COMPILE_DEBUG   = 0
  307. !else
  308. !if [nmakehlp -f $(STATS) "memdbg"]
  309. !message *** Doing memdbg
  310. TCL_MEM_DEBUG     = 1
  311. !else
  312. TCL_MEM_DEBUG     = 0
  313. !endif
  314. !if [nmakehlp -f $(STATS) "compdbg"]
  315. !message *** Doing compdbg
  316. TCL_COMPILE_DEBUG   = 1
  317. !else
  318. TCL_COMPILE_DEBUG   = 0
  319. !endif
  320. !endif
  321. #----------------------------------------------------------
  322. # Decode the checks requested.
  323. #----------------------------------------------------------
  324. !if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
  325. TCL_NO_DEPRECATED     = 0
  326. FULLWARNINGS     = 0
  327. !else
  328. !if [nmakehlp -f $(CHECKS) "nodep"]
  329. !message *** Doing nodep check
  330. TCL_NO_DEPRECATED     = 1
  331. !else
  332. TCL_NO_DEPRECATED     = 0
  333. !endif
  334. !if [nmakehlp -f $(CHECKS) "fullwarn"]
  335. !message *** Doing full warnings check
  336. FULLWARNINGS     = 1
  337. !else
  338. FULLWARNINGS     = 0
  339. !endif
  340. !endif
  341. #----------------------------------------------------------
  342. # Set our defines now armed with our options.
  343. #----------------------------------------------------------
  344. OPTDEFINES =
  345. !if $(TCL_MEM_DEBUG)
  346. OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG
  347. !endif
  348. !if $(TCL_COMPILE_DEBUG)
  349. OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
  350. !endif
  351. !if $(TCL_THREADS)
  352. OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1
  353. !if $(USE_THREAD_ALLOC)
  354. OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
  355. !endif
  356. !endif
  357. !if $(STATIC_BUILD)
  358. OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD
  359. !endif
  360. !if $(DEBUG)
  361. OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DEBUG
  362. !elseif $(OPTIMIZING)
  363. OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
  364. !endif
  365. !if $(PROFILE)
  366. OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED
  367. !endif
  368. !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
  369. OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT
  370. !endif
  371. #----------------------------------------------------------
  372. # Get common info used when building extensions.
  373. #----------------------------------------------------------
  374. !if "$(PROJECT)" != "tcl"
  375. !if !defined(TCLDIR)
  376. !if exist("$(_INSTALLDIR)includetcl.h")
  377. TCLH = "$(_INSTALLDIR)includetcl.h"
  378. TCLINSTALL = 1
  379. _TCLDIR = $(_INSTALLDIR)
  380. !else
  381. MSG=^
  382. Failed to find tcl.h.  Set the TCLDIR macro.
  383. !error $(MSG)
  384. !endif
  385. !else
  386. _TCLDIR = $(TCLDIR:/=)
  387. !if exist("$(_TCLDIR)includetcl.h")
  388. TCLH = "$(_TCLDIR)includetcl.h"
  389. TCLINSTALL = 1
  390. !elseif exist("$(_TCLDIR)generictcl.h")
  391. TCLH = "$(_TCLDIR)generictcl.h"
  392. TCLINSTALL = 0
  393. !else
  394. MSG =^
  395. Failed to find tcl.h.  The TCLDIR macro does not appear correct.
  396. !error $(MSG)
  397. !endif
  398. !endif
  399. ### TODO: add a command to nmakehlp.c to grep for Tcl's version from tcl.h.
  400. ### Because nmake can't return a string, we'll need to play games with return
  401. ### codes.  It might look something like this:
  402. #!if [nmakehlp -g $(TCL.H)] == 81
  403. #TCL_DOTVERSION = 8.1
  404. #!elseif [nmakehlp -g $(TCL.H)] == 82
  405. #TCL_DOTVERSION = 8.2
  406. #...
  407. #!endif
  408. TCL_DOTVERSION = 8.4
  409. TCL_VERSION = $(TCL_DOTVERSION:.=)
  410. !if $(TCLINSTALL)
  411. TCLSH = "$(_INSTALLDIR)bintclsh$(TCL_VERSION)$(SUFX).exe"
  412. TCLSTUBLIB = "$(_INSTALLDIR)libtclstub$(TCL_VERSION).lib"
  413. TCLIMPLIB = "$(_INSTALLDIR)libtcl$(TCL_VERSION)$(SUFX).lib"
  414. TCL_LIBRARY = $(_INSTALLDIR)lib
  415. TCLREGLIB = "$(_INSTALLDIR)libtclreg11$(SUFX:t=).lib"
  416. TCLDDELIB = "$(_INSTALLDIR)libtcldde12$(SUFX:t=).lib"
  417. COFFBASE = musthavetclsourcestobuildthistarget
  418. TCLTOOLSDIR = musthavetclsourcestobuildthistarget
  419. !else
  420. TCLSH = "$(_TCLDIR)win$(BUILDDIRTOP)tclsh$(TCL_VERSION)$(SUFX).exe"
  421. TCLSTUBLIB = "$(_TCLDIR)win$(BUILDDIRTOP)tclstub$(TCL_VERSION).lib"
  422. TCLIMPLIB = "$(_TCLDIR)win$(BUILDDIRTOP)tcl$(TCL_VERSION)$(SUFX).lib"
  423. TCL_LIBRARY = $(_TCLDIR)library
  424. TCLREGLIB = "$(_TCLDIR)win$(BUILDDIRTOP)tclreg11$(SUFX:t=).lib"
  425. TCLDDELIB = "$(_TCLDIR)win$(BUILDDIRTOP)tcldde12$(SUFX:t=).lib"
  426. COFFBASE = "$(_TCLDIR)wincoffbase.txt"
  427. TCLTOOLSDIR = $(_TCLDIR)tools
  428. !endif
  429. !endif
  430. #----------------------------------------------------------
  431. # Display stats being used.
  432. #----------------------------------------------------------
  433. !message *** Intermediate directory will be '$(TMP_DIR)'
  434. !message *** Output directory will be '$(OUT_DIR)'
  435. !message *** Suffix for binaries will be '$(SUFX)'
  436. !message *** Optional defines are '$(OPTDEFINES)'
  437. !message *** Compiler version $(VCVER)
  438. !message *** Compiler options '$(OPTIMIZATIONS) $(DEBUGFLAGS)'
  439. !message *** Link options '$(LINKERFLAGS)'
  440. !endif