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.

301 lines
7.6 KiB

  1. !include common.mkf
  2. CS = $(CRT_BUILDDIR)\srcrel\$(CPUDIR)
  3. !if "$(LLP64)" == "0" || "$(PA)" == "IA64" || "$(PA)" == "AMD64"
  4. CC = cl
  5. BLDFLAG =
  6. !else
  7. # Doing a cross-compiler build. Make sure we use the native tools. Clear
  8. # _CL_ just in case it includes -B1/-Bx/-B2 pointing to cross-compiling passes.
  9. CC = "$(DEVTOOLSBIN)\cl"
  10. _CL_=
  11. ! if "$(PA)" == "x86" && "$(LLP64)"=="1"
  12. BLDFLAG = -D_BUILD_IA64
  13. ! elseif "$(PA)" == "x86" && "$(LLP64)"=="2"
  14. BLDFLAG = -D_BUILD_AMD64
  15. ! else
  16. ! error Unknown platform for 64-bit targetted CRT build
  17. ! endif
  18. !endif
  19. # Make sure an existing CRT build tree is not used for an incompatible build
  20. !if "$(LLP64)"=="0" || "$(BLD_SYSCRT)"=="0"
  21. ! if exist("$(CRT_BUILDDIR)\crt\src\dlldef.cpp")
  22. ! message *** ERROR: Attempting a build that uses stdcpp into an existing
  23. ! message *** build tree that was last used for a stdcpp64 build!
  24. ! error Delnode the build tree and try again
  25. ! endif
  26. !else
  27. ! if exist("$(CRT_BUILDDIR)\crt\src\instances.cpp")
  28. ! message *** ERROR: Attempting a build that uses stdcpp64 into an existing
  29. ! message *** build tree that was last used for a stdcpp build!
  30. ! error Delnode the build tree and try again
  31. ! endif
  32. !endif
  33. BT = $(CRT_BUILDDIR)\crt\src\build\build.txt
  34. !if exist("$(BT)")
  35. ! if [ findstr -c:"TARGET:$(TARGET_CPU)" "$(BT)" >nul ] || \
  36. [ findstr -c:"LLP64:$(LLP64)" "$(BT)" >nul ] || \
  37. [ findstr -c:"BLD_SYSCRT:$(BLD_SYSCRT)" "$(BT)" >nul ]
  38. ! message *** ERROR: Attempting to use an existing build tree that was last
  39. ! message *** used for an incompatible type of build.
  40. ! message === Previous build type: ===
  41. ! if [ type "$(BT)" ]
  42. ! endif
  43. ! message ============================
  44. ! error Delnode the build tree, or run CLEANBLD DELOBJ
  45. ! endif
  46. !endif
  47. !if [ mkdir "$(CRT_BUILDDIR)" > nul 2>&1 ]
  48. ! if [ mkdir "$(CRT_BUILDDIR)\crt" > nul 2>&1 ]
  49. ! if [ mkdir "$(CRT_BUILDDIR)\crt\src" > nul 2>&1 ]
  50. ! if [ mkdir "$(CRT_BUILDDIR)\crt\src\build" > nul 2>&1 ]
  51. ! endif
  52. ! endif
  53. ! endif
  54. !endif
  55. !if [ echo TARGET:$(TARGET_CPU) > "$(BT)" ] || 1
  56. ! if [ echo LLP64:$(LLP64) >> "$(BT)" ] || 1
  57. ! if [ echo BLD_SYSCRT:$(BLD_SYSCRT) >> "$(BT)" ] || 1
  58. ! endif
  59. ! endif
  60. !endif
  61. !if "$(LLP64)" != "0"
  62. ! if "$(BLD_SYSCRT)" == "0"
  63. MKCLNMKFFLAGS = -64
  64. ! else
  65. MKCLNMKFFLAGS = -sys -64
  66. ! endif
  67. !elseif "$(BLD_SYSCRT)" == "1"
  68. MKCLNMKFFLAGS = -sys
  69. !else
  70. MKCLNMKFFLAGS =
  71. !endif
  72. !if "$(NOCLEAN)" == "1"
  73. MKCLNMKFFLAGS = $(MKCLNMKFFLAGS) -noclean
  74. !endif
  75. all: $(CS) $(CS)\makefile.pre $(CS)\makefile.rel
  76. $(CS):
  77. if not exist $(CRT_BUILDDIR)\srcrel\nul mkdire $(CRT_BUILDDIR)\srcrel
  78. if not exist $(CS)\nul mkdire $(CS)
  79. !if 0
  80. !if "$(PA)"=="x86"
  81. TOOLDIR = ..\libw32\tools\i386
  82. !else
  83. TOOLDIR = ..\libw32\tools\$(PA)
  84. !endif
  85. pd-b: $(TOOLDIR)\pd.exe $(TOOLDIR)\tolwrupr.exe
  86. $(TOOLDIR)\pd -tZ \\lang5\rtl\src\crt60a > temp1
  87. $(TOOLDIR)\tolwrupr -L temp1 > temp2
  88. sed "s/\\\\lang5\\rtl\\src\\crt60a\\//" temp2 > pd-b
  89. -del temp1
  90. -del temp2
  91. !endif
  92. $(CS)\pd-d: pd-b
  93. sed "/\\$$/!d" pd-b > $(CS)\pd-d
  94. $(CS)\pd-f: pd-b
  95. sed "/\\$$/d" pd-b > $(CS)\pd-f
  96. $(CS)\mkdirs.i: $(CS)\pd-d mkdirs.sed
  97. sed -f mkdirs.sed $(CS)\pd-d > $(CS)\mkdirs.i
  98. $(CS)\mkfiles.i: $(CS)\pd-f mkfiles.sed
  99. sed -f mkfiles.sed $(CS)\pd-f > $(CS)\mkfiles.i
  100. $(CS)\cleanlst.sed: makefile
  101. @echo > nul <<$@
  102. !if "$(LLP64)"=="0" || "$(BLD_SYSCRT)"=="0"
  103. /stdcpp\\xmbtowc.c/s/stdcpp/stdxxx/
  104. /stdcpp\\xstrcoll.c/s/stdcpp/stdxxx/
  105. /stdcpp\\xstrxfrm.c/s/stdcpp/stdxxx/
  106. /stdcpp\\xwcscoll.c/s/stdcpp/stdxxx/
  107. /stdcpp\\xwcsxfrm.c/s/stdcpp/stdxxx/
  108. /stdcpp\\xwctomb.c/s/stdcpp/stdxxx/
  109. /stdcpp\\_tolower.c/s/stdcpp/stdxxx/
  110. /stdcpp\\_toupper.c/s/stdcpp/stdxxx/
  111. !else
  112. /stdcpp64\\xlock.cpp/s/stdcpp/stdxxx/
  113. /stdcpp64\\xmbtowc.c/s/stdcpp/stdxxx/
  114. /stdcpp64\\xstrcoll.c/s/stdcpp/stdxxx/
  115. /stdcpp64\\xstrxfrm.c/s/stdcpp/stdxxx/
  116. /stdcpp64\\xwcscoll.c/s/stdcpp/stdxxx/
  117. /stdcpp64\\xwcsxfrm.c/s/stdcpp/stdxxx/
  118. /stdcpp64\\xwctomb.c/s/stdcpp/stdxxx/
  119. /stdcpp64\\_tolower.c/s/stdcpp/stdxxx/
  120. /stdcpp64\\_toupper.c/s/stdcpp/stdxxx/
  121. !endif
  122. /opnt\.cpp$$/d
  123. /^crtw32\\std[ch]pp\\/d
  124. /^crtw32\\std[ch]pp64\\/d
  125. s/\\stdxxx/\\stdcpp/
  126. /^libw32\\/d
  127. /^fpw32\\/d
  128. /^srcrel\\/d
  129. /\\tools\\/d
  130. /\\common\\/d
  131. !if "$(PA)"!="IA64" && ("$(PA)"!="x86" || "$(LLP64)"!="1")
  132. /\\ia64\\/d
  133. !endif
  134. !if "$(PA)"!="AMD64" && ("$(PA)"!="x86" || "$(LLP64)"!="2")
  135. /\\amd64\\/d
  136. !endif
  137. !if "$(PA)"!="x86" || "$(LLP64)"!="0"
  138. /\\i386\\/d
  139. /\\adjustfd\.c/d
  140. /\\seccinit\.c/d
  141. /\\seccook\.c/d
  142. /\\secfail\.c/d
  143. /\\seclocf\.c/d
  144. !endif
  145. !if "$(PA)"=="x86"
  146. /^crtw32\\h\\i386\\/d
  147. !endif
  148. /\\small\\/d
  149. /\\lsources$$/d
  150. /\.bat$$/d
  151. /\.cmd$$/d
  152. /\.exe$$/d
  153. /68k/d
  154. /makefile/d
  155. /\.if$$/d
  156. /\.a$$/d
  157. /\.rc$$/d
  158. /\.def$$/d
  159. /\.txt$$/d
  160. /\.sed$$/d
  161. /\.hs$$/d
  162. /\.mak$$/d
  163. /\\bintree\.cpp/d
  164. /\\callsite\.cpp/d
  165. /\\chkesp\.c/d
  166. /\\chkstk\.s/d
  167. /\\chsyheap\.cpp/d
  168. /\\cinitone\.s/d
  169. /\\contain\.cpp/d
  170. /\\convert\.cpp/d
  171. /\\csysex\./d
  172. /\\ehassert\.h/d
  173. /\\ehdata\.h/d
  174. /\\ehhooks\.h/d
  175. /\\ehprolg2\.c/d
  176. /\\ehprolog\.asm/d
  177. /\\ehstate\./d
  178. /\\ehvec...\.cpp/d
  179. /\\error\.cpp/d
  180. /\\exdsptch\.cpp/d
  181. /\\fileio\.cpp/d
  182. /\\frame\.cpp/d
  183. /\\chandler\./d
  184. /\\handlerc\./d
  185. /\\handlers\./d
  186. /\\hooks\.cpp/d
  187. /\\init\.cpp/d
  188. /\\initsect\.cpp/d
  189. /\\lowhelpr\.asm/d
  190. /\\memcpy.*\.s/d
  191. /\\memory\.cpp/d
  192. /\\memset.*\.s/d
  193. /\\miscs\.s/d
  194. /\\ntstatus\.h/d
  195. /\\pdblkup\.cpp/d
  196. /\\rtcapi\.h/d
  197. /\\rtlmisc\.s/d
  198. /\\rtti\./d
  199. /\\rtcpriv\.h/d
  200. /\\shadow\.cpp/d
  201. /\\stack\.cpp/d
  202. /\\userapi\.cpp/d
  203. /\\stdexcpt\.cpp/d
  204. /\\oldexcpt\.[ch]p*/d
  205. /\\stdnewh\.cpp/d
  206. /\\throw\.cpp/d
  207. /\\unhandld\.cpp/d
  208. /\\typinfo\./d
  209. /\\typname\./d
  210. /\\trnsctrl\./d
  211. /\\unwind\./d
  212. /\\undname\./d
  213. /\\unhandld\./d
  214. /\\user\.cpp/d
  215. /\\validate\.cpp/d
  216. /\\vunwind\.cpp/d
  217. /\\setjmp.*\.asm/d
  218. /\\setjmp.*\.s/d
  219. /\\strcat.*\.s/d
  220. /\\strcpy\.s/d
  221. /\\strcmp.*\.s/d
  222. /\\strlen.*\.s/d
  223. /\\longjmp.*\.asm/d
  224. /\\longjmp.*\.s/d
  225. /\\jmpuwind\.s/d
  226. /\\exsup.*\.asm/d
  227. /\\sehprolg\.asm/d
  228. /\\sehsupp\.c/d
  229. /tlssup\./d
  230. /\\sizeptr\.h$$/d
  231. /\\empty\.c$$/d
  232. /\\h\\cmacros\.inc$$/d
  233. /\\h\\msdos\.inc$$/d
  234. /\\h\\pversion\.inc$$/d
  235. !if "$(BLD_SYSCRT)"!="1"
  236. /\\seclocf\.c/d
  237. !endif
  238. <<KEEP
  239. $(CS)\cleanlst.i: $(CS)\mkfiles.i $(CS)\cleanlst.sed
  240. sed -f $(CS)\cleanlst.sed $(CS)\mkfiles.i > $(CS)\cleanlst.i
  241. $(CS)\copy_lst.sed: makefile
  242. @echo > nul <<$@
  243. /^< /!d
  244. s/^< //
  245. !if "$(LLP64)"=="0" || "$(BLD_SYSCRT)"=="0"
  246. /\\stdcpp64\\/d
  247. /\\stdhpp64\\/d
  248. /libw32\\inc64\\/d
  249. !else
  250. /\\stdcpp\\/d
  251. /\\stdhpp\\/d
  252. /libw32\\include\\/d
  253. !endif
  254. !if "$(PA)"!="x86"
  255. /\\i386\\/d
  256. !endif
  257. !if "$(PA)"!="IA64" && ("$(PA)"!="x86" || "$(LLP64)"!="1")
  258. /\\ia64\\/d
  259. !endif
  260. !if "$(PA)"!="AMD64" && ("$(PA)"!="x86" || "$(LLP64)"!="2")
  261. /\\amd64\\/d
  262. !endif
  263. <<KEEP
  264. $(CS)\copy_lst.i: $(CS)\cleanlst.i $(CS)\copy_lst.sed
  265. diff $(CS)\mkfiles.i $(CS)\cleanlst.i | sed -f $(CS)\copy_lst.sed > $(CS)\copy_lst.i
  266. $(CS)\mkclnmkf.exe: mkclnmkf.c makefile
  267. $(CC) -nologo -Gi- -W3 -WX -Za -X -I"$(DEVTOOLSINC)" $(BLDFLAG) \
  268. -Fo$(CS)\ -Fe$(CS)\ mkclnmkf.c \
  269. -link -nod:libc.lib -nod:kernel32.lib \
  270. "$(DEVTOOLSLIB)\libc.lib" "$(DEVTOOLSSDKLIB)\kernel32.lib"
  271. $(CS)\makefile.pre $(CS)\makefile.rel: $(CS)\mkclnmkf.exe $(CS)\copy_lst.i $(CS)\cleanlst.i $(CS)\mkdirs.i
  272. if exist $(CS)\makefile.pre del $(CS)\makefile.pre
  273. if exist $(CS)\makefile.rel del $(CS)\makefile.rel
  274. $(CS)\mkclnmkf $(MKCLNMKFFLAGS) \crt %CRT_BUILDDIR%\crt\prebuild %CRT_BUILDDIR%\crt\src $(CS)\copy_lst.i $(CS)\cleanlst.i $(CS)\mkdirs.i $(CS)\makefile.pre $(CS)\makefile.rel
  275. if exist $(CS)\makefile.tmp del $(CS)\makefile.tmp
  276. ren $(CS)\makefile.rel makefile.tmp
  277. sed "s/DST)\\i386/DST)\\intel/g" $(CS)\makefile.tmp > $(CS)\makefile.rel
  278. del $(CS)\makefile.tmp