Source code of Windows XP (NT5)
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.

357 lines
9.5 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. !else if "$(TPROC)" == "m" || "$(TPROC)" == "M"
  105. CFLAGS_VER=$(CFLAGS_VER) -DVERSP_RISC
  106. !else if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  107. CFLAGS_VER=$(CFLAGS_VER) -D_IA64_ -D_TICORE -D_CRTBLD
  108. !endif
  109. !if "$(TOS)" == "n" || "$(TOS)" == "N"
  110. CFLAGS_VER=$(CFLAGS_VER) -DVERSP_WINNT
  111. !endif
  112. !if "$(HOST)" == "n" || "$(HOST)" == "N"
  113. CFLAGS_VER=$(CFLAGS_VER) -DVERSH_WINNT
  114. !endif
  115. !if "$(VARIANT)" == "m" || "$(VARIANT)" == "d" || "$(VARIANT)" == "M" || "$(VARIANT)" == "D"
  116. CFLAGS_VER=$(CFLAGS_VER) -MT
  117. !endif
  118. !if "$(VARIANT)" == "d" || "$(VARIANT)" == "D"
  119. CFLAGS_VER=$(CFLAGS_VER) -DCRTDLL -DEXPORT_HACK
  120. !endif
  121. #############################################################################
  122. #
  123. # Set up standard build macros:
  124. #
  125. #
  126. # The build directory for this version:
  127. #
  128. OBJDIR=.\$(TPROC)$(TOS)$(HOST)$(VARIANT).$(DEBUG)$(BROWSE)
  129. #
  130. # Location of \langapi project (our data structures are there)
  131. #
  132. !ifndef LANGAPI
  133. LANGAPI=\langapi
  134. !endif
  135. #
  136. # Directory for target-dependent stuff
  137. #
  138. !if "$(TPROC)" == "i" || "$(TPROC)" == "I"
  139. MACHDEP=.\I386
  140. !else if "$(TPROC)" == "m" || "$(TPROC)" == "M"
  141. MACHDEP=.\MIPS
  142. !else if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  143. MACHDEP=.\IA64
  144. !endif
  145. #
  146. # All object files that go in the library:
  147. #
  148. LIBOBJS=$(OBJDIR)\frame.obj $(OBJDIR)\throw.obj $(OBJDIR)\user.obj \
  149. $(OBJDIR)\hooks.obj $(OBJDIR)\validate.obj \
  150. $(OBJDIR)\unhandld.obj \
  151. $(OBJDIR)\trnsctrl.obj \
  152. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  153. $(OBJDIR)\ehstate.obj \
  154. $(OBJDIR)\handlers.obj \
  155. !endif
  156. $(OBJDIR)\typinfo.obj \
  157. $(OBJDIR)\ehvccctr.obj \
  158. $(OBJDIR)\ehvcccvb.obj \
  159. $(OBJDIR)\ehvecctr.obj \
  160. $(OBJDIR)\ehveccvb.obj \
  161. $(OBJDIR)\ehvecdtr.obj
  162. #
  163. # All the places to look for include files:
  164. #
  165. CFLAGS_INC=-I. -I..\h -I$(MACHDEP) -I$(LANGAPI)\include -I$(LANGAPI)\undname
  166. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  167. CFLAGS_INC=$(CFLAGS_INC) -I$(DEVDRV)\sdk7177\include -I$(DEVDRV)\sdk7177\include\crt
  168. !endif
  169. #
  170. # Invoking the C compiler:
  171. #
  172. !if ($(DEBUG) == 2)
  173. CFLAGS_DB=-DDEBUG -Zi -Od
  174. !else if ($(DEBUG) == 1)
  175. CFLAGS_DB=-Od
  176. !else
  177. CFLAGS_DB=-Ox
  178. !endif
  179. !if ($(BROWSE) > 0)
  180. CFLAGS_BR=-FR.\$(OBJDIR)/
  181. !else
  182. CFLAGS_BR=
  183. !endif
  184. CFLAGS_PCH=-Fp$(OBJDIR)\ehcrt.pch
  185. CFLAGS =-c -d1Binl -W3 -Fd$(OBJDIR)\ehcrt.pdb $(CFLAGS_PCH) $(CFLAGS_DB) $(CFLAGS_BR) $(CFLAGS_VER) $(CFLAGS_INC)
  186. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  187. 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
  188. #CC=$(DEVDRV)\p7drop\x86\bin\cl -Bd -Bk$(OBJDIR)\$(@B).il -B2 $(DEVDRV)\utc2\src\p2\p7\win32d.o\p2.exe
  189. LINK=ilink
  190. !else
  191. CC=cl
  192. LINK=link
  193. !endif
  194. #
  195. # Invoking the assembler:
  196. #
  197. AS=masm386
  198. #
  199. # Invoking the librarian:
  200. #
  201. !if "$(VARIANT)" == "d" || "$(VARIANT)" == "D"
  202. LIBRARIAN=$(LINK) -dll
  203. !else
  204. LIBRARIAN=$(LINK) -lib
  205. !endif
  206. #############################################################################
  207. #
  208. # Targets & Dependancies
  209. #
  210. #
  211. # Default target:
  212. #
  213. all: objdir $(OBJDIR)\ehcrt$(VARIANT).lib
  214. #
  215. # Clean up for clean rebuild:
  216. #
  217. clean:
  218. del $(OBJDIR)\*.obj
  219. del $(OBJDIR)\*.lib
  220. del $(OBJDIR)\*.pdb
  221. del $(OBJDIR)\*.sbr
  222. del $(OBJDIR)\*.bsc
  223. #
  224. # Make sure the target directory exists:
  225. #
  226. objdir:
  227. !if !exist($(OBJDIR))
  228. @mkdir $(OBJDIR)
  229. !endif
  230. #
  231. # Main target:
  232. #
  233. ehcrt$(VARIANT).lib: objdir $(OBJDIR)\ehcrt$(VARIANT).lib
  234. $(OBJDIR)\ehcrt$(VARIANT).lib: $(LIBOBJS)
  235. !if "$(VARIANT)" == "d" || "$(VARIANT)" == "D"
  236. $(LIBRARIAN) -out:$(@R).dll -implib:$@ $**
  237. !else if "$(VARIANT)" == "m" || "$(VARIANT)" == "M"
  238. $(LIBRARIAN) -out:$@ $**
  239. !else
  240. $(LIBRARIAN) -out:$@ $**
  241. !endif
  242. !if ($(BROWSE) == 1)
  243. bscmake -Iu -o$(OBJDIR)\ehcrt.bsc $(OBJDIR)\*.sbr
  244. !endif
  245. #
  246. # Generic C/C++ inference rules:
  247. #
  248. .c{$(OBJDIR)}.obj:
  249. $(CC) -nologo $(CFLAGS) -Yu $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  250. .cpp{$(OBJDIR)}.obj:
  251. $(CC) -nologo $(CFLAGS) -Yu $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  252. {$(MACHDEP)}.cpp{$(OBJDIR)}.obj:
  253. $(CC) -nologo $(CFLAGS) -Yu $(MACHDEP)\$(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  254. #
  255. # Generic Masm inference rule:
  256. #
  257. !if "$(TPROC)" == "m" || "$(TPROC)" == "M"
  258. {$(MACHDEP)}.s{$(OBJDIR)}.obj:
  259. $(CC) -nologo $(CFLAGS) $(MACHDEP)\$(@B).s -Fo$@
  260. !else if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  261. {$(MACHDEP)}.s{$(OBJDIR)}.obj:
  262. ias -o$(OBJDIR)\$(@B).obj $(MACHDEP)\$(@B).s
  263. !else
  264. {$(MACHDEP)}.asm{$(OBJDIR)}.obj:
  265. @echo Don't know how to build MASM stuff yet.
  266. !endif
  267. #
  268. # Specific header file dependancies:
  269. #
  270. $(OBJDIR)\throw.obj: $(LANGAPI)\include\ehdata.h
  271. $(OBJDIR)\frame.obj: $(LANGAPI)\include\ehdata.h ..\h\ehassert.h ..\h\trnsctrl.h ..\h\eh.h ..\h\ehstate.h
  272. $(CC) -nologo $(CFLAGS) -Yc frame.cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  273. $(OBJDIR)\trnsctrl.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\trnsctrl.h
  274. $(OBJDIR)\user.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  275. $(OBJDIR)\hooks.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  276. $(OBJDIR)\validate.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  277. $(OBJDIR)\unhandld.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  278. $(OBJDIR)\ehstate.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\ehstate.h
  279. $(OBJDIR)\ehvccctr.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  280. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  281. $(OBJDIR)\ehvcccvb.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  282. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  283. $(OBJDIR)\ehvecctr.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  284. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  285. $(OBJDIR)\ehveccvb.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  286. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  287. $(OBJDIR)\ehvecdtr.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h
  288. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  289. $(OBJDIR)\typinfo.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\typeinfo.h $(LANGAPI)\undname\undname.h
  290. $(CC) -nologo $(CFLAGS) $(@B).cpp -Fo$(OBJDIR)\$(@B).obj -Fa$(OBJDIR)\$(@B).s
  291. !if "$(TPROC)" == "p7" || "$(TPROC)" == "P7"
  292. $(OBJDIR)\handlers.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\trnsctrl.h $(MACHDEP)\handlers.s
  293. ias -o$(OBJDIR)\$(@B).obj $(CFLAGS_INC) $(MACHDEP)\$(@B).s
  294. $(OBJDIR)\hack.obj: $(LANGAPI)\include\ehdata.h ..\h\eh.h ..\h\trnsctrl.h $(MACHDEP)\handlers.cpp
  295. $(CC) -nologo $(CFLAGS) -Yu $(MACHDEP)\handlers.cpp -Fa$(MACHDEP)\handlers.s -o$(OBJDIR)\$(@B).obj
  296. !endif