* Build freeldr
authorCasper Hornstrup <chorns@users.sourceforge.net>
Sat, 22 Jan 2005 14:07:45 +0000 (14:07 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Sat, 22 Jan 2005 14:07:45 +0000 (14:07 +0000)
* Add BootLoader and ObjectLibrary module types
* Add <compilerflag> tag

svn path=/branches/xmlbuildsystem/; revision=13211

15 files changed:
reactos/ReactOS.xml
reactos/boot/boot.xml [new file with mode: 0644]
reactos/boot/freeldr/freeldr.xml [new file with mode: 0644]
reactos/boot/freeldr/freeldr/freeldr.xml [new file with mode: 0644]
reactos/boot/freeldr/freeldr/freeldr_base.xml [new file with mode: 0644]
reactos/boot/freeldr/freeldr/freeldr_base64k.xml [new file with mode: 0644]
reactos/boot/freeldr/freeldr/freeldr_main.xml [new file with mode: 0644]
reactos/boot/freeldr/freeldr/freeldr_startup.xml [new file with mode: 0644]
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.h
reactos/tools/rbuild/compilerflag.cpp [new file with mode: 0644]
reactos/tools/rbuild/makefile
reactos/tools/rbuild/module.cpp
reactos/tools/rbuild/rbuild.h

index 6a77afb..ef56c66 100644 (file)
@@ -21,6 +21,9 @@
        <include>w32api/include</include>\r
        <include>w32api/include/ddk</include>\r
 \r
+       <directory name="boot">\r
+               <xi:include href="boot/boot.xml" />\r
+       </directory>\r
        <directory name="drivers">\r
                <xi:include href="drivers/directory.xml" />\r
        </directory>\r
diff --git a/reactos/boot/boot.xml b/reactos/boot/boot.xml
new file mode 100644 (file)
index 0000000..2bc1b6e
--- /dev/null
@@ -0,0 +1,3 @@
+<directory name="freeldr">\r
+       <xi:include href="freeldr/freeldr.xml" />\r
+</directory>\r
diff --git a/reactos/boot/freeldr/freeldr.xml b/reactos/boot/freeldr/freeldr.xml
new file mode 100644 (file)
index 0000000..aee7646
--- /dev/null
@@ -0,0 +1,25 @@
+<!--<module name="bootsector" type="bootsector">\r
+       <include base="bootsector">freeldr/include</include>\r
+       <compilerflag>-nostdlib</compilerflag>\r
+       <compilerflag>-nostdinc</compilerflag>\r
+       <compilerflag>-ffreestanding</compilerflag>\r
+       <compilerflag>-no-builtin</compilerflag>\r
+       <compilerflag>-no-inline</compilerflag>\r
+       <compilerflag>-no-zero-initialized-in-bss</compilerflag>\r
+       <directory name="bootsect">\r
+               <file>dosmbr.asm</file>\r
+               <file>ext2.asm</file>\r
+               <file>fat32.asm</file>\r
+               <file>fat.asm</file>\r
+               <file>isoboot.asm</file>\r
+               <file>win2k.asm</file>\r
+               <file>wxpfat16.asm</file>\r
+       </directory>\r
+</module>-->\r
+<directory name="freeldr">\r
+       <xi:include href="freeldr/freeldr_startup.xml" />\r
+       <xi:include href="freeldr/freeldr_base64k.xml" />\r
+       <xi:include href="freeldr/freeldr_base.xml" />\r
+       <xi:include href="freeldr/freeldr_main.xml" />\r
+       <xi:include href="freeldr/freeldr.xml" />\r
+</directory>\r
diff --git a/reactos/boot/freeldr/freeldr/freeldr.xml b/reactos/boot/freeldr/freeldr/freeldr.xml
new file mode 100644 (file)
index 0000000..563d99d
--- /dev/null
@@ -0,0 +1,6 @@
+<module name="freeldr" type="bootloader">\r
+       <library>freeldr_startup</library>\r
+       <library>freeldr_base64k</library>\r
+       <library>freeldr_base</library>\r
+       <library>freeldr_main</library>\r
+</module>\r
diff --git a/reactos/boot/freeldr/freeldr/freeldr_base.xml b/reactos/boot/freeldr/freeldr/freeldr_base.xml
new file mode 100644 (file)
index 0000000..6b86cc4
--- /dev/null
@@ -0,0 +1,107 @@
+<module name="freeldr_base" type="objectlibrary">\r
+       <include base="freeldr_base">include</include>\r
+       <compilerflag>-nostdlib</compilerflag>\r
+       <compilerflag>-nostdinc</compilerflag>\r
+       <compilerflag>-ffreestanding</compilerflag>\r
+       <compilerflag>-fno-builtin</compilerflag>\r
+       <compilerflag>-fno-inline</compilerflag>\r
+       <compilerflag>-fno-zero-initialized-in-bss</compilerflag>\r
+       <compilerflag>-Os</compilerflag>\r
+       <directory name="arch">\r
+               <if property="ARCH" value="i386">\r
+                       <directory name="i386">\r
+                               <file>_alloca.S</file>\r
+                               <file>archmach.c</file>\r
+                               <file>hardware.c</file>\r
+                               <file>hwacpi.c</file>\r
+                               <file>hwapm.c</file>\r
+                               <file>hwcpu.c</file>\r
+                               <file>hwpci.c</file>\r
+                               <file>i386disk.c</file>\r
+                               <file>i386rtl.c</file>\r
+                               <file>i386vid.c</file>\r
+                               <file>machpc.c</file>\r
+                               <file>machxbox.c</file>\r
+                               <file>pccons.c</file>\r
+                               <file>pcdisk.c</file>\r
+                               <file>pcmem.c</file>\r
+                               <file>pcrtc.c</file>\r
+                               <file>pcvideo.c</file>\r
+                               <file>portio.c</file>\r
+                               <file>xboxcons.c</file>\r
+                               <file>xboxdisk.c</file>\r
+                               <file>xboxfont.c</file>\r
+                               <file>xboxhw.c</file>\r
+                               <file>xboxmem.c</file>\r
+                               <file>xboxrtc.c</file>\r
+                               <file>xboxvideo.c</file>\r
+                       </directory>\r
+               </if>\r
+       </directory>\r
+       <directory name="cache">\r
+               <file>blocklist.c</file>\r
+               <file>cache.c</file>\r
+       </directory>\r
+       <directory name="comm">\r
+               <file>rs232.c</file>\r
+       </directory>\r
+       <directory name="disk">\r
+               <file>disk.c</file>\r
+               <file>partition.c</file>\r
+       </directory>\r
+       <directory name="fs">\r
+               <file>ext2.c</file>\r
+               <file>fat.c</file>\r
+               <file>fs.c</file>\r
+               <file>fsrec.c</file>\r
+               <file>iso.c</file>\r
+               <file>ntfs.c</file>\r
+       </directory>\r
+       <directory name="inifile">\r
+               <file>ini_init.c</file>\r
+               <file>inifile.c</file>\r
+               <file>parse.c</file>\r
+       </directory>\r
+       <directory name="math">\r
+               <file>libgcc2.c</file>\r
+       </directory>\r
+       <directory name="mm">\r
+               <file>meminit.c</file>\r
+               <file>mm.c</file>\r
+       </directory>\r
+       <directory name="reactos">\r
+               <file>arcname.c</file>\r
+               <file>binhive.c</file>\r
+               <file>reactos.c</file>\r
+               <file>registry.c</file>\r
+       </directory>\r
+       <directory name="rtl">\r
+               <file>list.c</file>\r
+               <file>memcmp.c</file>\r
+               <file>memcpy.c</file>\r
+               <file>memmove.c</file>\r
+               <file>memset.c</file>\r
+               <file>print.c</file>\r
+               <file>stdlib.c</file>\r
+               <file>string.c</file>\r
+       </directory>\r
+       <directory name="ui">\r
+               <file>gui.c</file>\r
+               <file>tui.c</file>\r
+               <file>tuimenu.c</file>\r
+               <file>ui.c</file>\r
+       </directory>\r
+       <directory name="video">\r
+               <file>bank.c</file>\r
+               <file>fade.c</file>\r
+               <file>palette.c</file>\r
+               <file>pixel.c</file>\r
+               <file>video.c</file>\r
+       </directory>\r
+       <file>freeldr.c</file>\r
+       <file>debug.c</file>\r
+       <file>multiboot.c</file>\r
+       <file>version.c</file>\r
+       <file>cmdline.c</file>\r
+       <file>machine.c</file>\r
+</module>\r
diff --git a/reactos/boot/freeldr/freeldr/freeldr_base64k.xml b/reactos/boot/freeldr/freeldr/freeldr_base64k.xml
new file mode 100644 (file)
index 0000000..d783e49
--- /dev/null
@@ -0,0 +1,25 @@
+<module name="freeldr_base64k" type="objectlibrary">\r
+       <include base="freeldr_base64k">include</include>\r
+       <compilerflag>-nostdlib</compilerflag>\r
+       <compilerflag>-nostdinc</compilerflag>\r
+       <compilerflag>-ffreestanding</compilerflag>\r
+       <compilerflag>-fno-builtin</compilerflag>\r
+       <compilerflag>-fno-inline</compilerflag>\r
+       <compilerflag>-fno-zero-initialized-in-bss</compilerflag>\r
+       <compilerflag>-Os</compilerflag>\r
+       <directory name="arch">\r
+               <if property="ARCH" value="i386">\r
+                       <directory name="i386">\r
+                               <file>boot.S</file>\r
+                               <file>drvmap.S</file>\r
+                               <file>i386cpu.S</file>\r
+                               <file>i386idt.S</file>\r
+                               <file>i386pnp.S</file>\r
+                               <file>i386trap.S</file>\r
+                               <file>int386.S</file>\r
+                               <file>linux.S</file>\r
+                               <file>mb.S</file>\r
+                       </directory>\r
+               </if>\r
+       </directory>\r
+</module>\r
diff --git a/reactos/boot/freeldr/freeldr/freeldr_main.xml b/reactos/boot/freeldr/freeldr/freeldr_main.xml
new file mode 100644 (file)
index 0000000..9c8dd4c
--- /dev/null
@@ -0,0 +1,20 @@
+<module name="freeldr_main" type="objectlibrary">\r
+       <include base="freeldr_main">include</include>\r
+       <compilerflag>-nostdlib</compilerflag>\r
+       <compilerflag>-nostdinc</compilerflag>\r
+       <compilerflag>-ffreestanding</compilerflag>\r
+       <compilerflag>-fno-builtin</compilerflag>\r
+       <compilerflag>-fno-inline</compilerflag>\r
+       <compilerflag>-fno-zero-initialized-in-bss</compilerflag>\r
+       <compilerflag>-Os</compilerflag>\r
+       <directory name="inffile">\r
+               <file>inffile.c</file>\r
+       </directory>\r
+       <file>bootmgr.c</file>\r
+       <file>drivemap.c</file>\r
+       <file>miscboot.c</file>\r
+       <file>options.c</file>\r
+       <file>linuxboot.c</file>\r
+       <file>oslist.c</file>\r
+       <file>custom.c</file>\r
+</module>\r
diff --git a/reactos/boot/freeldr/freeldr/freeldr_startup.xml b/reactos/boot/freeldr/freeldr/freeldr_startup.xml
new file mode 100644 (file)
index 0000000..238d487
--- /dev/null
@@ -0,0 +1,17 @@
+<module name="freeldr_startup" type="objectlibrary">\r
+       <include base="freeldr_startup">include</include>\r
+       <compilerflag>-nostdlib</compilerflag>\r
+       <compilerflag>-nostdinc</compilerflag>\r
+       <compilerflag>-ffreestanding</compilerflag>\r
+       <compilerflag>-fno-builtin</compilerflag>\r
+       <compilerflag>-fno-inline</compilerflag>\r
+       <compilerflag>-fno-zero-initialized-in-bss</compilerflag>\r
+       <directory name="arch">\r
+               <if property="ARCH" value="i386">\r
+                       <directory name="i386">\r
+                               <file first="true">fathelp.asm</file>\r
+                               <file>arch.S</file>\r
+                       </directory>\r
+               </if>\r
+       </directory>\r
+</module>\r
index e9c9308..33036ad 100644 (file)
@@ -162,22 +162,26 @@ MingwBackend::GenerateGlobalVariables ()
 {\r
 #ifdef WIN32\r
        fprintf ( fMakefile, "host_gcc = gcc\n" );\r
-       fprintf ( fMakefile, "host_ar = ar\n" );\r
        fprintf ( fMakefile, "host_ld = ld\n" );\r
+       fprintf ( fMakefile, "host_ar = ar\n" );\r
+       fprintf ( fMakefile, "host_objcopy = objcopy\n" );\r
        fprintf ( fMakefile, "rm = del /f /q\n" );\r
        fprintf ( fMakefile, "gcc = gcc\n" );\r
        fprintf ( fMakefile, "ld = ld\n" );\r
        fprintf ( fMakefile, "ar = ar\n" );\r
+       fprintf ( fMakefile, "objcopy = objcopy\n" );\r
        fprintf ( fMakefile, "dlltool = dlltool\n" );\r
        fprintf ( fMakefile, "windres = windres\n" );\r
 #else\r
        fprintf ( fMakefile, "host_gcc = gcc\n" );\r
-       fprintf ( fMakefile, "host_ar = ar\n" );\r
        fprintf ( fMakefile, "host_ld = ld\n" );\r
+       fprintf ( fMakefile, "host_ar = ar\n" );\r
+       fprintf ( fMakefile, "host_objcopy = objcopy\n" );\r
        fprintf ( fMakefile, "rm = rm -f\n" );\r
        fprintf ( fMakefile, "gcc = mingw32-gcc\n" );\r
        fprintf ( fMakefile, "ld = mingw32-ld\n" );\r
        fprintf ( fMakefile, "ar = mingw32-ar\n" );\r
+       fprintf ( fMakefile, "objcopy = mingw32-objcopy\n" );\r
        fprintf ( fMakefile, "dlltool = mingw32-dlltool\n" );\r
        fprintf ( fMakefile, "windres = mingw32-windres\n" );\r
 #endif\r
@@ -207,9 +211,12 @@ MingwBackend::GenerateAllTarget ()
        for ( size_t i = 0; i < ProjectNode.modules.size (); i++ )\r
        {\r
                Module& module = *ProjectNode.modules[i];\r
-               fprintf ( fMakefile,\r
-                         " %s",\r
-                         FixupTargetFilename ( module.GetPath () ).c_str () );\r
+               if ( module.type != ObjectLibrary )\r
+               {\r
+                       fprintf ( fMakefile,\r
+                                 " %s",\r
+                                 FixupTargetFilename ( module.GetPath () ).c_str () );\r
+               }\r
        }\r
        fprintf ( fMakefile, "\n\t\n\n" );\r
 }\r
index d750157..83bc666 100644 (file)
@@ -145,13 +145,19 @@ MingwModuleHandler::IsGeneratedFile ( const File& file ) const
        else\r
                return false;\r
 }\r
-       \r
+\r
+string\r
+MingwModuleHandler::GetImportLibraryDependency ( const Module& importedModule ) const\r
+{\r
+       if ( importedModule.type == ObjectLibrary )\r
+               return GetObjectsMacro ( importedModule );\r
+       else\r
+               return PassThruCacheDirectory ( FixupTargetFilename ( importedModule.GetDependencyPath () ) );\r
+}\r
+\r
 string\r
 MingwModuleHandler::GetImportLibraryDependencies ( const Module& module ) const\r
 {\r
-       if ( module.libraries.size () == 0 )\r
-               return "";\r
-       \r
        string dependencies ( "" );\r
        for ( size_t i = 0; i < module.libraries.size (); i++ )\r
        {\r
@@ -159,7 +165,7 @@ MingwModuleHandler::GetImportLibraryDependencies ( const Module& module ) const
                        dependencies += " ";\r
                const Module* importedModule = module.project.LocateModule ( module.libraries[i]->name );\r
                assert ( importedModule != NULL );\r
-               dependencies += PassThruCacheDirectory ( FixupTargetFilename ( importedModule->GetDependencyPath () ) ).c_str ();\r
+               dependencies += GetImportLibraryDependency ( *importedModule );\r
        }\r
        return dependencies;\r
 }\r
