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.

170 lines
5.3 KiB

  1. @echo off
  2. if not "%CRTMKDEP%"=="TEMP" goto temp
  3. rem Turn off the environment variable if it is TEMP
  4. echo Warning: CRTMKDEP is set to %CRTMKDEP%, but should not be.
  5. set CRTMKDEP=
  6. echo Warning: CRTMKDEP is now unset.
  7. goto chkarg1
  8. :temp
  9. if not "%CLEANSE_ONLY%"=="TEMP" goto chkarg1
  10. rem Turn off the environment variable if it is TEMP
  11. echo Warning: CLEANSE_ONLY is set to %CLEANSE_ONLY%, but should not be.
  12. set CLEANSE_ONLY=
  13. echo Warning: CLEANSE_ONLY is now unset.
  14. :chkarg1
  15. if not "%1" == "CRTMKDEP" goto no_depend
  16. rem if first argument is CRTMKDEP then set that env var temporarily
  17. set CRTMKDEP=TEMP
  18. echo NOTE: CRTMKDEP set temporarily to %CRTMKDEP% to make dependencies.
  19. shift
  20. goto chkarg1
  21. :no_depend
  22. if not "%1" == "CLEANSE_ONLY" goto no_only
  23. rem if first argument is CLEANSE_ONLY then set that env var temporarily
  24. set CLEANSE_ONLY=TEMP
  25. echo NOTE: CLEANSE_ONLY set temporarily to %CLEANSE_ONLY% to only cleanse sources.
  26. shift
  27. goto chkarg1
  28. :no_only
  29. if not "%CRT_BUILDDIR%" == "" goto top_set
  30. set CRT_BUILDDIR=\msdev
  31. :top_set
  32. echo **** NOTE: CRT_BUILDDIR is set to "%CRT_BUILDDIR%"
  33. if not "%1" == "DELNODE" goto no_delnode
  34. rem if first argument is DELNODE then wipe out the existing %CRT_BUILDDIR% tree
  35. shift
  36. if not exist %CRT_BUILDDIR%\NUL goto no_delnode
  37. echo Deleting existing %CRT_BUILDDIR% directory
  38. delnode /q %CRT_BUILDDIR%
  39. goto chkarg1
  40. :no_delnode
  41. if not "%1" == "DELOBJ" goto no_delobj
  42. rem if first argument is DELOBJ then wipe out all objects/libs/..., leave source
  43. shift
  44. if not exist %CRT_BUILDDIR%\NUL goto no_delobj
  45. echo Deleting existing build under %CRT_BUILDDIR%, leaving source files
  46. if exist %CRT_BUILDDIR%\srcrel delnode /q %CRT_BUILDDIR%\srcrel
  47. if exist %CRT_BUILDDIR%\crt\prebuild\build delnode /q %CRT_BUILDDIR%\crt\prebuild\build
  48. if exist %CRT_BUILDDIR%\crt\src\build delnode /q %CRT_BUILDDIR%\crt\src\build
  49. del /s %CRT_BUILDDIR%\msvc*.def
  50. goto chkarg1
  51. :no_delobj
  52. if NOT "%CRT_SRC%"=="" goto no_crt_src
  53. set CRT_SRC=\crt
  54. :no_crt_src
  55. echo **** NOTE: CRT_SRC is set to "%CRT_SRC%"
  56. if "%NMK_IFLAG%"=="" set NMK_IFLAG=-i
  57. echo **** NOTE: NMK_IFLAG is set to "%NMK_IFLAG%"
  58. if not "%CPUDIR%"=="" goto cpudir_set
  59. if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%LLP64%"=="" set LLP64=0
  60. if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%LLP64%"=="2" set CPUDIR=amd64
  61. if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%LLP64%"=="1" set CPUDIR=ia64
  62. if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%LLP64%"=="0" set CPUDIR=intel
  63. if "%PROCESSOR_ARCHITECTURE%"=="IA64" set CPUDIR=ia64
  64. if not "%CPUDIR%"=="" goto cpudir_set
  65. echo.
  66. echo ###############################################################
  67. echo # The environment variable PROCESSOR_ARCHITECTURE is unknown #
  68. echo ###############################################################
  69. echo.
  70. goto finish
  71. :cpudir_set
  72. echo **** NOTE: CPUDIR is set to "%CPUDIR%"
  73. if not exist %CRT_BUILDDIR%\NUL call srcrel\mkdire %CRT_BUILDDIR%
  74. if not exist %CRT_BUILDDIR%\crt\NUL call srcrel\mkdire %CRT_BUILDDIR%\crt
  75. if not exist %CRT_BUILDDIR%\crt\prebuild\NUL call srcrel\mkdire %CRT_BUILDDIR%\crt\prebuild
  76. if not exist %CRT_BUILDDIR%\crt\src\NUL call srcrel\mkdire %CRT_BUILDDIR%\crt\src
  77. echo =-=-=-=-= Updating Source Cleansing Files... =-=-=-=-=
  78. cd srcrel
  79. if exist %CRT_BUILDDIR%\srcrel\%CPUDIR%\makefile.pre del %CRT_BUILDDIR%\srcrel\%CPUDIR%\makefile.pre
  80. if exist %CRT_BUILDDIR%\srcrel\%CPUDIR%\makefile.rel del %CRT_BUILDDIR%\srcrel\%CPUDIR%\makefile.rel
  81. nmake -nologo %NMK_IFLAG%
  82. if errorlevel 1 goto errlev
  83. cd ..
  84. echo =-=-=-=-= Updating Pre-Build Source Files... =-=-=-=-=
  85. cd srcrel
  86. nmake -nologo %NMK_IFLAG% -f %CRT_BUILDDIR%\srcrel\%CPUDIR%\makefile.pre SRC=%CRT_SRC%
  87. if errorlevel 1 goto errlev
  88. cd ..
  89. echo =-=-=-=-= Updating Post-Build Source Files... =-=-=-=-=
  90. cd srcrel
  91. nmake -nologo %NMK_IFLAG% -f %CRT_BUILDDIR%\srcrel\%CPUDIR%\makefile.rel
  92. if errorlevel 1 goto errlev
  93. cd ..
  94. if "%CRTMKDEP%"=="" goto NO_MKDEP
  95. echo =-=-=-=-= Building Dependencies for Pre-build =-=-=-=-=
  96. cd /d %CRT_BUILDDIR%\crt\prebuild
  97. nmake -nologo PRE_BLD=1 depend
  98. if errorlevel 1 goto errlev
  99. cd /d %CRT_SRC%
  100. echo =-=-=-=-= Building Dependencies for Post-build =-=-=-=-=
  101. cd /d %CRT_BUILDDIR%\crt\src
  102. nmake -nologo POST_BLD=1 depend
  103. if errorlevel 1 goto errlev
  104. cd /d %CRT_SRC%
  105. :NO_MKDEP
  106. if "%CLEANSE_ONLY%"=="" goto do_build
  107. echo *****
  108. echo NOTE: Stopping after cleansing processes because CLEANSE_ONLY is set.
  109. echo *****
  110. goto finish
  111. :do_build
  112. echo =-=-=-=-= Doing Pre-build =-=-=-=-=
  113. cd /d %CRT_BUILDDIR%\crt\prebuild
  114. nmake -nologo %NMK_IFLAG% PRE_BLD=1 IFLAG=%NMK_IFLAG% %1 %2 %3 %4 %5
  115. if errorlevel 1 goto errlev
  116. cd /d %CRT_SRC%
  117. echo =-=-=-=-= Copying Pre-Build Objects =-=-=-=-=
  118. cd srcrel
  119. nmake -nologo -f objects.mkf %1 %2 %3 %4 %5
  120. if errorlevel 1 goto errlev
  121. cd ..
  122. echo =-=-=-=-= Doing Post-build =-=-=-=-=
  123. cd /d %CRT_BUILDDIR%\crt\src
  124. nmake -nologo %NMK_IFLAG% POST_BLD=1 IFLAG=%NMK_IFLAG% %1 %2 %3 %4 %5
  125. if errorlevel 1 goto errlev
  126. cd /d %CRT_SRC%
  127. echo =-=-=-=-= Copying Assembler Objects and External Files =-=-=-=-=
  128. cd srcrel
  129. nmake -nologo %NMK_IFLAG% -f external.mkf %1 %2 %3 %4 %5
  130. cd ..
  131. goto finish
  132. :errlev
  133. echo.
  134. echo ***
  135. echo *** BUILD ABORTED -- ErrorLevel is non-zero!
  136. echo ***
  137. return 1
  138. goto end
  139. :finish
  140. if "%CRTMKDEP%"=="TEMP" set CRTMKDEP=
  141. if "%CLEANSE_ONLY%"=="TEMP" set CLEANSE_ONLY=
  142. set CPUDIR=
  143. cd /d %CRT_SRC%
  144. return 0
  145. :end