ReactOS Build System Documentation$Id$CasperHornstrupEmanuele Aliberti2005Building ReactOSBuilding ReactOSTo generate GNU make makefiles and building ReactOS, do the
following:Go to the top-level reactos
directory;Run the command:mingw32-makeThis will start building ReactOS.To build a bootable CD, run the following command:mingw32-make bootcdThis
will create ReactOS.iso in the top-level
reactos directory.How build directions are storedXML files are used throughout the ReactOS source tree to drive the
build system.Top-level XML Build FileThe top-level XML build file (ReactOS.xml) is
processed by rbuild. The following is an example of
how it could look like:<?xml version="1.0"?>
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
<project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config.xml">
<xi:fallback>
<xi:include href="config.template.xml" />
</xi:fallback>
</xi:include>
<define name="_M_IX86" />
<if property="DBG" value="1">
<define name="DBG" value="1" />
<property name="DBG_OR_KDBG" value="true" />
</if>
<include base="ReactOS">include</include>
<directory name="boot">
<xi:include href="boot/boot.xml" />
</directory>
<module name="bootcd" type="iso">
</module>
</project>XIncludeXML files used by rbuild are modular and use
XInclude to include other chunks of XML in the top-level
ReactOS.xml file. The namespace used by XInclude is
xi.xi:includeIt is possible to split an XML build file over several files.
The include element in the xi namespace is used to
accomplish this.Syntax<xi:include href="config.xml">
<xi:fallback>
<xi:include href="config.template.xml" />
</xi:fallback>
</xi:include>AttributeshrefName of XML build file to include. The filename is
relative to the location of the current XML build
file.ValueNone.Childrenxi:fallback.xi:fallbackThis element is used to provide the name of an alternate file
that is to be included if the first include file did not
exists.Syntax<xi:fallback>
<xi:include href="config.template.xml" />
</xi:fallback>AttributesNone.ValueNone.Parentsxi:include.Childrenxi:include.Element referenceBootstrap elementA bootstrap element specifies that the generated file should be
put on the bootable CD as a bootstrap file.Syntax<bootstrap base="reactos" nameoncd="halmp.dll" />AttributesbasePut file in this directory on the bootable CD. This
attribute is optional.nameoncdName of file on the bootable CD. This attribute is
optional.ValueNone.ChildrenNone.CDFile elementA cdfile element specifies the name of a file that is to be put
on the bootable CD.Syntax<cdfile base="reactos" nameoncd="ReadMe.txt">ReadMe.txt</cdfile>AttributesbasePut file in this directory on the bootable CD. This
attribute is optional.nameoncdName of file on the bootable CD. This attribute is
optional.ValueName of file.ChildrenNone.Component elementA component element specifies that imports from a library are to
be stubbed so tests can be run without actually calling the functions
in the library. This element can only be used for modules of type
test.Syntax<component name="ntdll.dll">
...
</component>AttributesnameName of library.ValueNone.Childrensymbol.Define elementA define element specifies the name and (optionally) value of a
define for the C/C++ compiler and resource compiler.Syntax<define name="WINVER">0x501</define>AttributesnameName of define.ValueValue of define. The value is optional.ChildrenNone.Dependency elementA dependency element specifies the name of a module (usually of
type buildtool) that is to be processed before the current
module.Syntax<dependency>OtherModule</dependency>AttributesNone.ValueName of module.ChildrenNone.Directory elementA directory element specifies the name of a subdirectory.Syntax<directory name="MyDirectory">
...
</directory>AttributesnameName of directory.ValueNone.Childrencdfile, directory, file, if, pch, property.File elementA file element specifies the name of a file that is to be
processed.Syntax<file>MyFile.c</file>AttributesNone.ValueName of file.ChildrenNone.If elementAn if element allows for conditional processing of other
elements.Syntax<if property="DBG" value="1">
...
</if>AttributespropertyName of the property that is to be evaluated.valueValue to compare to the value of the property. If the
property has the specified value, then the subelements are
processed.ValueNone.Childrencompilerflag,
define, directory, file, if, include, property.Importlibrary elementAn importlibrary element specifies that an import library should
be generated which other modules can use to link with the current
module.Syntax<importlibrary definition="MyModule.def" />AttributesdefinitionFilename of definition file
(.def) used to generate the import
library. The filename is relative to the current
module.ValueNone.ChildrenNone.Include elementAn include element specifies an include directory for the C/C++
compiler and resource compiler.Syntax<include base="MyLibraryModule">include</include>AttributesbaseModule or project which the value of this element is
relative to. This attribute is optional. If left out, the
include directory is relative to the position of the
top-level XML build file.ValueRelative include directory.ChildrenNone.Input elementAn input element specifies a group of filenames that is to be
passed as parameters to a build tool. Input filename parameters are
located after output filename parameters on the command line.Syntax<input>
...
</input>AttributesNone.ValueNone.Parentsinvoke.Childreninputfile.Inputfile elementAn inputfile element specifies a filename that is to be passed
as a parameter to a build tool.Syntax<inputfile>ntoskrnl.mc</inputfile>AttributesswitchesSwitches that is passed as parameters just before the
filename. This attribute is optional.ValueName of file that is to be passed as a parameter to the build
tool.Parentsinput.ChildrenNone.Installfile elementAn installfile element specifies the name of a file that is to
be installed when using 'make install'.Syntax<installfile base="reactos" newname="ReadMe.txt">ReadMe.txt</installfile>AttributesbasePut file in this directory within the install
directory. This attribute is optional.newnameName of file within the install directory. This
attribute is optional.ValueName of file.ChildrenNone.Invoke elementAn invoke element specifies the name of a module which is to be
executed before the current module is processed.Syntax<invoke module="wmc">
<input>
<inputfile>ntoskrnl.mc</inputfile>
</input>
<output>
<outputfile switches="-H">../include/reactos/bugcodes.h</outputfile>
<outputfile switches="-o">bugcodes.rc</outputfile>
</output>
</invoke>AttributesmoduleName of the module to execute.ValueNone.Childreninput, output.Library elementA library element specifies the name of another module which is
to be linked with the current module.Syntax<library>MyLibraryModule</library>AttributesNone.sectionParentsmodule.ChildrenNone.Linkerflag elementA likerflag element specifies flags to be passed to the linker
tool.Syntax<linkerflag>-lgcc</linkerflag>AttributesNone.ValueThe switches to pass to the linker.ChildrenNone.Module elementThere can be zero or more modules per XML build file.Syntax<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">
...
</module>AttributesifIf the value is 1, then the module is enabled,
otherwise it is disabled. A disabled module is not
processed.ifnotIf the value is 1, then the module is disabled,
otherwise it is enabled. A disabled module is not
processed.nameName of the module. Also the base name of the
generated file if such file is generated for the particular
module type.typeType of module. See below for an explanation of module
types. The module type determines the
actions that is to be carried out to process the module. The
defined module types are seen
below:
Module TypesValueOutput name suffixEntrypointBaseaddressMangledsymbolsDescriptionbuildtool.exe (Windows)none (Linux)---Builds a tool that can be run (invoked) when
building ReactOS.staticlibrary.a---Builds a static library containing object
files that can be linked together with other
modules.objectlibrary.o---Builds object files that can be linked
together with other modules.kernel.exe_NtProcessStartup--Builds
ntoskrnl.exe.kernelmodedll.dll_DriverEntry@8--Builds a kernel-mode DLL.kernelmodedriver.sys_DriverEntry@8--Builds a kernel-mode driver.nativedll.dll_DllMainCRTStartup@12--Builds a native DLL.win32dll.dll_DllMain@12--Builds a Win32 DLL.win32cui.exe_mainCRTStartup--Builds a Win32 console executable.win32gui.exe_WinMainCRTStartup--Builds a Win32 GUI executable.bootloader----Builds a bootloader.bootsector----Builds one or more bootsector
binaries.iso----.Builds a bootable CD.test.exe_mainCRTStartup--Builds a testsuite.rpcserver.o---Generates and builds server code for an RPC
interface.rpcclient.o---Generates and builds client code for an RPC
interface.alias----Module is an alias for another module. This
module type is the only module type for which the
aliasof attribute is applicable. Only the module
install functionality is aliased.
extensionExtension of the generated file if such file is
generated for the particular module type.entrypointEntrypoint symbol of the generated file if such file
is generated for the particular module type.baseaddressBase address of the generated file if such file is
generated for the particular module type.mangledsymbolsControls wether or not to pass --kill-at to dlltool.
If this attribute has the value false then --kill-at is
passed to dlltool. If the value is true, then --kill-at is
not passed to dlltool. If the generated file exports C++
classes then this need to be true.installbaseBase directory of the generated file in the
installation directory. This attribute is optional.installnameName of generated file in the installation directory.
This attribute is optional, but if not specified, the
generated file is not copied to the installation
directory.usewrcUse WRC to compile resources if true. If false,
windres is used. This attribute is optional. If not
specified, WRC will be used.warningsError out if false and at least one warning is emitted
during building of this module. This attribute is optional.
If not specified, it is assumed to be false.aliasofName of module that is aliased.ValueNone.Parentsproject.Childrenbootstrap, component, define, dependency, directory, file, if, importlibrary, include, invoke, library, property.Output elementAn output element specifies a group of filenames that is to be
passed as parameters to a build tool. Output filename parameters are
located before input filename parameters on the command line.Syntax<output>
...
</output>AttributesNone.ValueNone.ParentsinvokeChildrenoutputfile.Outputfile elementAn outputfile element specifies a filename that is to be passed
as a parameter to a build tool.Syntax<outputfile switches="-H">../include/reactos/bugcodes.h</outputfile>AttributesswitchesSwitches that are passed as parameters just before the
filename. This attribute is optional.ValueName of file that is to be passed as a parameter to the build
tool.Parentsoutput.ChildrenNone.Pch elementA pch element specifies a GCC precompiled header file.Syntax<pch>ntdll.h</pch>AttributesNone.ValueName of the include file to be precompiled.ChildrenNone.Project elementThere can be one project per
top-level XML build file. A project can only be defined in a top-level
XML build file.Syntax<project name="ReactOS" makefile="Makefile.auto" xmlns:xi="http://www.w3.org/2001/XInclude">
...
</project>AttributesnameName of the project.makefileFilename of the GNU makefile that is to be
created.ValueNone.ParentsNone. This is the top-level (root) element of
ReactOS.xml file.Childrendefine, directory, if, include, module, property.Property elementA property element specifies the name and value of a property
that can be used for conditional processing of the XML build
file.Syntax<property name="mypropertyname" value="mypropertyvalue" />AttributesnameName of property.valueValue of property.ValueNone.ParentsChildrenNone.Symbol elementA symbol element specifies an imported function from a library
that is to be stubbed so tests can be run without actually calling the
function in the library.Syntax<symbol newname="RtlAllocateHeap">HeapAlloc@12</symbol>AttributesnewnameNew name of symbol. This attribute is optional.ValueName of symbol.ChildrenNone.BibliographyExtensible Markup
Language (XML) 1.0 (Third Edition)W3C
RecommendationFrançoisYergeauTimBrayJeanPaoliC. M.Sperberg-McQueenEveMaler4th February 2004XML Inclusions
(XInclude) Version 1.0 W3C
RecommendationJonathanMarshMicrosoftjmarsh@microsoft.comDavidOrchardBEA Systemsdorchard@bea.com20 December 2004