@@ -378,6 +384,20 @@ MingwModuleHandler::GenerateGccIncludeParameters ( const Module& module ) const
 }\r
 \r
 \r
+string\r
+MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags ) const\r
+{\r
+       string parameters;\r
+       for ( size_t i = 0; i < compilerFlags.size (); i++ )\r
+       {\r
+               CompilerFlag& compilerFlag = *compilerFlags[i];\r
+               if ( parameters.length () > 0 )\r
+                       parameters += " ";\r
+               parameters += compilerFlag.flag;\r
+       }\r
+       return parameters;\r
+}\r
+\r
 string\r
 MingwModuleHandler::GenerateLinkerParametersFromVector ( const vector<LinkerFlag*>& linkerFlags ) const\r
 {\r
@@ -402,7 +422,8 @@ void
 MingwModuleHandler::GenerateMacro ( const char* assignmentOperation,\r
                                     const string& macro,\r
                                     const vector<Include*>& includes,\r
-                                    const vector<Define*>& defines ) const\r
+                                    const vector<Define*>& defines,\r
+                                    const vector<CompilerFlag*>* compilerFlags ) const\r
 {\r
        size_t i;\r
 \r
@@ -411,6 +432,19 @@ MingwModuleHandler::GenerateMacro ( const char* assignmentOperation,
                "%s %s",\r
                macro.c_str(),\r
                assignmentOperation );\r
+       \r
+       if ( compilerFlags != NULL )\r
+       {\r
+               string compilerParameters = GenerateCompilerParametersFromVector ( *compilerFlags );\r
+               if ( compilerParameters.size () > 0 )\r
+               {\r
+                       fprintf (\r
+                               fMakefile,\r
+                               " %s",\r
+                               compilerParameters.c_str () );\r
+               }\r
+       }\r
+\r
        for ( i = 0; i < includes.size(); i++ )\r
        {\r
                fprintf (\r
@@ -440,6 +474,7 @@ MingwModuleHandler::GenerateMacros (
        const vector<File*>& files,\r
        const vector<Include*>& includes,\r
        const vector<Define*>& defines,\r
+       const vector<CompilerFlag*>* compilerFlags,\r
        const vector<LinkerFlag*>* linkerFlags,\r
        const vector<If*>& ifs,\r
        const string& cflags_macro,\r
@@ -455,11 +490,13 @@ MingwModuleHandler::GenerateMacros (
                GenerateMacro ( assignmentOperation,\r
                                cflags_macro,\r
                                includes,\r
-                               defines );\r
+                               defines,\r
+                               compilerFlags );\r
                GenerateMacro ( assignmentOperation,\r
                                windresflags_macro,\r
                                includes,\r
-                               defines );\r
+                               defines,\r
+                               compilerFlags );\r
        }\r
        \r
        if ( linkerFlags != NULL )\r
@@ -527,6 +564,7 @@ MingwModuleHandler::GenerateMacros (
                                rIf.includes,\r
                                rIf.defines,\r
                                NULL,\r
+                               NULL,\r
                                rIf.ifs,\r
                                cflags_macro,\r
                                nasmflags_macro,\r
@@ -554,6 +592,7 @@ MingwModuleHandler::GenerateMacros (
                module.files,\r
                module.includes,\r
                module.defines,\r
+               &module.compilerFlags,\r
                &module.linkerFlags,\r
                module.ifs,\r
                cflags_macro,\r
@@ -1225,6 +1264,7 @@ MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ( const Module& modul
                  archiveFilename.c_str () );\r
 }\r
 \r
+\r
 static MingwKernelModuleHandler kernelmodule_handler;\r
 \r
 MingwKernelModuleHandler::MingwKernelModuleHandler ()\r
@@ -1318,6 +1358,28 @@ MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ( const Modul
 }\r
 \r
 \r
+static MingwObjectLibraryModuleHandler objectlibrary_handler;\r
+\r
+MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler ()\r
+       : MingwModuleHandler ( ObjectLibrary )\r
+{\r
+}\r
+\r
+void\r
+MingwObjectLibraryModuleHandler::Process ( const Module& module )\r
+{\r
+       GeneratePreconditionDependencies ( module );\r
+       GenerateObjectLibraryModuleTarget ( module );\r
+       GenerateInvocations ( module );\r
+}\r
+\r
+void\r
+MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ( const Module& module )\r
+{\r
+       GenerateMacrosAndTargetsTarget ( module );\r
+}\r
+\r
+\r
 static MingwKernelModeDLLModuleHandler kernelmodedll_handler;\r
 \r
 MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ()\r
@@ -1607,3 +1669,52 @@ MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ( const Module& module
                          target.c_str ());\r
        }\r
 }\r
+\r
+\r
+static MingwBootLoaderModuleHandler bootloadermodule_handler;\r
+\r
+MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler ()\r
+       : MingwModuleHandler ( BootLoader )\r
+{\r
+}\r
+\r
+void\r
+MingwBootLoaderModuleHandler::Process ( const Module& module )\r
+{\r
+       GeneratePreconditionDependencies ( module );\r
+       GenerateBootLoaderModuleTarget ( module );\r
+       GenerateInvocations ( module );\r
+}\r
+\r
+void\r
+MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ( const Module& module )\r
+{\r
+       static string ros_junk ( "$(ROS_TEMPORARY)" );\r
+       string targetName ( module.GetTargetName () );\r
+       string target ( FixupTargetFilename (module.GetPath ()) );\r
+       string workingDirectory = GetWorkingDirectory ();\r
+       string junk_tmp = ros_junk + module.name + ".junk.tmp";\r
+       string objectsMacro = GetObjectsMacro ( module );\r
+       string importLibraryDependencies = GetImportLibraryDependencies ( module );\r
+\r
+       GenerateMacrosAndTargetsTarget ( module );\r
+\r
+       fprintf ( fMakefile, "%s: %s %s\n",\r
+                 target.c_str (),\r
+                 objectsMacro.c_str (),\r
+                 importLibraryDependencies.c_str () );\r
+\r
+       fprintf ( fMakefile,\r
+                 "\t${ld} %s -N -Ttext=0x8000 -o %s %s %s\n",\r
+                 GetLinkerMacro ( module ).c_str (),\r
+                 junk_tmp.c_str (),\r
+                 objectsMacro.c_str (),\r
+                 importLibraryDependencies.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "\t${objcopy} -O binary %s %s\n",\r
+                 junk_tmp.c_str (),\r
+                 target.c_str () );\r
+       fprintf ( fMakefile,\r
+                 "\t${rm} %s\n",\r
+                 junk_tmp.c_str () );\r
+}\r
index 93c7d3a..591b3ad 100644 (file)
@@ -29,6 +29,7 @@ protected:
        std::string GetActualSourceFilename ( const std::string& filename ) const;\r
        std::string GetModuleArchiveFilename ( const Module& module ) const;\r
        bool IsGeneratedFile ( const File& file ) const;\r
+       std::string GetImportLibraryDependency ( const Module& importedModule ) const;\r
        std::string GetImportLibraryDependencies ( const Module& module ) const;\r
        std::string GetModuleDependencies ( const Module& module ) const;\r
        std::string GetAllDependencies ( const Module& module ) const;\r
@@ -65,16 +66,19 @@ private:
        std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;\r
        std::string GenerateGccDefineParameters ( const Module& module ) const;\r
        std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;\r
+       std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const;\r
        std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;\r
        std::string GenerateLinkerParameters ( const Module& module ) const;\r
        void GenerateMacro ( const char* assignmentOperation,\r
                             const std::string& macro,\r
                             const std::vector<Include*>& includes,\r
-                            const std::vector<Define*>& defines ) const;\r
+                            const std::vector<Define*>& defines,\r
+                            const std::vector<CompilerFlag*>* compilerFlags ) const;\r
        void GenerateMacros ( const char* op,\r
                              const std::vector<File*>& files,\r
                              const std::vector<Include*>& includes,\r
                              const std::vector<Define*>& defines,\r
+                             const std::vector<CompilerFlag*>* compilerFlags,\r
                              const std::vector<LinkerFlag*>* linkerFlags,\r
                              const std::vector<If*>& ifs,\r
                              const std::string& cflags_macro,\r
@@ -170,6 +174,16 @@ private:
 };\r
 \r
 \r
