mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 22:32:58 +00:00
* Keep project level includes and defines in PROJECT_CFLAGS
* Win32dll module type support * Build kernel32.dll svn path=/branches/xmlbuildsystem/; revision=12985
This commit is contained in:
parent
a868feb94a
commit
37ff0b66b5
10 changed files with 245 additions and 16 deletions
|
@ -1,3 +1,6 @@
|
|||
<directory name="kernel32">
|
||||
<xi:include href="kernel32/kernel32.xml" />
|
||||
</directory>
|
||||
<directory name="kjs">
|
||||
<xi:include href="kjs/kjs.xml" />
|
||||
</directory>
|
||||
|
|
107
reactos/lib/kernel32/kernel32.xml
Normal file
107
reactos/lib/kernel32/kernel32.xml
Normal file
|
@ -0,0 +1,107 @@
|
|||
<module name="kernel32" type="win32dll">
|
||||
<importlibrary definition="kernel32.def" />
|
||||
<include base="kernel32">.</include>
|
||||
<include base="kernel32">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="_SEH_NO_NATIVE_NLG" />
|
||||
<library>pseh</library>
|
||||
<library>rosrtl</library>
|
||||
<library>ntdll</library>
|
||||
<directory name="debug">
|
||||
<file>break.c</file>
|
||||
<file>debugger.c</file>
|
||||
<file>output.c</file>
|
||||
</directory>
|
||||
<directory name="except">
|
||||
<file>except.c</file>
|
||||
</directory>
|
||||
<directory name="file">
|
||||
<file>backup.c</file>
|
||||
<file>bintype.c</file>
|
||||
<file>cnotify.c</file>
|
||||
<file>copy.c</file>
|
||||
<file>create.c</file>
|
||||
<file>curdir.c</file>
|
||||
<file>delete.c</file>
|
||||
<file>deviceio.c</file>
|
||||
<file>dir.c</file>
|
||||
<file>dosdev.c</file>
|
||||
<file>file.c</file>
|
||||
<file>find.c</file>
|
||||
<file>hardlink.c</file>
|
||||
<file>iocompl.c</file>
|
||||
<file>lfile.c</file>
|
||||
<file>lock.c</file>
|
||||
<file>mailslot.c</file>
|
||||
<file>move.c</file>
|
||||
<file>npipe.c</file>
|
||||
<file>pipe.c</file>
|
||||
<file>rw.c</file>
|
||||
<file>tape.c</file>
|
||||
<file>volume.c</file>
|
||||
</directory>
|
||||
<directory name="mem">
|
||||
<file>global.c</file>
|
||||
<file>heap.c</file>
|
||||
<file>isbad.c</file>
|
||||
<file>local.c</file>
|
||||
<file>procmem.c</file>
|
||||
<file>resnotify.c</file>
|
||||
<file>section.c</file>
|
||||
<file>virtual.c</file>
|
||||
</directory>
|
||||
<directory name="misc">
|
||||
<file>atom.c</file>
|
||||
<file>chartype.c</file>
|
||||
<file>comm.c</file>
|
||||
<file>computername.c</file>
|
||||
<file>console.c</file>
|
||||
<file>dllmain.c</file>
|
||||
<file>env.c</file>
|
||||
<file>error.c</file>
|
||||
<file>errormsg.c</file>
|
||||
<file>handle.c</file>
|
||||
<file>lang.c</file>
|
||||
<file>lcformat.c</file>
|
||||
<file>ldr.c</file>
|
||||
<file>lzexpand_main.c</file>
|
||||
<file>muldiv.c</file>
|
||||
<file>nls.c</file>
|
||||
<file>perfcnt.c</file>
|
||||
<file>profile.c</file>
|
||||
<file>res.c</file>
|
||||
<file>stubs.c</file>
|
||||
<file>sysinfo.c</file>
|
||||
<file>time.c</file>
|
||||
<file>timerqueue.c</file>
|
||||
<file>toolhelp.c</file>
|
||||
</directory>
|
||||
<directory name="process">
|
||||
<file>cmdline.c</file>
|
||||
<file>create.c</file>
|
||||
<file>job.c</file>
|
||||
<file>proc.c</file>
|
||||
<file>session.c</file>
|
||||
</directory>
|
||||
<directory name="string">
|
||||
<file>lstring.c</file>
|
||||
</directory>
|
||||
<directory name="synch">
|
||||
<file>critical.c</file>
|
||||
<file>event.c</file>
|
||||
<file>intrlck.c</file>
|
||||
<file>mutex.c</file>
|
||||
<file>sem.c</file>
|
||||
<file>timer.c</file>
|
||||
<file>wait.c</file>
|
||||
</directory>
|
||||
<directory name="thread">
|
||||
<directory name="i386">
|
||||
<file>fiber.S</file>
|
||||
</directory>
|
||||
<file>fiber.c</file>
|
||||
<file>fls.c</file>
|
||||
<file>thread.c</file>
|
||||
<file>tls.c</file>
|
||||
</directory>
|
||||
</module>
|
|
@ -17,7 +17,7 @@ TARGET_LFLAGS = -nostartfiles -nostdlib
|
|||
|
||||
TARGET_RCFLAGS += -DWINVER=0x0500
|
||||
|
||||
TARGET_SDKLIBS = pseh.a rosrtl.a ntdll.a kernel32.a
|
||||
TARGET_SDKLIBS = pseh.a rosrtl.a ntdll.a
|
||||
|
||||
TARGET_GCCLIBS = gcc
|
||||
|
||||
|
|
|
@ -32,6 +32,17 @@
|
|||
#define NDEBUG
|
||||
#include "../include/debug.h"
|
||||
|
||||
PVOID WINAPI HeapAlloc(HANDLE hHeap, DWORD dwFlags, DWORD dwBytes)
|
||||
{
|
||||
return RtlAllocateHeap(hHeap, dwFlags, dwBytes);
|
||||
}
|
||||
|
||||
BOOL WINAPI HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem)
|
||||
{
|
||||
return RtlFreeHeap(hHeap, dwFlags, lpMem);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* HeapCreate -- KERNEL32 *
|
||||
*********************************************************************/
|
||||
|
|
|
@ -59,6 +59,33 @@ MingwBackend::GenerateHeader ()
|
|||
fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" );
|
||||
}
|
||||
|
||||
string
|
||||
MingwBackend::GenerateProjectCFLAGS ()
|
||||
{
|
||||
string clags;
|
||||
for ( size_t i = 0; i < ProjectNode.includes.size (); i++ )
|
||||
{
|
||||
Include& include = *ProjectNode.includes[i];
|
||||
if (clags.length () > 0)
|
||||
clags += " ";
|
||||
clags += "-I" + include.directory;
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < ProjectNode.defines.size (); i++ )
|
||||
{
|
||||
Define& define = *ProjectNode.defines[i];
|
||||
if ( clags.length () > 0 )
|
||||
clags += " ";
|
||||
clags += "-D" + define.name;
|
||||
if ( define.value.size() > 0 )
|
||||
{
|
||||
clags += "=";
|
||||
clags += define.value;
|
||||
}
|
||||
}
|
||||
return clags;
|
||||
}
|
||||
|
||||
void
|
||||
MingwBackend::GenerateGlobalVariables ()
|
||||
{
|
||||
|
@ -70,6 +97,7 @@ MingwBackend::GenerateGlobalVariables ()
|
|||
fprintf ( fMakefile, "ld = ld\n" );
|
||||
fprintf ( fMakefile, "ar = ar\n" );
|
||||
fprintf ( fMakefile, "dlltool = dlltool\n" );
|
||||
fprintf ( fMakefile, "PROJECT_CFLAGS = %s\n", GenerateProjectCFLAGS ().c_str () );
|
||||
fprintf ( fMakefile, "\n" );
|
||||
}
|
||||
|
||||
|
@ -82,7 +110,7 @@ MingwBackend::GenerateAllTarget ()
|
|||
Module& module = *ProjectNode.modules[i];
|
||||
fprintf ( fMakefile,
|
||||
" %s",
|
||||
FixupTargetFilename( module.GetPath () ).c_str () );
|
||||
FixupTargetFilename ( module.GetPath () ).c_str () );
|
||||
}
|
||||
fprintf ( fMakefile, "\n\t\n\n" );
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ private:
|
|||
void CreateMakefile ();
|
||||
void CloseMakefile ();
|
||||
void GenerateHeader ();
|
||||
std::string GenerateProjectCFLAGS ();
|
||||
void GenerateGlobalVariables ();
|
||||
void GenerateAllTarget ();
|
||||
FILE* fMakefile;
|
||||
|
|
|
@ -395,6 +395,11 @@ MingwModuleHandler::GenerateMacros (
|
|||
"endif\n\n" );
|
||||
}
|
||||
}
|
||||
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s_CFLAGS += $(PROJECT_CFLAGS)\n\n",
|
||||
module.name.c_str () );
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -939,3 +944,64 @@ MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ( const Module& modul
|
|||
target.c_str ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static MingwWin32DLLModuleHandler win32dll_handler;
|
||||
|
||||
MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler ()
|
||||
: MingwModuleHandler ( Win32DLL )
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
MingwWin32DLLModuleHandler::Process ( const Module& module )
|
||||
{
|
||||
GeneratePreconditionDependencies ( module );
|
||||
GenerateWin32DLLModuleTarget ( module );
|
||||
GenerateInvocations ( module );
|
||||
}
|
||||
|
||||
void
|
||||
MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module )
|
||||
{
|
||||
static string ros_junk ( "$(ROS_TEMPORARY)" );
|
||||
string target ( FixupTargetFilename ( module.GetPath () ) );
|
||||
string workingDirectory = GetWorkingDirectory ( );
|
||||
string archiveFilename = GetModuleArchiveFilename ( module );
|
||||
string importLibraryDependencies = GetImportLibraryDependencies ( module );
|
||||
|
||||
if (module.importLibrary != NULL)
|
||||
{
|
||||
fprintf ( fMakefile, "%s:\n",
|
||||
module.GetDependencyPath ().c_str () );
|
||||
|
||||
fprintf ( fMakefile,
|
||||
"\t${dlltool} --dllname %s --def %s --output-lib %s --kill-at\n\n",
|
||||
module.GetTargetName ().c_str (),
|
||||
FixupTargetFilename ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (),
|
||||
FixupTargetFilename ( module.GetDependencyPath () ).c_str () );
|
||||
}
|
||||
|
||||
if (module.files.size () > 0)
|
||||
{
|
||||
fprintf ( fMakefile, "%s: %s %s\n",
|
||||
target.c_str (),
|
||||
archiveFilename.c_str (),
|
||||
importLibraryDependencies.c_str () );
|
||||
|
||||
fprintf ( fMakefile,
|
||||
"\t${gcc} -Wl,--subsystem,console -Wl,--entry,_DllMain@12 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll -o %s %s %s\n",
|
||||
target.c_str (),
|
||||
archiveFilename.c_str (),
|
||||
importLibraryDependencies.c_str () );
|
||||
|
||||
GenerateMacrosAndTargetsTarget ( module );
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf ( fMakefile, "%s:\n\n",
|
||||
target.c_str ());
|
||||
fprintf ( fMakefile, ".PHONY: %s\n\n",
|
||||
target.c_str ());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,4 +147,14 @@ private:
|
|||
void GenerateNativeDLLModuleTarget ( const Module& module );
|
||||
};
|
||||
|
||||
|
||||
class MingwWin32DLLModuleHandler : public MingwModuleHandler
|
||||
{
|
||||
public:
|
||||
MingwWin32DLLModuleHandler ();
|
||||
virtual void Process ( const Module& module );
|
||||
private:
|
||||
void GenerateWin32DLLModuleTarget ( const Module& module );
|
||||
};
|
||||
|
||||
#endif /* MINGW_MODULEHANDLER_H */
|
||||
|
|
|
@ -197,6 +197,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
|
|||
return KernelModeDLL;
|
||||
if ( attribute.value == "nativedll" )
|
||||
return NativeDLL;
|
||||
if ( attribute.value == "win32dll" )
|
||||
return Win32DLL;
|
||||
throw InvalidAttributeValueException ( location,
|
||||
attribute.name,
|
||||
attribute.value );
|
||||
|
@ -214,12 +216,18 @@ Module::GetDefaultModuleExtension () const
|
|||
case Kernel:
|
||||
return ".exe";
|
||||
case KernelModeDLL:
|
||||
return ".dll";
|
||||
case NativeDLL:
|
||||
case Win32DLL:
|
||||
return ".dll";
|
||||
}
|
||||
throw InvalidOperationException (__FILE__,
|
||||
__LINE__);
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__ );
|
||||
}
|
||||
|
||||
bool
|
||||
Module::HasImportLibrary () const
|
||||
{
|
||||
return importLibrary != NULL;
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -231,23 +239,16 @@ Module::GetTargetName () const
|
|||
string
|
||||
Module::GetDependencyPath () const
|
||||
{
|
||||
switch ( type )
|
||||
if ( HasImportLibrary () )
|
||||
{
|
||||
case KernelModeDLL:
|
||||
return ssprintf ( "dk%snkm%slib%slib%s.a",
|
||||
SSEP,
|
||||
SSEP,
|
||||
SSEP,
|
||||
name.c_str () );
|
||||
case NativeDLL:
|
||||
return ssprintf ( "dk%sw32%slib%slib%s.a",
|
||||
SSEP,
|
||||
SSEP,
|
||||
SSEP,
|
||||
name.c_str () );
|
||||
default:
|
||||
return GetPath();
|
||||
}
|
||||
else
|
||||
return GetPath();
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -67,7 +67,8 @@ enum ModuleType
|
|||
StaticLibrary,
|
||||
Kernel,
|
||||
KernelModeDLL,
|
||||
NativeDLL
|
||||
NativeDLL,
|
||||
Win32DLL
|
||||
};
|
||||
|
||||
|
||||
|
@ -95,6 +96,7 @@ public:
|
|||
~Module ();
|
||||
ModuleType GetModuleType ( const std::string& location,
|
||||
const XMLAttribute& attribute );
|
||||
bool HasImportLibrary () const;
|
||||
std::string GetTargetName () const;
|
||||
std::string GetDependencyPath () const;
|
||||
std::string GetBasePath() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue