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.

324 lines
17 KiB

  1. <HTML>
  2. <BODY>
  3. <A NAME=BASEDIR><H3>BASEDIR</H3></A>
  4. The BASEDIR macro refers to the base of the source tree.
  5. By default,
  6. <PRE> BASEDIR=$(_NTDRIVE)$(_NTROOT)</PRE>
  7. The following three statements are equivalent, but using the third one is recommended.
  8. <PRE>
  9. TARGETLIBS=d:\nt\public\sdk\lib\*\kernel32.lib
  10. TARGETLIBS=$(BASEDIR)\public\sdk\lib\*\kernel32.lib
  11. TARGETLIBS=$(<A HREF=#SDK_LIB_PATH>SDK_LIB_PATH</A>)\kernel32.lib
  12. </PRE>
  13. sources
  14. dirs
  15. makefile
  16. makefile.inc
  17. makefile.def
  18. makefile.plt
  19. build.dat
  20. objects.mac
  21. <A NAME=BUILD_DEFAULT_TARGETS><H3>BUILD_DEFAULT_TARGETS</H3></A>
  22. This envirnoment variable specifies the platform for which you are building. This variables allows the possibly of cross platform compilation, when such compilers are available.
  23. Here is an exmaple of this environment variable:
  24. <PRE> BUILD_DEFAULT_TARGETS=-axp64</PRE>
  25. <A NAME=BUILD_DEFAULT><H3>BUILD_DEFAULT</H3></A>
  26. This envirnoment variable specifies the default options used by build.exe
  27. Here is an example of this environment variable:
  28. <PRE> BUILD_DEFAULT=-eswM -nmake -i</PRE>
  29. <A NAME=BUILD_MAKE_PROGRAM><H3>BUILD_MAKE_PROGRAM</H3></A>
  30. This envirnoment variable specifies the default program make executed by build.exe to in order to compile a directory.
  31. The default value of this environment variable should be nmake.exe.
  32. <A NAME=BUILD_OTPIONS><H3>BUILD_OPTIONS</H3></A>
  33. By default, build.exe will traverse the entire source tree, processing the directories listed in the DIRS section of the dirs file.
  34. This envirnoment variable specifies which of the optional directories, listed under </A HREF=#OPTIONAL_DIRS>OPTIONAL_DIRS</A> should be processed by build.exe
  35. Here are some examples of this environment variable:
  36. <PRE> BUILD_OPTIONS=OptDir1 OptDir2</PRE>
  37. would cause build to also process all OptDir1 and OptDir2 directories listed under an OPTIONAL_DIRS section.
  38. <PRE> BUILD_OPTIONS=~OptDir1 OptDir2</PRE>
  39. would cause build to all OptDir2 directories listed under an OPTIONAL_DIRS section, but force it to skip over all OptDir1 directories, whether listed in the DIRS or OPTIONAL_DIRS section of a dirs file.
  40. <A NAME=CRT_INC_PATH><H3>CRT_INC_PATH</H3></A>
  41. <P>This envirnoment variable specifies the location of the C Runtime header files. The default value of this macro is:</P>
  42. <PRE> $(BASEDIR)\public\sdk\inc\crt</PRE>
  43. <P>Set this macro in your environment variables if you wish to override the default location of the C Runtime header files.<BR>
  44. This macro should no be redefined from within a sources file.</P>
  45. <A NAME=CRT_LIB_PATH><H3>CRT_LIB_PATH</H3></A>
  46. <P>This envirnoment variable specifies the location of the C Runtime libraries. The default value of this macro is:</P>
  47. <PRE> $(BASEDIR)\public\sdk\lib\crt</PRE>
  48. <P>Set this macro in your environment variables if you wish to override the default location of the C runtime libraries.<BR>
  49. This macro should no be redefined from within a sources file.</P>
  50. <P>Here is an example of the usage of this macro:</P>
  51. <PRE> TARGETLIB=$(CRT_LIB_PATH)\libcntpr.lib \<BR> $(SDK_LIB_PATH)\advapi32.lib</PRE>
  52. <A NAME=DDK_INC_PATH><H3>DDK_INC_PATH</H3></A>
  53. <P>This macro specifies the location of the DDK header files. The default value of this macro is:</P>
  54. <PRE> $(BASEDIR)\public\ddk\inc</PRE>
  55. <P>Set this macro in your environment variables if you wish to override the default location of the DDK header files.<BR>
  56. This macro should no be redefined from within a sources file.</P>
  57. <A NAME=DDK_LIB_DEST><H3>DDK_LIB_DEST</H3></A>
  58. <P>This macro specifies the destination location of a DDK library. The default value of this macro is:</P>
  59. <PRE> $(BASEDIR)\public\ddk\lib\*</PRE>
  60. <P>Set this macro in your environment variables if you wish to override the default location of the DDK libraries.<BR>
  61. This macro should no be redefined from within a sources file.</P>
  62. <P>Here is an example of the usage of this macro:</P>
  63. <PRE> TARGETPATHLIB=$(DDK_LIB_DEST)\ndis.lib</PRE>
  64. <A NAME=DDK_LIB_PATH><H3>DDK_LIB_PATH</H3></A>
  65. <P>This macro specifies the location of the DDK libraries. The default value of this macro is:</P>
  66. <PRE> $(BASEDIR)\public\ddk\lib</PRE>
  67. <P>Set this macro in your environment variables if you wish to override the default location of the DDK libraries.<BR>
  68. This macro should no be redefined from within a sources file.</P>
  69. <P>Here is an example of the usage of this macro:</P>
  70. <PRE> TARGETLIB=$(DDK_LIB_PATH)\ndis.lib \<BR> $(DDK_LIB_PATH)\tdikrnl.lib</PRE>
  71. <A NAME=DDK_LIB_PATH><H3>DDK_LIB_PATH</H3></A>
  72. <P>This macro specifies the location of the DDK libraries. The default value of this macro is:</P>
  73. <PRE> $(BASEDIR)\public\ddk\lib</PRE>
  74. <P>Set this macro in your environment variables if you wish to override the default location of the DDK libraries.<BR>
  75. This macro should no be redefined from within a sources file.</P>
  76. <P>Here is an example of the usage of this macro:</P>
  77. <PRE> TARGETLIB=$(DDK_LIB_PATH)\ndis.lib \<BR> $(DDK_LIB_PATH)\tdikrnl.lib</PRE>
  78. <A NAME=MASTER_VERSION_FILE><H3>MASTER_VERSION_FILE</H3></A>
  79. This macro contains the name of the master version file for Windows 2000.
  80. It contains, among other things, the default operating system version number
  81. which all binaries should have defined in the resource section.
  82. The default value of this variable is $(<A HREF=#SDK_INC_PATH>SDK_INC_PATH</A>)\ntverp.h
  83. You should not override this value in your environment variables unless your component is not integrated in the Windows 2000 product (please contact BryanT for more information).
  84. <A NAME=OAK_INC_PATH><H3>OAK_INC_PATH</H3></A>
  85. <P>This macro specifies the location of the OAK header files. The default value of this macro is:</P>
  86. <PRE> $(BASEDIR)\public\oak\inc</PRE>
  87. <P>Set this macro in your environment variables if you wish to override the default location of the OAK header files.<BR>
  88. This macro should no be redefined from within a sources file.</P>
  89. <A NAME=PRIVATE_INC_PATH><H3>PRIVATE_INC_PATH</H3></A>
  90. <P>This macro specifies the location of the private windows 2000 header files. The default value of this macro is:</P>
  91. <PRE> $(BASEDIR)\private\inc</PRE>
  92. <P>Set this macro in your environment variables if you wish to override the default location of the private windows 2000 header files.<BR>
  93. This macro should no be redefined from within a sources file.</P>
  94. <A NAME=SDK_LIB_DEST><H3>SDK_LIB_DEST</H3></A>
  95. <P>This macro specifies the destination location of a SDK library. The default value of this macro is:</P>
  96. <PRE> $(BASEDIR)\public\sdk\lib\*</PRE>
  97. <P>Set this macro in your environment variables if you wish to override the default location of the SDK libraries.<BR>
  98. This macro should no be redefined from within a sources file.</P>
  99. <P>Here is an example of the usage of this macro:</P>
  100. <PRE> TARGETPATHLIB=$(SDK_LIB_DEST)\kernel32.lib</PRE>
  101. <A NAME=SDK_LIB_PATH><H3>SDK_LIB_PATH</H3></A>
  102. <P>This macro specifies the location of the SDK libraries. The default value of this macro is:</P>
  103. <PRE> $(BASEDIR)\public\sdk\lib</PRE>
  104. <P>Set this macro in your environment variables if you wish to override the default location of the SDK libraries.<BR>
  105. This macro should no be redefined from within a sources file.</P>
  106. <P>Here is an example of the usage of this macro:</P>
  107. <PRE> TARGETLIB=$(SDK_LIB_PATH)\kernel32.lib \<BR> $(SDK_LIB_PATH)\advapi32.lib</PRE>
  108. <A NAME=WDM_INC_PATH><H3>WDM_INC_PATH</H3></A>
  109. <P>This macro specifies the location of the WDM header file. The default value of this macro is:</P>
  110. <PRE> $(BASEDIR)\public\ddk\inc\wdm</PRE>
  111. <P>Set this macro in your environment variables if you wish to override the default location of the WDM header files.<BR>
  112. This macro should no be redefined from within a sources file.</P>
  113. <A NAME=C_DEFINES><H3>C_DEFINES - <SMALL>optional</SMALL></H3></A>
  114. Use this macro to specify switches you want passed to the compiler.
  115. Typically, they are compiler #defines.
  116. You might specify:
  117. <PRE> C_DEFINES = -DENABLE_FEATURE1</PRE>
  118. to define ENABLE_FEATURE1 to the compiler.
  119. C_DEFINES gets passed to both the C compiler and the MIDL compiler.
  120. Therefore, you cannot put compiler optimization or other machine or
  121. tool specific switches in the C_DEFINES macro.
  122. Use <A HREF=#MSC_OPTIMIZATION>MSC_OPTIMIZATION</A> for C compiler only optimizations
  123. See also <A HREF=#ASM_DEFINES>ASM_DEFINES</A>, <A HREF=#RC_DEFINES>RC_DEFINES</A>
  124. <A NAME=DLLORDER><H3>DLLORDER - <SMALL>optional</SMALL></H3></A>
  125. When you are building a DLL, you can specify an order file that will be passed
  126. to the linker. This order file lists the order in which functions should be
  127. layed out in the image.
  128. This is the same as <A HREF=#NTPROFILEINPUT>NTPROFILEINPUT</A> except that
  129. a full name for the profile can be specified.
  130. <A NAME=EXEPROFILEINPUT><H3>EXEPROFILEINPUT - <SMALL>obsolete</SMALL></H3></A>
  131. Use <A HREF=#NTPROFILEINPUT>NTPROFILEINPUT</A> instead.
  132. <A NAME=INCLUDES><H3>INCLUDES - <SMALL>optional</SMALL></H3></A>
  133. <P>Build.exe use a default list of public include directories from which to search for header files.
  134. The default list of include directories is dependent on the value of <A HREF=#TARGETTYPE>TARGETTYPE</A> in the sources file.</P>
  135. <P>Use the INCLUDES macro to indicate an additional list of private include directories to be searched for include files during compilation.
  136. Separate the entries in this list with a semicolon.
  137. Path names can be absolute or relative.</P>
  138. For example:
  139. <PRE>
  140. INCLUDES=..\inc;..\..\inc
  141. INCLUDES=$(INCLUDES); \
  142. h; \
  143. ..\headers;
  144. </PRE>
  145. The INCLUDES macro is read by build.exe and passed to the MAKE program.
  146. The list of directories in the INCULDES macro will have precedence over the default include directories.
  147. <A NAME=MAJORCOMP><H3>MAJORCOMP - <SMALL>obsolete</SMALL></H3></A>
  148. Please remove from your sources file
  149. <A NAME=MINORCOMP><H3>MINORCOMP - <SMALL>obsolete</SMALL></H3></A>
  150. Please remove from your sources file
  151. <A NAME=NO_NTDLL><H3>NO_NTDLL - <SMALL>optional</SMALL></H3></A>
  152. Set this macro to 0 to force your binary <I>not</I> to link against NTDLL.LIB.
  153. <A NAME=NTPROFILEINPUT><H3>NTPROFILEINPUT - <SMALL>optional</SMALL></H3></A>
  154. When you are building a DLL, you can specify an order file that will be passed
  155. to the linker. This order file lists the order in which functions should be
  156. layed out in the image.
  157. To use the profile, specify the following in your sources file:
  158. <PRE> NTPROFILEINPUT=1</PRE>
  159. If you set this value, build.exe expect to find
  160. <PRE> $(TARGETNAME).prf</PRE>
  161. in the current subdirectory.
  162. <P> See also <A HREF=#DLLORDER>DLLORDER</A></P>
  163. <A NAME=PNP_POWER><H3>PNP_POWER - <SMALL>obsolete</SMALL></H3></A>
  164. Please remove from your sources file
  165. <A NAME=SOURCES><H3>SOURCES - <SMALL>required</SMALL></H3></A>
  166. <P>The SOURCES macro is the most important macro in a sources file.
  167. It specifies the list of files to be compiled.
  168. Build.exe will look at these files and generate a dependency list.
  169. For any source file whose dependencies changed, build.exe will rebuild
  170. this file.</P>
  171. <P>Use this macro to list your source filenames (except for the file containing
  172. main in the case where <A HREF=#UMAPPL>UMAPPL</A> or <A HREF=#UMTEST>UMTEST</A>
  173. is used. Include the filename extension and separate the entries in this list
  174. with spaces or tabs.</P>
  175. <A NAME=TARGETEXT><H3>TARGETEXT - <SMALL>optional</SMALL></H3></A>
  176. Set this macro to specify the extension name (such as .cpl) when you want your binary to have something other than the default extension generated by <A HREF=#TARGETTYPE>TARGETTYPE</A>.
  177. If you specify something unexpected, you will see a message "Unexpected Target Ext." If you want an extension added to the Build Utility, contact Bryan Tuttle (bryant).
  178. <A NAME=TARGETLIBS><H3>TARGETLIBS - <SMALL>required</SMALL></H3></A>
  179. <P>Set this macro to specify the set of libraries with which your final image must be linked.</P>
  180. If your components generates a library (.lib) and this library must link in code from other libraries, use the <A HREF=#LINKLIBS>LINKLIBS</A> macro.
  181. Use LINKLIBS only for the case that meets the following conditions:
  182. You are building a dynamic link.
  183. You are exporting something that's defined in some other component library that you also build.
  184. In your dirs file in the subdirectory above, you have ordered it so that the component libraries are around before you build the dynamic link.
  185. There is a similar macro called UMLIBSUMLIBS that you can use if you are building UMAPPLs.
  186. <A NAME=TARGETNAME><H3>TARGETNAME - <SMALL>required</SMALL></H3></A>
  187. Use this macro to specify the name of the binary being built, excluding the filename extension.
  188. You must have this macro in your sources file.
  189. <A NAME=TARGETPATH><H3>TARGETPATH - <SMALL>required</SMALL></H3></A>
  190. Use this macro to specify the target directory in which the resulting binary will be placed.
  191. Notice that object files always end up in the obj subdirectory. Object file can only be generated in the <A HREF=#$(O)>$(O)</A> directory.
  192. You must have this macro in your sources file. For example:
  193. <PRE> TARGETPATH=obj</PRE>
  194. See Also <A HREF=#TARGETPATHLIB>TARGETPATHLIB</A>
  195. <A NAME=TARGETPATHLIB><H3>TARGETPATHLIB - <SMALL>optional</SMALL></H3></A>
  196. Set this value to specify where to put the import library associated with this binary. <BR>
  197. When you are building a DLL, you create the DLL itself and you create an import library that other images can use to reference functions exported by your DLL. <BR>
  198. <PRE> TARGETPATHLIB=$(SDK_LIB_PATH)mydll.lib</PRE>
  199. <P>Setting <A HREF=#TARGETPATH>TARGETPATH</A> independently from TARGETPATHLIB allows the binary to be kept in the
  200. current directory, while the .lib and .exp files can be shared with other components. </P>
  201. <A NAME=TARGETTYPE><H3>TARGETTYPE - <SMALL>required</SMALL></H3></A>
  202. Use this macro to specify the type of binary being built. This is typically LIBRARY or
  203. DYNLINK (for DLLs), but can take other values. This is a required field in the sources file.
  204. TARGETTYPE allows build.exe to select appropriate defaults for include paths and link options.
  205. You must have this macro in your sources file.
  206. The valid values for TARGETYPE include:
  207. <TABLE CELLPADDING=3 BORDER=3>
  208. <TR VALIGN=TOP><TH> TARGETTYPE values </TH><TH> File Extension </TH><TH> Description </TH>
  209. <TR VALIGN=TOP><TD><A NAME=PROGLIB>PROGLIB</A> </TD><TD> .exe </TD><TD> Executable program which also exports functions for other programs. </TD></TR>
  210. <TR VALIGN=TOP><TD><A NAME=PROGRAM>PROGRAM</A> </TD><TD> .exe </TD><TD> Simple user mode program. </TD></TR>
  211. <TR VALIGN=TOP><TD><A NAME=DYNLINK>DYNLINK</A> </TD><TD> .dll </TD><TD> Dynamic Link Library (dll). </TD></TR>
  212. <TR VALIGN=TOP><TD><A NAME=LIBRARY>LIBRARY</A> </TD><TD> .lib </TD><TD> Component library whose code will be linked into another binary (such as a dll). </TD></TR>
  213. <TR VALIGN=TOP><TD><A NAME=DRIVER_LIBRARY>DRIVER_LIBRARY</A> </TD><TD> .lib </TD><TD> Component library for a driver. The only difference with the LIBRARY type is that the default header file include path is different. </TD></TR>
  214. <TR VALIGN=TOP><TD><A NAME=DRIVER>DRIVER</A> </TD><TD> .sys </TD><TD> Kernel mode driver.
  215. <TR VALIGN=TOP><TD><A NAME=EXPORT_DRIVER>EXPORT_DRIVER</A> </TD><TD> .sys </TD><TD> Kernel mode driver which also exports routines other drivers can link against and call. </TD></TR>
  216. <TR VALIGN=TOP><TD><A NAME=HAL>HAL</A> </TD><TD> .dll </TD><TD> Hardware Abstraction Layer (HAL) </TD></TR>
  217. <TR VALIGN=TOP><TD><A NAME=BOOTPGM>BOOTPGM</A> </TD><TD> .exe </TD><TD> Kernel mode driver. </TD></TR>
  218. <TR VALIGN=TOP><TD><A NAME=MINIPORT>MINIPORT</A> </TD><TD> .sys </TD><TD> Kernel mode driver which does not link against ntoskrnl.lib or hal.lib. </TD></TR>
  219. <TR VALIGN=TOP><TD><A NAME=GDI_DRIVER>GDI_DRIVER</A> </TD><TD> .dll </TD><TD> Kernel mode driver which only links against win32k.sys (Display or print driver). </TD></TR>
  220. </TABLE>
  221. <A NAME=UMAPPL><H3>UMAPPL</H3></A>
  222. <A NAME=UMAPPLEXT><H3>UMAPPLEXT</H3></A>
  223. Use this macro to specify the extension name (for example .COM or .SCR) that
  224. will be appended to the name specified in <A HREF=#UMAPPL>UMAPPL</A>.
  225. Use UMAPPLEXT when you want the extension to be something other than .exe.
  226. Contact Bryan Tuttle if you need to add a new type of extension.
  227. <A NAME=UMLIBS><H3>UMLIBS</H3></A>
  228. <A NAME=UMTEST><H3>UMTEST</H3></A>
  229. <H2>Sample Driver Sources File</H2>
  230. <PRE>
  231. <A HREF=#TARGETNAME>TARGETNAME</A>=sample
  232. <A HREF=#TARGETPATH>TARGETPATH</A>=obj
  233. <A HREF=#TARGETTYPE>TARGETTYPE</A>=<A HREF=#DRIVER>DRIVER</A>
  234. <A HREF=#TARGETLIBS>TARGETLIBS</A>=$(<A HREF=#DDK_LIB_PATH>DDK_LIB_PATH</A>)\videoprt.lib
  235. <A HREF=#SOURCES>SOURCES</A>=file1.c \<BR> file2.c \<BR> file3.c
  236. </PRE>
  237. </BODY></HTML>