+class MingwObjectLibraryModuleHandler : public MingwModuleHandler\r
+{\r
+public:\r
+       MingwObjectLibraryModuleHandler ();\r
+       virtual void Process ( const Module& module );\r
+private:\r
+       void GenerateObjectLibraryModuleTarget ( const Module& module );\r
+};\r
+\r
+\r
 class MingwKernelModeDLLModuleHandler : public MingwModuleHandler\r
 {\r
 public:\r
@@ -220,4 +234,14 @@ private:
        void GenerateWin32GUIModuleTarget ( const Module& module );\r
 };\r
 \r
+\r
+class MingwBootLoaderModuleHandler : public MingwModuleHandler\r
+{\r
+public:\r
+       MingwBootLoaderModuleHandler ();\r
+       virtual void Process ( const Module& module );\r
+private:\r
+       void GenerateBootLoaderModuleTarget ( const Module& module );\r
+};\r
+\r
 #endif /* MINGW_MODULEHANDLER_H */\r
diff --git a/reactos/tools/rbuild/compilerflag.cpp b/reactos/tools/rbuild/compilerflag.cpp
new file mode 100644 (file)
index 0000000..2a2f051
--- /dev/null
@@ -0,0 +1,47 @@
+#include "pch.h"\r
+#include <assert.h>\r
+\r
+#include "rbuild.h"\r
+\r
+using std::string;\r
+using std::vector;\r
+\r
+CompilerFlag::CompilerFlag ( const Project& project_,\r
+                             const XMLElement& compilerFlagNode )\r
+       : project(project_),\r
+         module(NULL),\r
+         node(compilerFlagNode)\r
+{\r
+       Initialize();\r
+}\r
+\r
+CompilerFlag::CompilerFlag ( const Project& project_,\r
+                                const Module* module_,\r
+                                const XMLElement& compilerFlagNode )\r
+       : project(project_),\r
+         module(module_),\r
+         node(compilerFlagNode)\r
+{\r
+       Initialize();\r
+}\r
+\r
+CompilerFlag::~CompilerFlag ()\r
+{\r
+}\r
+\r
+void\r
+CompilerFlag::Initialize ()\r
+{\r
+}\r
+\r
+void\r
+CompilerFlag::ProcessXML ()\r
+{\r
+       if (node.value.size () == 0)\r
+       {\r
+               throw InvalidBuildFileException (\r
+                       node.location,\r
+                       "<compilerflag> is empty." );\r
+       }\r
+       flag = node.value;\r
+}\r
index ff1d057..db6c83e 100644 (file)
@@ -17,6 +17,7 @@ BACKEND_BASE_OBJECTS = \
 \r
 BASE_OBJECTS = \\r
        $(BACKEND_BASE_OBJECTS) \\r
