* Keep project level includes and defines in PROJECT_CFLAGS * Win32dll module type support * Build kernel32.dll Modified: branches/xmlbuildsystem/reactos/lib/directory.xml Added: branches/xmlbuildsystem/reactos/lib/kernel32/kernel32.xml Modified: branches/xmlbuildsystem/reactos/lib/kernel32/makefile Modified: branches/xmlbuildsystem/reactos/lib/kernel32/mem/heap.c Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h _____
Modified: branches/xmlbuildsystem/reactos/lib/directory.xml --- branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-12 19:42:07 UTC (rev 12985) @@ -1,3 +1,6 @@
+<directory name="kernel32"> + <xi:include href="kernel32/kernel32.xml" /> +</directory> <directory name="kjs"> <xi:include href="kjs/kjs.xml" /> </directory> _____
Added: branches/xmlbuildsystem/reactos/lib/kernel32/kernel32.xml --- branches/xmlbuildsystem/reactos/lib/kernel32/kernel32.xml 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/lib/kernel32/kernel32.xml 2005-01-12 19:42:07 UTC (rev 12985) @@ -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> _____
Modified: branches/xmlbuildsystem/reactos/lib/kernel32/makefile --- branches/xmlbuildsystem/reactos/lib/kernel32/makefile 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/lib/kernel32/makefile 2005-01-12 19:42:07 UTC (rev 12985) @@ -17,7 +17,7 @@
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
_____
Modified: branches/xmlbuildsystem/reactos/lib/kernel32/mem/heap.c --- branches/xmlbuildsystem/reactos/lib/kernel32/mem/heap.c 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/lib/kernel32/mem/heap.c 2005-01-12 19:42:07 UTC (rev 12985) @@ -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 * *********************************************************************/ _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-12 19:42:07 UTC (rev 12985) @@ -59,6 +59,33 @@
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 @@ 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 @@ Module& module = *ProjectNode.modules[i]; fprintf ( fMakefile, " %s", - FixupTargetFilename( module.GetPath () ).c_str () ); + FixupTargetFilename ( module.GetPath () ).c_str () ); } fprintf ( fMakefile, "\n\t\n\n" ); } _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-12 19:42:07 UTC (rev 12985) @@ -14,6 +14,7 @@
void CreateMakefile (); void CloseMakefile (); void GenerateHeader (); + std::string GenerateProjectCFLAGS (); void GenerateGlobalVariables (); void GenerateAllTarget (); FILE* fMakefile; _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-12 19:42:07 UTC (rev 12985) @@ -395,6 +395,11 @@
"endif\n\n" ); } } + + fprintf ( + fMakefile, + "%s_CFLAGS += $(PROJECT_CFLAGS)\n\n", + module.name.c_str () ); }
string @@ -939,3 +944,64 @@ 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 ()); + } +} _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-12 19:42:07 UTC (rev 12985) @@ -147,4 +147,14 @@
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 */ _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-12 19:42:07 UTC (rev 12985) @@ -197,6 +197,8 @@
return KernelModeDLL; if ( attribute.value == "nativedll" ) return NativeDLL; + if ( attribute.value == "win32dll" ) + return Win32DLL; throw InvalidAttributeValueException ( location, attribute.name, attribute.value ); @@ -214,14 +216,20 @@ 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 Module::GetTargetName () const { @@ -231,23 +239,16 @@ 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: + } + else return GetPath(); - } }
string _____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-12 19:31:38 UTC (rev 12984) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-12 19:42:07 UTC (rev 12985) @@ -67,7 +67,8 @@
StaticLibrary, Kernel, KernelModeDLL, - NativeDLL + NativeDLL, + Win32DLL };
@@ -95,6 +96,7 @@ ~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;