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.

329 lines
7.6 KiB

  1. !include common.mkf
  2. CS = $(CRT_BUILDDIR)\srcrel\$(CPUDIR)
  3. !if "$(LLP64)" == "0" || "$(PA)" == "IA64" || "$(PA)" == "ALPHA64"
  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"
  12. BLDFLAG = -D_BUILD_IA64
  13. ! elseif "$(PA)" == "ALPHA"
  14. BLDFLAG = -D_BUILD_ALPHA64
  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. /^crtw32\\std[ch]pp\\/d
  123. /^crtw32\\std[ch]pp64\\/d
  124. s/\\stdxxx/\\stdcpp/
  125. /^libw32\\/d
  126. /^fpw32\\/d
  127. /^srcrel\\/d
  128. /\\tools\\/d
  129. /\\common\\/d
  130. !if "$(PA)"!="ALPHA"
  131. /\\axp64\\/d
  132. /\\alpha64\\/d
  133. /\\alpha\\/d
  134. !endif
  135. !if "$(PA)"=="ALPHA" && "$(LLP64)"=="0"
  136. /\\axp64\\/d
  137. /\\alpha64\\/d
  138. !endif
  139. !if "$(PA)"!="IA64" && ("$(PA)"!="x86" || "$(LLP64)"!="1")
  140. /\\ia64\\/d
  141. !endif
  142. !if "$(PA)"!="x86" || "$(LLP64)"!="0"
  143. /\\i386\\/d
  144. /\\adjustfd\.c/d
  145. /\\seccinit\.c/d
  146. /\\seccook\.c/d
  147. /\\secfail\.c/d
  148. /\\seclocf\.c/d
  149. !endif
  150. !if "$(PA)"=="x86"
  151. /^crtw32\\h\\i386\\/d
  152. !endif
  153. !if "$(PA)"!="MIPS"
  154. /\\mips\\/d
  155. /\\mips2\\/d
  156. !endif
  157. !if "$(PA)"!="PPC"
  158. /\\ppc\\/d
  159. !endif
  160. /\\small\\/d
  161. /\\lsources$$/d
  162. /\.bat$$/d
  163. /\.cmd$$/d
  164. /\.exe$$/d
  165. /68k/d
  166. /makefile/d
  167. /\.if$$/d
  168. /\.a$$/d
  169. /\.rc$$/d
  170. /\.def$$/d
  171. /\.txt$$/d
  172. /\.sed$$/d
  173. /\.hs$$/d
  174. /\.mak$$/d
  175. /\\bintree\.cpp/d
  176. /\\callsite\.cpp/d
  177. /\\chkesp\.c/d
  178. /\\chkstk\.s/d
  179. /\\chsyheap\.cpp/d
  180. /\\cinitone\.s/d
  181. /\\contain\.cpp/d
  182. /\\convert\.cpp/d
  183. /\\csysex\./d
  184. /\\ehassert\.h/d
  185. /\\ehdata\.h/d
  186. /\\ehhooks\.h/d
  187. /\\ehprolg2\.c/d
  188. /\\ehprolog\.asm/d
  189. /\\ehstate\./d
  190. /\\ehvec...\.cpp/d
  191. /\\error\.cpp/d
  192. /\\exdsptch\.cpp/d
  193. /\\fileio\.cpp/d
  194. /\\frame\.cpp/d
  195. /\\chandler\./d
  196. /\\handlerc\./d
  197. /\\handlers\./d
  198. /\\hooks\.cpp/d
  199. /\\init\.cpp/d
  200. /\\initsect\.cpp/d
  201. /\\lowhelpr\.asm/d
  202. /\\memcpy.*\.s/d
  203. /\\memory\.cpp/d
  204. /\\memset.*\.s/d
  205. /\\miscs\.s/d
  206. /\\ntstatus\.h/d
  207. /\\pdblkup\.cpp/d
  208. /\\ppcinst\.h/d
  209. /\\rtcapi\.h/d
  210. /\\rtlmisc\.s/d
  211. /\\rtti\./d
  212. /\\rtcpriv\.h/d
  213. /\\shadow\.cpp/d
  214. /\\stack\.cpp/d
  215. /\\userapi\.cpp/d
  216. /\\stdexcpt\.cpp/d
  217. /\\oldexcpt\.[ch]p*/d
  218. /\\stdnewh\.cpp/d
  219. /\\throw\.cpp/d
  220. /\\unhandld\.cpp/d
  221. /\\typinfo\./d
  222. /\\typname\./d
  223. /\\trnsctrl\./d
  224. /\\unwind\./d
  225. /\\undname\./d
  226. /\\unhandld\./d
  227. /\\user\.cpp/d
  228. /\\validate\.cpp/d
  229. /\\vunwind\.cpp/d
  230. /\\setjmp.*\.asm/d
  231. /\\setjmp.*\.s/d
  232. /\\strcat.*\.s/d
  233. /\\strcpy\.s/d
  234. /\\strcmp.*\.s/d
  235. /\\strlen.*\.s/d
  236. /\\longjmp.*\.asm/d
  237. /\\longjmp.*\.s/d
  238. /\\jmpuwind\.s/d
  239. /\\exsup.*\.asm/d
  240. /\\sehprolg\.asm/d
  241. /\\sehsupp\.c/d
  242. /tlssup\./d
  243. /\\sizeptr\.h$$/d
  244. /\\empty\.c$$/d
  245. /\\h\\cmacros\.inc$$/d
  246. /\\h\\msdos\.inc$$/d
  247. /\\h\\pversion\.inc$$/d
  248. /mips\\ll/d
  249. /mips\\chandler/d
  250. !if "$(BLD_SYSCRT)"!="1"
  251. /\\seclocf\.c/d
  252. !endif
  253. <<KEEP
  254. $(CS)\cleanlst.i: $(CS)\mkfiles.i $(CS)\cleanlst.sed
  255. sed -f $(CS)\cleanlst.sed $(CS)\mkfiles.i > $(CS)\cleanlst.i
  256. $(CS)\copy_lst.sed: makefile
  257. @echo > nul <<$@
  258. /^< /!d
  259. s/^< //
  260. !if "$(LLP64)"=="0" || "$(BLD_SYSCRT)"=="0"
  261. /\\stdcpp64\\/d
  262. /\\stdhpp64\\/d
  263. /libw32\\inc64\\/d
  264. !else
  265. /\\stdcpp\\/d
  266. /\\stdhpp\\/d
  267. /libw32\\include\\/d
  268. !endif
  269. !if "$(PA)"!="ALPHA"
  270. /\\axp64\\/d
  271. /\\alpha64\\/d
  272. /\\alpha\\/d
  273. !endif
  274. !if "$(PA)"=="ALPHA" && "$(LLP64)"=="0"
  275. /\\axp64\\/d
  276. /\\alpha64\\/d
  277. !endif
  278. !if "$(PA)"!="x86"
  279. /\\i386\\/d
  280. !endif
  281. !if "$(PA)"!="IA64" && ("$(PA)"!="x86" || "$(LLP64)"!="1")
  282. /\\ia64\\/d
  283. !endif
  284. !if "$(PA)"!="MIPS"
  285. /\\mips\\/d
  286. /\\mips2\\/d
  287. !endif
  288. !if "$(PA)"!="PPC"
  289. /\\ppc\\/d
  290. !endif
  291. <<KEEP
  292. $(CS)\copy_lst.i: $(CS)\cleanlst.i $(CS)\copy_lst.sed
  293. diff $(CS)\mkfiles.i $(CS)\cleanlst.i | sed -f $(CS)\copy_lst.sed > $(CS)\copy_lst.i
  294. $(CS)\mkclnmkf.exe: mkclnmkf.c makefile
  295. $(CC) -nologo -Gi- -W3 -WX -Za -X -I$(DEVTOOLSINC) $(BLDFLAG) \
  296. -Fo$(CS)\ -Fe$(CS)\ mkclnmkf.c \
  297. -link -nod:libc.lib -nod:kernel32.lib \
  298. $(DEVTOOLSLIB)\libc.lib $(DEVTOOLSSDKLIB)\kernel32.lib
  299. $(CS)\makefile.pre $(CS)\makefile.rel: $(CS)\mkclnmkf.exe $(CS)\copy_lst.i $(CS)\cleanlst.i $(CS)\mkdirs.i
  300. if exist $(CS)\makefile.pre del $(CS)\makefile.pre
  301. if exist $(CS)\makefile.rel del $(CS)\makefile.rel
  302. $(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
  303. if exist $(CS)\makefile.tmp del $(CS)\makefile.tmp
  304. ren $(CS)\makefile.rel makefile.tmp
  305. sed "s/DST)\\i386/DST)\\intel/g" $(CS)\makefile.tmp > $(CS)\makefile.rel
  306. del $(CS)\makefile.tmp