+       compilerflag.o \\r
        define.o \\r
        exception.o \\r
        include.o \\r
index 301180c..fdd1b9c 100644 (file)
@@ -1,5 +1,3 @@
-// module.cpp\r
-\r
 #include "pch.h"\r
 #include <assert.h>\r
 \r
@@ -74,6 +72,8 @@ Module::~Module ()
                delete dependencies[i];\r
        for ( i = 0; i < ifs.size(); i++ )\r
                delete ifs[i];\r
+       for ( i = 0; i < compilerFlags.size(); i++ )\r
+               delete compilerFlags[i];\r
        for ( i = 0; i < linkerFlags.size(); i++ )\r
                delete linkerFlags[i];\r
 }\r
@@ -98,6 +98,8 @@ Module::ProcessXML()
                dependencies[i]->ProcessXML ();\r
        for ( i = 0; i < ifs.size(); i++ )\r
                ifs[i]->ProcessXML();\r
+       for ( i = 0; i < compilerFlags.size(); i++ )\r
+               compilerFlags[i]->ProcessXML();\r
        for ( i = 0; i < linkerFlags.size(); i++ )\r
                linkerFlags[i]->ProcessXML();\r
 }\r
@@ -203,6 +205,11 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
                        ifs.push_back ( pIf );\r
                subs_invalid = false;\r
        }\r
