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.

108 lines
4.8 KiB

  1. **************CODE SEGMENT OPTIMIZATION**********************
  2. 6/28/91 Yi-Hsin Sung
  3. ---------------------------------------------------
  4. I. How to make use of the code segment optimization
  5. ---------------------------------------------------
  6. Finally, there is an easy way to do it! All you have to do is:
  7. 1. Decide on which files go into the same segment.
  8. 2. Name the segments using macros SEG00, SEG01, ... in local rules.mk
  9. SEG00 = string_0
  10. SEG01 = string_1 (Must be defined before the include)
  11. :
  12. :
  13. !include ..\rules.mk
  14. Note: Don't append _text to the segment names in order to
  15. differentiate between default segment names given by the linker
  16. and segments named by you.
  17. Note: Always start with SEG00 and continue with SEG01, SEG02,...
  18. The rules (in uioptseg.mk and uidepseg.mk) for code
  19. segment optimization will only be included if SEG00 is defined.
  20. Note: The limit is 8 segments per directory in the current uidepseg.mk
  21. and uioptseg.mk. However, it's easy to increase the number of
  22. segments. The method will be described later on.
  23. 3. List the files:
  24. All files listed in macros ending with _00 will end up in SEG00.
  25. Similarly, files listed in macros ending with _01 will end up in SEG01.
  26. And so on.
  27. CXXSRC_COMMON_00 = string.cxx strmisc.cxx .....
  28. CXXSRC_COMMON_01 = strchr.cxx .....
  29. CXXSRC_LM21_00 = ....
  30. CXXSRC_LM30_00 = ....
  31. CXXSRC_WIN_00 = ....
  32. CXXSRC_OS2_00 = ....
  33. CXXSRC_DOS_00 = ....
  34. and all the corresponding CSRC macros.
  35. 4. Execute "nmake depend" to generate a new depend.mk.
  36. ----------------------------------------------------------
  37. II. If you want to use more than 8 segments per directory,
  38. ----------------------------------------------------------
  39. 1. Get the makefile in $(UI)\common\src
  40. 2. There are two new targets in the makefile, uidepend and uiglobal.
  41. "nmake uidepend" will create the files uideprul.mk and uidepseg.mk
  42. which will be included in uidepend.mk. "nmake uiglobal" will create
  43. the files uirules.mk and uioptseg.mk which will be included in
  44. uiglobal.mk as needed.
  45. a. Add a $(SED) at the end of target uidepend
  46. Add a $(SED) at the end of target uiglobal
  47. Look at the last few lines of both targets to write the in-line
  48. SED script.
  49. c. Change the line "echo !IFDEF SEG07" to "echo !IFDEF SEG(# segments)"
  50. If # segments is single digit, append a zero in front.
  51. d. "nmake uidepend uiglobal"
  52. -------------------------------------------------
  53. III. If you don't want code segment optimization,
  54. -------------------------------------------------
  55. NOTHING will be affected by all the changes. As long as you
  56. don't define SEG00, no additional rules will be included.
  57. -------------------------------------------------------------------
  58. IV. If you want to change build rules originally in uiglobal.mk or
  59. rules in uidepend.mk
  60. -------------------------------------------------------------------
  61. master copy automatically generated files included by
  62. ___________________________________________________________
  63. uiglobal.src uirules.mk uiglobal.mk
  64. uioptseg.mk
  65. ___________________________________________________________
  66. uidepend.src uideprul.mk uidepend.mk
  67. uidepopt.mk
  68. ___________________________________________________________
  69. Make changes in uiglobal.src and uidepend.src only.
  70. -------------------------------------------------------------------
  71. V. If you want to define some segments as preload, or ... (something
  72. besides the default attributes)
  73. -------------------------------------------------------------------
  74. 1. For libraries in $(UI)\common\lib, there is a .def file associated
  75. with each of them with the same name but with the extension .def.
  76. For example, uistrw.def is associated with uistrw.lib.
  77. The ORIGINAL copy of this .def file is in the directory
  78. which builds the library (the makefile in that directory should
  79. say $(LIBUTIL) ). In the string library case, the .def is in
  80. $(UI)\common\src\string\string. This .def is copied over to
  81. $(UI)\common\lib whenever the library is rebuilt. If there is no
  82. .def associated with the library, then a dummy .def is created in
  83. $(UI)\common\lib. If you want to make some segments in some library
  84. preload or ..., just change the ORIGINAL .def file or if none exist,
  85. create a new one (Make sure you create this file in the directory
  86. that says $(LIBUTIL)).
  87. 2. For the segments not in the libraries, you have to add the segment
  88. name and attributes to the project's .def file. The usual stuff!
  89. Look at the makefile in $(UI)\shell\bin for some insight.