* Build ntvdm

* Add win32cui module type support


svn path=/branches/xmlbuildsystem/; revision=13426
This commit is contained in:
Casper Hornstrup 2005-02-05 19:16:14 +00:00
parent 56ff0d9653
commit 75df7c5bca
6 changed files with 85 additions and 2 deletions

View file

@ -1,6 +1,9 @@
<directory name="csrss"> <directory name="csrss">
<xi:include href="csrss/csrss.xml" /> <xi:include href="csrss/csrss.xml" />
</directory> </directory>
<directory name="ntvdm">
<xi:include href="ntvdm/ntvdm.xml" />
</directory>
<directory name="system"> <directory name="system">
<xi:include href="system/directory.xml" /> <xi:include href="system/directory.xml" />
</directory> </directory>

View file

@ -0,0 +1,12 @@
<module name="ntvdm" type="win32cui">
<include base="ntvdm">.</include>
<define name="__USE_W32API" />
<define name="_DISABLE_TIDENTS" />
<library>ntdll</library>
<library>kernel32</library>
<library>user32</library>
<library>gdi32</library>
<library>advapi32</library>
<file>ntvdm.c</file>
<file>ntvdm.rc</file>
</module>

View file

@ -1720,6 +1720,58 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module
} }
static MingwWin32CUIModuleHandler win32cui_handler;
MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler ()
: MingwModuleHandler ( Win32CUI )
{
}
void
MingwWin32CUIModuleHandler::Process ( const Module& module )
{
GeneratePreconditionDependencies ( module );
GenerateWin32CUIModuleTarget ( module );
GenerateInvocations ( module );
}
void
MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ( const Module& module )
{
static string ros_junk ( "$(ROS_TEMPORARY)" );
string target ( FixupTargetFilename ( module.GetPath () ) );
string workingDirectory = GetWorkingDirectory ( );
string objectFilenames = GetObjectFilenames ( module );
string importLibraryDependencies = GetImportLibraryDependencies ( module );
GenerateImportLibraryTargetIfNeeded ( module );
if ( module.files.size () > 0 )
{
GenerateMacrosAndTargetsTarget ( module );
fprintf ( fMakefile, "%s: %s %s\n",
target.c_str (),
objectFilenames.c_str (),
importLibraryDependencies.c_str () );
string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,0x00400000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
module.entrypoint.c_str () );
GenerateLinkerCommand ( module,
"${gcc}",
linkerParameters,
objectFilenames );
}
else
{
fprintf ( fMakefile, ".PHONY: %s\n\n",
target.c_str ());
fprintf ( fMakefile, "%s:\n\n",
target.c_str ());
}
}
static MingwWin32GUIModuleHandler win32gui_handler; static MingwWin32GUIModuleHandler win32gui_handler;
MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler () MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler ()

View file

@ -243,6 +243,16 @@ private:
}; };
class MingwWin32CUIModuleHandler : public MingwModuleHandler
{
public:
MingwWin32CUIModuleHandler ();
virtual void Process ( const Module& module );
private:
void GenerateWin32CUIModuleTarget ( const Module& module );
};
class MingwWin32GUIModuleHandler : public MingwModuleHandler class MingwWin32GUIModuleHandler : public MingwModuleHandler
{ {
public: public:

View file

@ -275,6 +275,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
return NativeCUI; return NativeCUI;
if ( attribute.value == "win32dll" ) if ( attribute.value == "win32dll" )
return Win32DLL; return Win32DLL;
if ( attribute.value == "win32cui" )
return Win32CUI;
if ( attribute.value == "win32gui" ) if ( attribute.value == "win32gui" )
return Win32GUI; return Win32GUI;
if ( attribute.value == "bootloader" ) if ( attribute.value == "bootloader" )
@ -301,6 +303,7 @@ Module::GetDefaultModuleExtension () const
return ".o"; return ".o";
case Kernel: case Kernel:
case NativeCUI: case NativeCUI:
case Win32CUI:
case Win32GUI: case Win32GUI:
return ".exe"; return ".exe";
case KernelModeDLL: case KernelModeDLL:
@ -326,8 +329,6 @@ Module::GetDefaultModuleEntrypoint () const
{ {
case Kernel: case Kernel:
return "_NtProcessStartup"; return "_NtProcessStartup";
case Win32GUI:
return "_WinMainCRTStartup";
case KernelModeDLL: case KernelModeDLL:
return "_DriverEntry@8"; return "_DriverEntry@8";
case NativeDLL: case NativeDLL:
@ -336,6 +337,10 @@ Module::GetDefaultModuleEntrypoint () const
return "_NtProcessStartup@4"; return "_NtProcessStartup@4";
case Win32DLL: case Win32DLL:
return "_DllMain@12"; return "_DllMain@12";
case Win32CUI:
return "_mainCRTStartup";
case Win32GUI:
return "_WinMainCRTStartup";
case KernelModeDriver: case KernelModeDriver:
return "_DriverEntry@8"; return "_DriverEntry@8";
case BuildTool: case BuildTool:

View file

@ -93,6 +93,7 @@ enum ModuleType
NativeDLL, NativeDLL,
NativeCUI, NativeCUI,
Win32DLL, Win32DLL,
Win32CUI,
Win32GUI, Win32GUI,
BootLoader, BootLoader,
BootSector, BootSector,