+       else if ( e.name == "compilerflag" )\r
+       {\r
+               compilerFlags.push_back ( new CompilerFlag ( project, this, e ) );\r
+               subs_invalid = true;\r
+       }\r
        else if ( e.name == "linkerflag" )\r
        {\r
                linkerFlags.push_back ( new LinkerFlag ( project, this, e ) );\r
@@ -230,6 +237,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
                return BuildTool;\r
        if ( attribute.value == "staticlibrary" )\r
                return StaticLibrary;\r
+       if ( attribute.value == "objectlibrary" )\r
+               return ObjectLibrary;\r
        if ( attribute.value == "kernel" )\r
                return Kernel;\r
        if ( attribute.value == "kernelmodedll" )\r
@@ -242,6 +251,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
                return Win32DLL;\r
        if ( attribute.value == "win32gui" )\r
                return Win32GUI;\r
+       if ( attribute.value == "bootloader" )\r
+               return BootLoader;\r
        throw InvalidAttributeValueException ( location,\r
                                               attribute.name,\r
                                               attribute.value );\r
@@ -256,6 +267,8 @@ Module::GetDefaultModuleExtension () const
                        return EXEPOSTFIX;\r
                case StaticLibrary:\r
                        return ".a";\r
+               case ObjectLibrary:\r
+                       return ".o";\r
                case Kernel:\r
                case Win32GUI:\r
                        return ".exe";\r
@@ -264,6 +277,7 @@ Module::GetDefaultModuleExtension () const
                case Win32DLL:\r
                        return ".dll";\r
                case KernelModeDriver:\r
+               case BootLoader:\r
                        return ".sys";\r
        }\r
        throw InvalidOperationException ( __FILE__,\r
index 176d0d1..e06baf7 100644 (file)
@@ -32,6 +32,7 @@ class InvokeFile;
 class Dependency;\r
 class ImportLibrary;\r
 class If;\r
+class CompilerFlag;\r
 class LinkerFlag;\r
 class Property;\r
 \r
@@ -71,12 +72,14 @@ enum ModuleType
 {\r
        BuildTool,\r
        StaticLibrary,\r
+       ObjectLibrary,\r
        Kernel,\r
        KernelModeDLL,\r
        KernelModeDriver,\r
        NativeDLL,\r
        Win32DLL,\r
-       Win32GUI\r
+       Win32GUI,\r
+       BootLoader\r
 };\r
 \r
 \r
@@ -97,6 +100,7 @@ public:
        std::vector<Invoke*> invocations;\r
        std::vector<Dependency*> dependencies;\r
        std::vector<If*> ifs;\r
+       std::vector<CompilerFlag*> compilerFlags;\r
        std::vector<LinkerFlag*> linkerFlags;\r
 \r
        Module ( const Project& project,\r
@@ -277,6 +281,26 @@ public:
 };\r
 \r
 \r
+class CompilerFlag\r
+{\r
+public:\r
+       const Project& project;\r
+       const Module* module;\r
+       const XMLElement& node;\r
+       std::string flag;\r
+\r
+       CompilerFlag ( const Project& project,\r
+                      const XMLElement& compilerFlagNode );\r
+       CompilerFlag ( const Project& project,\r
+                      const Module* module,\r
+                      const XMLElement& compilerFlagNode );\r
+       ~CompilerFlag ();\r
+       void ProcessXML();\r
+private:\r
+       void Initialize();\r
+};\r
+\r
+\r
 class LinkerFlag\r
 {\r
 public:\r