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.

90 lines
3.4 KiB

  1. @echo off
  2. REM
  3. REM mksample - update the sample directories
  4. REM
  5. setlocal
  6. set __TEST_MODE__=
  7. set __BASE_SAMPLE_DIR__=%_NTDRIVE%\nt\private\net\sockets\internet\sdk\samples
  8. set __SAMPLE_SOURCE_DIR__=%__BASE_SAMPLE_DIR__%\%2
  9. set __SAMPLE_BINARY_DIR__=%__BASE_SAMPLE_DIR__%\%2\obj\%3
  10. set __TARGET_SOURCE_DIR__=%1\%2
  11. set __TARGET_BINARY_DIR__=%1\%2\%3
  12. set __OUTPUT_STREAM__=>NUL
  13. set __DELETE_COMMAND__=del /q
  14. set __COPY_COMMAND__=copy
  15. set __C_FILES__=%__SAMPLE_SOURCE_DIR__%\*.c*
  16. set __H_FILES__=%__SAMPLE_SOURCE_DIR__%\*.h*
  17. set __RC_FILES__=%__SAMPLE_SOURCE_DIR__%\*.rc
  18. set __MAKE_FILES__=%__SAMPLE_SOURCE_DIR__%\makefil* %__SAMPLE_SOURCE_DIR__%\sources*
  19. set __BINARY_FILES__=%__SAMPLE_BINARY_DIR__%\*.exe %__SAMPLE_BINARY_DIR__%\*.dll
  20. set __SOURCE_SET__=(%__C_FILES__% %__H_FILES__% %__RC_FILES__% %__MAKE_FILES__%)
  21. set __BINARY_SET__=(%__BINARY_FILES__%)
  22. if "%1"=="" goto usage
  23. if "%2"=="" goto usage
  24. if "%3"=="" goto usage
  25. if exist %1\ goto check2
  26. echo error: %1 does not exist
  27. goto usage
  28. :check2
  29. if exist %__SAMPLE_SOURCE_DIR__% goto check3
  30. echo error: %__SAMPLE_SOURCE_DIR__% does not exist
  31. goto usage
  32. :check3
  33. if %3==i386 goto check4
  34. if %3==mips goto check4
  35. if %3==ppc goto check4
  36. if %3==alpha goto check4
  37. echo error: platform %3 not recognized
  38. goto usage
  39. :check4
  40. if "%4"=="" goto ok
  41. if not "%4"=="test" echo error: 4th argument can be "test" only & goto usage
  42. set __TEST_MODE__=1
  43. set __OUTPUT_STREAM__=
  44. set __DELETE_COMMAND__=echo test: %__DELETE_COMMAND__%
  45. set __COPY_COMMAND__=echo test: %__COPY_COMMAND__%
  46. rem echo on
  47. :ok
  48. echo creating target subdirectories
  49. md %__TARGET_SOURCE_DIR__% %__OUTPUT_STREAM__%
  50. md %__TARGET_BINARY_DIR__% %__OUTPUT_STREAM__%
  51. REM
  52. REM since source is same for all platforms, we only copy source if the
  53. REM platform is i386 (i.e. we assume it to be the first platform, but
  54. REM it doesn't matter, so long as x86 mkdev/mksample is run before the
  55. REM files are released)
  56. REM
  57. if not %3==i386 goto delete_and_copy_bins
  58. echo deleting old contents of %__TARGET_SOURCE_DIR__%...
  59. %__DELETE_COMMAND__% %__TARGET_SOURCE_DIR__% %__OUTPUT_STREAM__%
  60. echo copying source...
  61. for %%f in %__SOURCE_SET__% do %__COPY_COMMAND__% %%f %__TARGET_SOURCE_DIR__% %__OUTPUT_STREAM__%
  62. :delete_and_copy_bins
  63. echo deleting old contents of %__TARGET_BINARY_DIR__%...
  64. %__DELETE_COMMAND__% %__TARGET_BINARY_DIR__% %__OUTPUT_STREAM__%
  65. echo copying binaries...
  66. for %%f in %__BINARY_SET__% do %__COPY_COMMAND__% %%f %__TARGET_BINARY_DIR__% %__OUTPUT_STREAM__%
  67. goto end
  68. :usage
  69. echo usage: mksample ^<server dir^> ^<sample dir^> ^<platform^>
  70. echo where: platform can be i386 � mips � ppc � alpha (case is SIGNIFICANT)
  71. echo.
  72. echo e.g.: mksample \\foo\bar\dev\sdk\samples ftp i386
  73. echo where: \\foo\bar\dev\sdk\samples is the root of the target samples directory
  74. echo ftp is the relative name of the sample directory on this machine
  75. echo i386 is the target platform
  76. :end
  77. endlocal