Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

378 lines
10 KiB

  1. #############################################################################
  2. ##
  3. ## EHCRT.MAK - Makefile for the C Runtime code for C++ Exception Handling
  4. ##
  5. ## Targets:
  6. ## ========
  7. ##
  8. ## ehcrt.lib
  9. ## |
  10. ## +-- throw.obj (throw.cpp) - Handles the 'throw' statement
  11. ## |
  12. ## +-- frame.obj (frame.cpp) - The frame handler, including unwind
  13. ## | and handler matching
  14. ## |
  15. ## +-- trnsctrl.obj (trnsctrl.asm) - Transfer of control.
  16. ## | Very machine dependant!!!!!
  17. ## |
  18. ## +-- hooks.obj (hooks.cpp) - Initialized variables for callbacks
  19. ## |
  20. ## +-- user.obj (user.cpp) - Callback registration hooks (eg set_terminate())
  21. ## |
  22. ## +-- unhandld.obj (unhandld.cpp) -- Intercept an unhandled exception
  23. ##
  24. ##
  25. ## all - pseudo target; all of the above.
  26. ##
  27. ## clean - pseudo target. Delete everything from build directory.
  28. ##
  29. ## Environment:
  30. ## ============
  31. ## TPROC ( =i ) Target processor. i - Intel x86; p7 - Merced; m - MIPS. No other values supported.
  32. ##
  33. ## TOS ( =n ) Target OS. n - Windows NT. No other values supported.
  34. ##
  35. ## HOST ( =n ) Host OS. n - Windows NT. No other values supported.
  36. ##
  37. ## VARIANT ( =m ) Library variant:
  38. ## s - Single-threaded
  39. ## m - Multi-threaded
  40. ## d - DLL (Multi-threaded)
  41. ##
  42. ## DEBUG ( =1 ) 2 - Compile with debug code enabled & debug info,
  43. ## 1 - Compile with debug info only, 0 - no debug info.
  44. ##
  45. ## BROWSE ( =1 ) 1 - Build browser database, 0 - no browser database.
  46. ##
  47. ## Build directory is catenation of these options, in this order, eg:
  48. ## innm.11
  49. ##
  50. ##
  51. #############################################################################
  52. #############################################################################
  53. #
  54. # Check the environment variables, and establish defaults:
  55. #
  56. !if defined(DEBUG)
  57. ! if !(($(DEBUG)==0) || ($(DEBUG)==1) || ($(DEBUG)==2))
  58. ! error "bad value for DEBUG"
  59. ! endif
  60. !else
  61. DEBUG=1
  62. !endif
  63. !if defined(BROWSE)
  64. ! if !(($(BROWSE)==0) || ($(BROWSE)==1))
  65. ! error "bad value for BROWSE"
  66. ! endif
  67. !else
  68. BROWSE=1
  69. !endif
  70. !if defined(TPROC)
  71. ! if !("$(TPROC)"=="i" || "$(TPROC)"=="I" || "$(TPROC)"=="m" || "$(TPROC)"=="M" || "$(TPROC)"=="p7" || "$(TPROC)"=="P7" )
  72. ! error "bad value for TPROC"
  73. ! endif
  74. !else
  75. TPROC=i
  76. !endif
  77. !if defined(TOS)
  78. ! if !("$(TOS)"=="n" || "$(TOS)"=="N")
  79. ! error "bad value for TOS"
  80. ! endif
  81. !else
  82. TOS=n
  83. !endif
  84. !if defined(HOST)
  85. ! if !("$(HOST)"=="n" || "$(HOST)"=="N")
  86. ! error "bad value for HOST"
  87. ! endif
  88. !else
  89. HOST=n
  90. !endif
  91. !if defined(VARIANT)
  92. ! if !("$(VARIANT)"=="s" || "$(VARIANT)"=="m" || "$(VARIANT)"=="d" || "$(VARIANT)"=="S" || "$(VARIANT)"=="M" || "$(VARIANT)"=="D")
  93. ! error "bad value for VARIANT"
  94. ! endif
  95. !else
  96. VARIANT=m
  97. !endif
  98. #############################################################################
  99. #
  100. # Version Control build macros
  101. #
  102. !if "$(TPROC)" == "i" || "$(TPROC)" == "I"
  103. CFLAGS_VER=$(CFLAGS_VER) -DVERSP_C386 -D_M_IX86=500 -Gz -D_CRTBLD
  104. AFLAGS_VER=$(AFLAGS_VER) -Di386 -D_CRTBLD
  105. !else if "$(TPROC)" == "m" || "$(TPROC)" == "M"
  106. CFLAGS_VER=$(CFLAGS_VER) -DVERSP_RISC
  107. !else if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  108. CFLAGS_VER=$(CFLAGS_VER) -D_IA64_ -D_TICORE -D_CRTBLD
  109. !endif
  110. !if "$(TOS)" == "n" || "$(TOS)" == "N"
  111. CFLAGS_VER=$(CFLAGS_VER) -DVERSP_WINNT
  112. !endif
  113. !if "$(HOST)" == "n" || "$(HOST)" == "N"
  114. CFLAGS_VER=$(CFLAGS_VER) -DVERSH_WINNT
  115. !endif
  116. !if "$(VARIANT)" == "m" || "$(VARIANT)" == "d" || "$(VARIANT)" == "M" || "$(VARIANT)" == "D"
  117. CFLAGS_VER=$(CFLAGS_VER) -MT
  118. AFLAGS_VER=$(AFLAGS_VER) -D_MT
  119. !endif
  120. !if "$(VARIANT)" == "d" || "$(VARIANT)" == "D"
  121. CFLAGS_VER=$(CFLAGS_VER) -DCRTDLL -DEXPORT_HACK
  122. AFLAGS_VER=$(AFLAGS_VER) -DCRTDLL
  123. !endif
  124. #############################################################################
  125. #
  126. # Set up standard build macros:
  127. #
  128. #
  129. # The build directory for this version:
  130. #
  131. OBJDIR=.\$(TPROC)$(TOS)$(HOST)$(VARIANT).$(DEBUG)$(BROWSE)
  132. #
  133. # Location of \langapi project (our data structures are there)
  134. #
  135. !ifndef LANGAPI
  136. LANGAPI=\langapi
  137. !endif
  138. #
  139. # Directory for target-dependent stuff
  140. #
  141. !if "$(TPROC)" == "i" || "$(TPROC)" == "I"
  142. MACHDEP=.\I386
  143. !else if "$(TPROC)" == "m" || "$(TPROC)" == "M"
  144. MACHDEP=.\MIPS
  145. !else if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  146. MACHDEP=.\IA64
  147. !endif
  148. #
  149. # All object files that go in the library:
  150. #
  151. LIBOBJS=$(OBJDIR)\frame.obj $(OBJDIR)\throw.obj $(OBJDIR)\user.obj \
  152. $(OBJDIR)\hooks.obj $(OBJDIR)\validate.obj \
  153. $(OBJDIR)\unhandld.obj \
  154. $(OBJDIR)\trnsctrl.obj \
  155. !if "$(TPROC)" == "i" || "$(TPROC)" == "I"
  156. $(OBJDIR)\ehprolog.obj \
  157. $(OBJDIR)\lowhelpr.obj \
  158. !endif
  159. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  160. $(OBJDIR)\ehstate.obj \
  161. $(OBJDIR)\handlers.obj \
  162. !endif
  163. $(OBJDIR)\typinfo.obj \
  164. $(OBJDIR)\ehvccctr.obj \
  165. $(OBJDIR)\ehvcccvb.obj \
  166. $(OBJDIR)\ehvecctr.obj \
  167. $(OBJDIR)\ehveccvb.obj \
  168. $(OBJDIR)\ehvecdtr.obj
  169. #
  170. # All the places to look for include files:
  171. #
  172. CFLAGS_INC=-I. -I..\h -I$(MACHDEP) -I$(LANGAPI)\include -I$(LANGAPI)\undname
  173. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  174. CFLAGS_INC=$(CFLAGS_INC) -I$(DEVDRV)\sdk7177\include -I$(DEVDRV)\sdk7177\include\crt
  175. !endif
  176. AFLAGS_INC=$(CFLAGS_INC)
  177. #
  178. # Invoking the C compiler:
  179. #
  180. !if ($(DEBUG) == 2)
  181. CFLAGS_DB=-DDEBUG -Zi -Od
  182. AFLAGS_DB=-Zi
  183. !else if ($(DEBUG) == 1)
  184. CFLAGS_DB=-Od
  185. AFLAGS_DB=
  186. !else
  187. CFLAGS_DB=-Ox
  188. AFLAGS_DB=
  189. !endif
  190. !if ($(BROWSE) > 0)
  191. CFLAGS_BR=-FR.\$(OBJDIR)/
  192. AFLAGS_BR=-FR.\$(OBJDIR)/
  193. !else
  194. CFLAGS_BR=
  195. AFLAGS_BR=
  196. !endif
  197. CFLAGS_PCH=-Fp$(OBJDIR)\ehcrt.pch
  198. CFLAGS =-c -d1Binl -W3 -Fd$(OBJDIR)\ehcrt.pdb $(CFLAGS_PCH) $(CFLAGS_DB) $(CFLAGS_BR) $(CFLAGS_VER) $(CFLAGS_INC)
  199. AFLAGS =-c -coff -Cx -Zm $(AFLAGS_DB) $(AFLAGS_BR) $(AFLAGS_VER) $(AFLAGS_INC)
  200. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  201. CC=$(DEVDRV)\p7drop\x86\bin\cl -Bd -Bk$(OBJDIR)\$(@B).il -Bx $(DEVDRV)\vc5xfe\sl\p1\c\10030613.410\c1n32.dll -B1 $(DEVDRV)\vc5xfe\sl\p1\c\00030613.410\c1n32.dll -B2 $(DEVDRV)\utc2\src\p2\p7\win32d.o\p2.exe
  202. #CC=$(DEVDRV)\p7drop\x86\bin\cl -Bd -Bk$(OBJDIR)\$(@B).il -B2 $(DEVDRV)\utc2\src\p2\p7\win32d.o\p2.exe
  203. LINK=ilink
  204. !else
  205. CC=cl
  206. LINK=link
  207. !endif
  208. #
  209. # Invoking the assembler:
  210. #
  211. AS=ml
  212. #
  213. # Invoking the librarian:
  214. #
  215. !if "$(VARIANT)" == "d" || "$(VARIANT)" == "D"
  216. LIBRARIAN=$(LINK) -dll
  217. !else
  218. LIBRARIAN=$(LINK) -lib
  219. !endif
  220. #############################################################################
  221. #
  222. # Targets & Dependancies
  223. #
  224. #
  225. # Default target:
  226. #
  227. all: objdir $(OBJDIR)\ehcrt$(VARIANT).lib
  228. #
  229. # Clean up for clean rebuild:
  230. #
  231. clean:
  232. del $(OBJDIR)\*.obj
  233. del $(OBJDIR)\*.lib
  234. del $(OBJDIR)\*.pdb
  235. del $(OBJDIR)\*.sbr
  236. del $(OBJDIR)\*.bsc
  237. #
  238. # Make sure the target directory exists:
  239. #
  240. objdir:
  241. !if !exist($(OBJDIR))
  242. @mkdir $(OBJDIR)
  243. !endif
  244. #
  245. # Main target:
  246. #
  247. ehcrt$(VARIANT).lib: objdir $(OBJDIR)\ehcrt$(VARIANT).lib
  248. $(OBJDIR)\ehcrt$(VARIANT).lib: $(LIBOBJS)
  249. !if "$(VARIANT)" == "d" || "$(VARIANT)" == "D"
  250. $(LIBRARIAN) -out:$(@R).dll -implib:$@ $**
  251. !else if "$(VARIANT)" == "m" || "$(VARIANT)" == "M"
  252. $(LIBRARIAN) -out:$@ $**
  253. !else
  254. $(LIBRARIAN) -out:$@ $**
  255. !endif
  256. !if ($(BROWSE) == 1)
  257. bscmake -Iu -o$(OBJDIR)\ehcrt.bsc $(OBJDIR)\*.sbr
  258. !endif
  259. #
  260. # Generic C/C++ inference rules:
  261. #
  262. .c{$(OBJDIR)}.obj:
  263. $(CC) -nologo $(CFLAGS) -Yu $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  264. .cpp{$(OBJDIR)}.obj:
  265. $(CC) -nologo $(CFLAGS) -Yu $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  266. {$(MACHDEP)}.cpp{$(OBJDIR)}.obj:
  267. $(CC) -nologo $(CFLAGS) -Yu $(MACHDEP)\$(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  268. #
  269. # Generic Masm inference rule:
  270. #
  271. !if "$(TPROC)" == "m" || "$(TPROC)" == "M"
  272. {$(MACHDEP)}.s{$(OBJDIR)}.obj:
  273. $(CC) -nologo $(CFLAGS) $(MACHDEP)\$(@B).s -Fo$@
  274. !else if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  275. {$(MACHDEP)}.s{$(OBJDIR)}.obj:
  276. ias -o$(OBJDIR)\$(@B).obj $(MACHDEP)\$(@B).s
  277. !else
  278. {$(MACHDEP)}.asm{$(OBJDIR)}.obj:
  279. $(AS) $(AFLAGS) -Fo$@ $<
  280. !endif
  281. #
  282. # Specific header file dependancies:
  283. #
  284. $(OBJDIR)\throw.obj: $(LANGAPI)\include\ehdata.h
  285. $(OBJDIR)\frame.obj: $(LANGAPI)\include\ehdata.h ..\h\ehassert.h ..\h\trnsctrl.h ..\h\eh.h ..\h\ehstate.h
  286. $(CC) -nologo $(CFLAGS) -Yc frame.cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  287. $(OBJDIR)\trnsctrl.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\trnsctrl.h
  288. $(OBJDIR)\user.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  289. $(OBJDIR)\hooks.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  290. $(OBJDIR)\validate.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  291. $(OBJDIR)\unhandld.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  292. $(OBJDIR)\ehstate.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\ehstate.h
  293. $(OBJDIR)\ehvccctr.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  294. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  295. $(OBJDIR)\ehvcccvb.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  296. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  297. $(OBJDIR)\ehvecctr.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  298. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  299. $(OBJDIR)\ehveccvb.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  300. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  301. $(OBJDIR)\ehvecdtr.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  302. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  303. $(OBJDIR)\typinfo.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\typeinfo.h $(LANGAPI)\undname\undname.h
  304. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  305. !if "$(TPROC)" == "i" || "$(TPROC)" == "I"
  306. $(OBJDIR)\ehprolog.obj:
  307. $(OBJDIR)\lowhelpr.obj:
  308. !endif
  309. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  310. $(OBJDIR)\handlers.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\trnsctrl.h $(MACHDEP)\handlers.s
  311. ias -o$(OBJDIR)\$(@B).obj $(CFLAGS_INC) $(MACHDEP)\$(@B).s
  312. $(OBJDIR)\hack.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\trnsctrl.h $(MACHDEP)\handlers.cpp
  313. $(CC) -nologo $(CFLAGS) -Yu $(MACHDEP)\handlers.cpp -Fa$(MACHDEP)\handlers.s -o$(OBJDIR)\$(@B).obj
  314. !endif