1 <?xml version="1.0" encoding="US-ASCII"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
5 <title>ReactOS Build System Documentation</title>
8 <releaseinfo>$Id$</releaseinfo>
11 <firstname>Casper</firstname>
13 <surname>Hornstrup</surname>
17 <surname>Emanuele Aliberti</surname>
26 <title>Building ReactOS</title>
29 <title>Building ReactOS</title>
31 <para>To generate GNU make makefiles and building ReactOS, do the
32 following:<orderedlist>
34 <para>Go to the top-level <filename>reactos</filename>
39 <para>Run the command:<screen>mingw32-make</screen></para>
41 <para>This will start building ReactOS.</para>
45 <para>To build a bootable CD, run the following command:<screen>mingw32-make bootcd</screen>This
46 will create <filename>ReactOS.iso</filename> in the top-level
47 <filename>reactos</filename> directory.</para>
52 <title>How build directions are stored</title>
54 <para>XML files are used throughout the ReactOS source tree to drive the
58 <title>Top-level XML Build File</title>
60 <para>The top-level XML build file (<filename>ReactOS.xml</filename>) is
61 processed by <command>rbuild</command>. The following is an example of
62 how it could look like:<programlisting><?xml version="1.0"?>
63 <!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
64 <project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
65 <xi:include href="config.xml">
67 <xi:include href="config.template.xml" />
71 <define name="_M_IX86" />
72 <if property="DBG" value="1">
73 <define name="DBG" value="1" />
74 <property name="DBG_OR_KDBG" value="true" />
77 <include base="ReactOS">include</include>
79 <directory name="boot">
80 <xi:include href="boot/boot.xml" />
83 <module name="bootcd" type="iso">
85 </project></programlisting></para>
89 <title>XInclude</title>
91 <para>XML files used by <command>rbuild</command> are modular and use
92 XInclude to include other chunks of XML in the top-level
93 <filename>ReactOS.xml</filename> file. The namespace used by XInclude is
94 <literal>xi</literal>.</para>
96 <section id="element.xi.include">
97 <title>xi:include</title>
99 <para>It is possible to split an XML build file over several files.
100 The include element in the <literal>xi</literal> namespace is used to
101 accomplish this.</para>
104 <title>Syntax</title>
106 <programlisting><xi:include href="<replaceable>config.xml</replaceable>">
108 <xi:include href="<replaceable>config.template.xml</replaceable>" />
110 </xi:include></programlisting>
114 <title>Attributes</title>
121 <para>Name of XML build file to include. The filename is
122 relative to the location of the current XML build
126 </variablelist></para>
136 <title>Children</title>
138 <para><link linkend="???">xi:fallback</link>.</para>
142 <section id="element.xi.fallback">
143 <title>xi:fallback</title>
145 <para>This element is used to provide the name of an alternate file
146 that is to be included if the first include file did not
150 <title>Syntax</title>
152 <programlisting><xi:fallback>
153 <xi:include href="<replaceable>config.template.xml</replaceable>" />
154 </xi:fallback></programlisting>
158 <title>Attributes</title>
170 <title>Parents</title>
172 <para><link linkend="element.xi.include">xi:include</link>.</para>
176 <title>Children</title>
178 <para><link linkend="element.xi.include">xi:include</link>.</para>
184 <title>Element reference</title>
186 <section id="element.bootstrap">
187 <title>Bootstrap element</title>
189 <para>A bootstrap element specifies that the generated file should be
190 put on the bootable CD as a bootstrap file.</para>
193 <title>Syntax</title>
195 <para><programlisting><bootstrap base="reactos" nameoncd="halmp.dll" /></programlisting></para>
199 <title>Attributes</title>
206 <para>Put file in this directory on the bootable CD. This
207 attribute is optional.</para>
212 <term>nameoncd</term>
215 <para>Name of file on the bootable CD. This attribute is
219 </variablelist></para>
229 <title>Children</title>
235 <section id="element.cdfile">
236 <title>CDFile element</title>
238 <para>A cdfile element specifies the name of a file that is to be put
239 on the bootable CD.</para>
242 <title>Syntax</title>
244 <para><programlisting><cdfile base="reactos" nameoncd="ReadMe.txt">ReadMe.txt</cdfile></programlisting></para>
248 <title>Attributes</title>
255 <para>Put file in this directory on the bootable CD. This
256 attribute is optional.</para>
261 <term>nameoncd</term>
264 <para>Name of file on the bootable CD. This attribute is
268 </variablelist></para>
274 <para>Name of file.</para>
278 <title>Children</title>
284 <section id="element.component">
285 <title>Component element</title>
287 <para>A component element specifies that imports from a library are to
288 be stubbed so tests can be run without actually calling the functions
289 in the library. This element can only be used for modules of type
293 <title>Syntax</title>
295 <para><programlisting><component name="ntdll.dll">
297 </component></programlisting></para>
301 <title>Attributes</title>
308 <para>Name of library.</para>
311 </variablelist></para>
321 <title>Children</title>
323 <para><link linkend="element.symbol">symbol</link>.</para>
327 <section id="element.define">
328 <title>Define element</title>
330 <para>A define element specifies the name and (optionally) value of a
331 define for the C/C++ compiler and resource compiler.</para>
334 <title>Syntax</title>
336 <para><programlisting><define name="<replaceable>WINVER</replaceable>"><replaceable>0x501</replaceable></define></programlisting></para>
340 <title>Attributes</title>
347 <para>Name of define.</para>
350 </variablelist></para>
356 <para>Value of define. The value is optional.</para>
360 <title>Children</title>
366 <section id="element.dependency">
367 <title>Dependency element</title>
369 <para>A dependency element specifies the name of a module (usually of
370 type buildtool) that is to be processed before the current
374 <title>Syntax</title>
376 <para><programlisting><dependency><replaceable>OtherModule</replaceable></dependency></programlisting></para>
380 <title>Attributes</title>
388 <para>Name of module.</para>
392 <title>Children</title>
398 <section id="element.directory">
399 <title>Directory element</title>
401 <para>A directory element specifies the name of a subdirectory.</para>
404 <title>Syntax</title>
406 <para><programlisting><directory name="<replaceable>MyDirectory</replaceable>">
408 </directory></programlisting></para>
412 <title>Attributes</title>
419 <para>Name of directory.</para>
422 </variablelist></para>
432 <title>Children</title>
434 <para><link linkend="element.cdfile">cdfile</link>, <link
435 linkend="element.directory">directory</link>, <link
436 linkend="element.file">file</link>, <link
437 linkend="element.if">if</link>, <link
438 linkend="element.pch">pch</link>, <link
439 linkend="element.property">property</link>.</para>
443 <section id="element.file">
444 <title>File element</title>
446 <para>A file element specifies the name of a file that is to be
450 <title>Syntax</title>
452 <para><programlisting><file><replaceable>MyFile.c</replaceable></file></programlisting></para>
456 <title>Attributes</title>
464 <para>Name of file.</para>
468 <title>Children</title>
474 <section id="element.if">
475 <title>If element</title>
477 <para>An if element allows for conditional processing of other
481 <title>Syntax</title>
483 <para><programlisting><if property="<replaceable>DBG</replaceable>" value="<replaceable>1</replaceable>">
485 </if></programlisting></para>
489 <title>Attributes</title>
493 <term>property</term>
496 <para>Name of the property that is to be evaluated.</para>
504 <para>Value to compare to the value of the property. If the
505 property has the specified value, then the subelements are
509 </variablelist></para>
519 <title>Children</title>
521 <para><link linkend="element.compilerflag">compilerflag</link>,
522 <link linkend="element.define">define</link>, <link
523 linkend="element.directory">directory</link>, <link
524 linkend="element.file">file</link>, <link
525 linkend="element.if">if</link>, <link
526 linkend="element.include">include</link>, <link
527 linkend="element.property">property</link>.</para>
531 <section id="element.importlibrary">
532 <title>Importlibrary element</title>
534 <para>An importlibrary element specifies that an import library should
535 be generated which other modules can use to link with the current
539 <title>Syntax</title>
541 <para><programlisting><importlibrary definition="<replaceable>MyModule.def</replaceable>" /></programlisting></para>
545 <title>Attributes</title>
549 <term>definition</term>
552 <para>Filename of definition file
553 (<filename>.def</filename>) used to generate the import
554 library. The filename is relative to the current
558 </variablelist></para>
568 <title>Children</title>
574 <section id="element.include">
575 <title>Include element</title>
577 <para>An include element specifies an include directory for the C/C++
578 compiler and resource compiler.</para>
581 <title>Syntax</title>
583 <para><programlisting><include base="<replaceable>MyLibraryModule</replaceable>"><replaceable>include</replaceable></include></programlisting></para>
587 <title>Attributes</title>
594 <para>Module or project which the value of this element is
595 relative to. This attribute is optional. If left out, the
596 include directory is relative to the position of the
597 top-level XML build file.</para>
600 </variablelist></para>
606 <para>Relative include directory.</para>
610 <title>Children</title>
616 <section id="element.input">
617 <title>Input element</title>
619 <para>An input element specifies a group of filenames that is to be
620 passed as parameters to a build tool. Input filename parameters are
621 located after output filename parameters on the command line.</para>
624 <title>Syntax</title>
626 <para><programlisting><input>
628 </input></programlisting></para>
632 <title>Attributes</title>
644 <title>Parents</title>
646 <para><link linkend="element.invoke">invoke</link>.</para>
650 <title>Children</title>
652 <para><link linkend="element.inputfile">inputfile</link>.</para>
656 <section id="element.inputfile">
657 <title>Inputfile element</title>
659 <para>An inputfile element specifies a filename that is to be passed
660 as a parameter to a build tool.</para>
663 <title>Syntax</title>
665 <para><programlisting><inputfile><replaceable>ntoskrnl.mc</replaceable></inputfile></programlisting></para>
669 <title>Attributes</title>
673 <term>switches</term>
676 <para>Switches that is passed as parameters just before the
677 filename. This attribute is optional.</para>
680 </variablelist></para>
686 <para>Name of file that is to be passed as a parameter to the build
691 <title>Parents</title>
693 <para><link linkend="element.input">input</link>.</para>
697 <title>Children</title>
703 <section id="element.installfile">
704 <title>Installfile element</title>
706 <para>An installfile element specifies the name of a file that is to
707 be installed when using '<command>make install</command>'.</para>
710 <title>Syntax</title>
712 <para><programlisting><installfile base="<replaceable>reactos</replaceable>" newname="<replaceable>ReadMe.txt</replaceable>"><replaceable>ReadMe.txt</replaceable></installfile></programlisting></para>
716 <title>Attributes</title>
723 <para>Put file in this directory within the install
724 directory. This attribute is optional.</para>
732 <para>Name of file within the install directory. This
733 attribute is optional.</para>
736 </variablelist></para>
742 <para>Name of file.</para>
746 <title>Children</title>
752 <section id="element.invoke">
753 <title>Invoke element</title>
755 <para>An invoke element specifies the name of a module which is to be
756 executed before the current module is processed.</para>
759 <title>Syntax</title>
761 <para><programlisting><invoke module="<replaceable>wmc</replaceable>">
763 <inputfile><replaceable>ntoskrnl.mc</replaceable></inputfile>
766 <outputfile switches="<replaceable>-H</replaceable>"><replaceable>../include/reactos/bugcodes.h</replaceable></outputfile>
767 <outputfile switches="<replaceable>-o</replaceable>"><replaceable>bugcodes.rc</replaceable></outputfile>
769 </invoke></programlisting></para>
773 <title>Attributes</title>
780 <para>Name of the module to execute.</para>
783 </variablelist></para>
793 <title>Children</title>
795 <para><link linkend="element.input">input</link>, <link
796 linkend="element.output">output</link>.</para>
800 <section id="element.library">
801 <title>Library element</title>
803 <para>A library element specifies the name of another module which is
804 to be linked with the current module.</para>
807 <title>Syntax</title>
809 <para><programlisting><library><replaceable>MyLibraryModule</replaceable></library></programlisting></para>
813 <title>Attributes</title>
815 <para>None.section</para>
819 <title>Parents</title>
821 <para><link linkend="element.module">module</link>.</para>
825 <title>Children</title>
831 <section id="element.linkerflag">
832 <title>Linkerflag element</title>
834 <para>A likerflag element specifies flags to be passed to the linker
838 <title>Syntax</title>
840 <para><programlisting><linkerflag><replaceable>-lgcc</replaceable></linkerflag></programlisting></para>
844 <title>Attributes</title>
852 <para>The switches to pass to the linker.</para>
856 <title>Children</title>
862 <section id="element.module">
863 <title>Module element</title>
865 <para>There can be zero or more <sgmltag
866 class="element">module</sgmltag>s per XML build file.</para>
869 <title>Syntax</title>
871 <para><programlisting><module if="${MP}" ifnot="${MP}" name="msvcrt" type="win32dll" extension=".dll" entrypoint="_DllMain@12" baseaddress="0x70000000" mangledsymbols="true" installbase="system32" installname="msvcrt.dll" usewrc="false" warnings="true" aliasof="module1">
873 </module></programlisting></para>
877 <title>Attributes</title>
884 <para>If the value is 1, then the module is enabled,
885 otherwise it is disabled. A disabled module is not
894 <para>If the value is 1, then the module is disabled,
895 otherwise it is enabled. A disabled module is not
904 <para>Name of the module. Also the base name of the
905 generated file if such file is generated for the particular
914 <para>Type of module. See below for an explanation of module
915 types. <emphasis><emphasis>The module type determines the
916 actions that is to be carried out to process the module. The
917 defined module types are seen
918 below:</emphasis></emphasis></para>
921 <title>Module Types</title>
928 <entry>Output name suffix</entry>
930 <entry>Entrypoint</entry>
932 <entry>Baseaddress</entry>
934 <entry>Mangledsymbols</entry>
936 <entry>Description</entry>
942 <entry>buildtool</entry>
947 <entry><filename>.exe</filename> (Windows)</entry>
949 <entry>none (Linux)</entry>
960 <entry>Builds a tool that can be run (invoked) when
961 building ReactOS.</entry>
965 <entry>staticlibrary</entry>
967 <entry><filename>.a</filename></entry>
975 <entry>Builds a static library containing object
976 files that can be linked together with other
981 <entry>objectlibrary</entry>
983 <entry><filename>.o</filename></entry>
991 <entry>Builds object files that can be linked
992 together with other modules.</entry>
996 <entry>kernel</entry>
998 <entry><filename>.exe</filename></entry>
1000 <entry><function>_NtProcessStartup</function></entry>
1007 <filename>ntoskrnl.exe</filename>.</entry>
1011 <entry>kernelmodedll</entry>
1013 <entry><filename>.dll</filename></entry>
1015 <entry><function>_DriverEntry@8</function></entry>
1021 <entry>Builds a kernel-mode DLL.</entry>
1025 <entry>kernelmodedriver</entry>
1027 <entry><filename>.sys</filename></entry>
1029 <entry><function>_DriverEntry@8</function></entry>
1035 <entry>Builds a kernel-mode driver.</entry>
1039 <entry>nativedll</entry>
1041 <entry><filename>.dll</filename></entry>
1043 <entry><function>_DllMainCRTStartup@12</function></entry>
1049 <entry>Builds a native DLL.</entry>
1053 <entry>win32dll</entry>
1055 <entry><filename>.dll</filename></entry>
1057 <entry><function>_DllMain@12</function></entry>
1063 <entry>Builds a Win32 DLL.</entry>
1067 <entry>win32cui</entry>
1069 <entry><filename>.exe</filename></entry>
1071 <entry><function>_mainCRTStartup</function></entry>
1077 <entry>Builds a Win32 console executable.</entry>
1081 <entry>win32gui</entry>
1083 <entry><filename>.exe</filename></entry>
1085 <entry><function>_WinMainCRTStartup</function></entry>
1091 <entry>Builds a Win32 GUI executable.</entry>
1095 <entry>bootloader</entry>
1105 <entry>Builds a bootloader.</entry>
1109 <entry>bootsector</entry>
1119 <entry>Builds one or more bootsector
1134 <entry>Builds a bootable CD.</entry>
1142 <entry>_mainCRTStartup</entry>
1148 <entry>Builds a testsuite.</entry>
1152 <entry>rpcserver</entry>
1154 <entry><filename>.o</filename></entry>
1162 <entry>Generates and builds server code for an RPC
1167 <entry>rpcclient</entry>
1169 <entry><filename>.o</filename></entry>
1177 <entry>Generates and builds client code for an RPC
1182 <entry>alias</entry>
1192 <entry>Module is an alias for another module. This
1193 module type is the only module type for which the
1194 aliasof attribute is applicable. Only the module
1195 install functionality is aliased.</entry>
1204 <term>extension</term>
1207 <para>Extension of the generated file if such file is
1208 generated for the particular module type.</para>
1213 <term>entrypoint</term>
1216 <para>Entrypoint symbol of the generated file if such file
1217 is generated for the particular module type.</para>
1222 <term>baseaddress</term>
1225 <para>Base address of the generated file if such file is
1226 generated for the particular module type.</para>
1231 <term>mangledsymbols</term>
1234 <para>Controls wether or not to pass --kill-at to dlltool.
1235 If this attribute has the value false then --kill-at is
1236 passed to dlltool. If the value is true, then --kill-at is
1237 not passed to dlltool. If the generated file exports C++
1238 classes then this need to be true.</para>
1243 <term>installbase</term>
1246 <para>Base directory of the generated file in the
1247 installation directory. This attribute is optional.</para>
1252 <term>installname</term>
1255 <para>Name of generated file in the installation directory.
1256 This attribute is optional, but if not specified, the
1257 generated file is not copied to the installation
1266 <para>Use WRC to compile resources if true. If false,
1267 windres is used. This attribute is optional. If not
1268 specified, WRC will be used.</para>
1273 <term>warnings</term>
1276 <para>Error out if false and at least one warning is emitted
1277 during building of this module. This attribute is optional.
1278 If not specified, it is assumed to be false.</para>
1283 <term>aliasof</term>
1286 <para>Name of module that is aliased.</para>
1289 </variablelist></para>
1293 <title>Value</title>
1299 <title>Parents</title>
1301 <para><link linkend="element.project">project</link>.</para>
1305 <title>Children</title>
1307 <para><link linkend="element.bootstrap">bootstrap</link>, <link
1308 linkend="element.component">component</link>, <link
1309 linkend="element.define">define</link>, <link
1310 linkend="element.dependency">dependency</link>, <link
1311 linkend="element.directory">directory</link>, <link
1312 linkend="element.file">file</link>, <link
1313 linkend="element.if">if</link>, <link
1314 linkend="element.importlibrary">importlibrary</link>, <link
1315 linkend="element.include">include</link>, <link
1316 linkend="element.invoke">invoke</link>, <link
1317 linkend="element.library">library</link>, <link
1318 linkend="element.property">property</link>.</para>
1322 <section id="element.output">
1323 <title>Output element</title>
1325 <para>An output element specifies a group of filenames that is to be
1326 passed as parameters to a build tool. Output filename parameters are
1327 located before input filename parameters on the command line.</para>
1330 <title>Syntax</title>
1332 <para><programlisting><output>
1334 </output></programlisting></para>
1338 <title>Attributes</title>
1344 <title>Value</title>
1350 <title>Parents</title>
1352 <para><link linkend="element.invoke">invoke</link></para>
1356 <title>Children</title>
1358 <para><link linkend="element.outputfile">outputfile</link>.</para>
1362 <section id="element.outputfile">
1363 <title>Outputfile element</title>
1365 <para>An outputfile element specifies a filename that is to be passed
1366 as a parameter to a build tool.</para>
1369 <title>Syntax</title>
1371 <para><programlisting><outputfile switches="<replaceable>-H</replaceable>"><replaceable>../include/reactos/bugcodes.h</replaceable></outputfile></programlisting></para>
1375 <title>Attributes</title>
1377 <para><variablelist>
1379 <term>switches</term>
1382 <para>Switches that are passed as parameters just before the
1383 filename. This attribute is optional.</para>
1386 </variablelist></para>
1390 <title>Value</title>
1392 <para>Name of file that is to be passed as a parameter to the build
1397 <title>Parents</title>
1399 <para><link linkend="element.output">output</link>.</para>
1403 <title>Children</title>
1409 <section id="element.pch">
1410 <title>Pch element</title>
1412 <para>A pch element specifies a GCC precompiled header file.</para>
1415 <title>Syntax</title>
1417 <para><programlisting><pch><replaceable>ntdll.h</replaceable></pch></programlisting></para>
1421 <title>Attributes</title>
1427 <title>Value</title>
1429 <para>Name of the include file to be precompiled.</para>
1433 <title>Children</title>
1439 <section id="element.project">
1440 <title>Project element</title>
1442 <para>There can be one <sgmltag class="element">project</sgmltag> per
1443 top-level XML build file. A project can only be defined in a top-level
1444 XML build file.</para>
1447 <title>Syntax</title>
1449 <para><programlisting><project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
1451 </project></programlisting></para>
1455 <title>Attributes</title>
1457 <para><variablelist>
1462 <para>Name of the project.</para>
1467 <term>makefile</term>
1470 <para>Filename of the GNU makefile that is to be
1474 </variablelist></para>
1478 <title>Value</title>
1484 <title>Parents</title>
1486 <para>None. This is the top-level (root) element of
1487 <filename>ReactOS.xml</filename> file.</para>
1491 <title>Children</title>
1493 <para><link linkend="element.define">define</link>, <link
1494 linkend="element.directory">directory</link>, <link
1495 linkend="element.if">if</link>, <link
1496 linkend="element.include">include</link>, <link
1497 linkend="element.module">module</link>, <link
1498 linkend="element.property">property</link>.</para>
1502 <section id="element.property">
1503 <title>Property element</title>
1505 <para>A property element specifies the name and value of a property
1506 that can be used for conditional processing of the XML build
1510 <title>Syntax</title>
1512 <para><programlisting><property name="<replaceable>mypropertyname</replaceable>" value="<replaceable>mypropertyvalue</replaceable>" /></programlisting></para>
1516 <title>Attributes</title>
1518 <para><variablelist>
1523 <para>Name of property.</para>
1531 <para>Value of property.</para>
1534 </variablelist></para>
1538 <title>Value</title>
1544 <title>Parents</title>
1550 <title>Children</title>
1556 <section id="element.symbol">
1557 <title>Symbol element</title>
1559 <para>A symbol element specifies an imported function from a library
1560 that is to be stubbed so tests can be run without actually calling the
1561 function in the library.</para>
1564 <title>Syntax</title>
1566 <para><programlisting><symbol newname="<replaceable>RtlAllocateHeap</replaceable>"><replaceable>HeapAlloc@12</replaceable></symbol></programlisting></para>
1570 <title>Attributes</title>
1572 <para><variablelist>
1574 <term>newname</term>
1577 <para>New name of symbol. This attribute is optional.</para>
1580 </variablelist></para>
1584 <title>Value</title>
1586 <para>Name of symbol.</para>
1590 <title>Children</title>
1599 <title>Bibliography</title>
1601 <bibliomixed><title><ulink
1602 url="http://www.w3.org/TR/2004/REC-xml-20040204/">Extensible Markup
1603 Language (XML) 1.0 (Third Edition)</ulink></title><releaseinfo>W3C
1604 Recommendation</releaseinfo><author>
1605 <firstname>François</firstname>
1607 <surname>Yergeau</surname>
1609 <firstname>Tim</firstname>
1611 <surname>Bray</surname>
1613 <firstname>Jean</firstname>
1615 <surname>Paoli</surname>
1617 <firstname>C. M.</firstname>
1619 <surname>Sperberg-McQueen</surname>
1621 <firstname>Eve</firstname>
1623 <surname>Maler</surname>
1624 </author><date>4th February 2004</date></bibliomixed>
1626 <bibliomixed><title><ulink
1627 url="http://www.w3.org/TR/2004/REC-xinclude-20041220/">XML Inclusions
1628 (XInclude) Version 1.0 </ulink></title><releaseinfo>W3C
1629 Recommendation</releaseinfo><editor>
1630 <firstname>Jonathan</firstname>
1632 <surname>Marsh</surname>
1635 <orgname>Microsoft</orgname>
1638 <email>jmarsh@microsoft.com</email>
1640 <firstname>David</firstname>
1642 <surname>Orchard</surname>
1645 <orgname>BEA Systems</orgname>
1648 <email>dorchard@bea.com</email>
1649 </editor>20 December 2004</bibliomixed>