2 * Copyright (C) 2005 Casper S. Hornstrup
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 #include "../../pch.h"
21 #include "../../rbuild.h"
23 #include "modulehandler.h"
28 #define CLEAN_FILE(f) clean_files.push_back ( f );
30 static string ros_temp
= "$(TEMPORARY)";
32 MingwModuleHandler::backend
= NULL
;
34 MingwModuleHandler::fMakefile
= NULL
;
38 const string
& filename
,
39 const string
& prefix
)
41 if ( !prefix
.length() )
44 const char* pfilename
= filename
.c_str();
45 const char* p1
= strrchr ( pfilename
, '/' );
46 const char* p2
= strrchr ( pfilename
, '\\' );
51 out
+= string(pfilename
,p1
-pfilename
) + cSep
;
54 out
+= prefix
+ pfilename
;
59 GetTargetMacro ( const Module
& module
, bool with_dollar
)
61 string
s ( module
.name
);
65 return ssprintf ( "$(%s)", s
.c_str() );
69 MingwModuleHandler::MingwModuleHandler (
70 const Module
& module_
)
77 MingwModuleHandler::~MingwModuleHandler()
82 MingwModuleHandler::SetBackend ( MingwBackend
* backend_
)
88 MingwModuleHandler::SetMakefile ( FILE* f
)
94 MingwModuleHandler::EnablePreCompiledHeaderSupport ()
100 MingwModuleHandler::RemoveVariables ( string path
)
102 size_t i
= path
.find ( '$' );
103 if ( i
!= string::npos
)
105 size_t j
= path
.find ( ')', i
);
106 if ( j
!= string::npos
)
108 if ( j
+ 2 < path
.length () && path
[j
+ 1] == cSep
)
109 return path
.substr ( j
+ 2);
111 return path
.substr ( j
+ 1);
118 MingwModuleHandler::PassThruCacheDirectory (
120 Directory
* directoryTree
)
122 string
directory ( GetDirectory ( RemoveVariables ( file
) ) );
123 if ( directoryTree
== NULL
)
125 string generatedFilesDirectory
= backend
->AddDirectoryTarget ( directory
,
127 if ( directory
.find ( generatedFilesDirectory
) != string::npos
)
128 /* This path already includes the generated files directory variable */
133 return generatedFilesDirectory
;
134 return generatedFilesDirectory
+ sSep
+ file
;
139 MingwModuleHandler::PassThruCacheDirectory (const FileLocation
* fileLocation
)
141 return PassThruCacheDirectory ( fileLocation
->filename
,
142 fileLocation
->directory
);
145 /*static*/ Directory
*
146 MingwModuleHandler::GetTargetDirectoryTree (
147 const Module
& module
)
149 if ( module
.type
== StaticLibrary
)
150 return backend
->intermediateDirectory
;
151 return backend
->outputDirectory
;
155 MingwModuleHandler::GetTargetFilename (
156 const Module
& module
,
157 string_list
* pclean_files
)
159 string target
= PassThruCacheDirectory (
160 NormalizeFilename ( module
.GetPath () ),
161 GetTargetDirectoryTree ( module
) );
164 string_list
& clean_files
= *pclean_files
;
165 CLEAN_FILE ( target
);
171 MingwModuleHandler::GetImportLibraryFilename (
172 const Module
& module
,
173 string_list
* pclean_files
)
175 string target
= PassThruCacheDirectory (
176 NormalizeFilename ( module
.GetDependencyPath () ),
177 backend
->intermediateDirectory
);
180 string_list
& clean_files
= *pclean_files
;
181 CLEAN_FILE ( target
);
186 /*static*/ MingwModuleHandler
*
187 MingwModuleHandler::InstanciateHandler (
188 const Module
& module
,
189 MingwBackend
* backend
)
191 MingwModuleHandler
* handler
;
192 switch ( module
.type
)
195 handler
= new MingwBuildToolModuleHandler ( module
);
198 handler
= new MingwStaticLibraryModuleHandler ( module
);
201 handler
= new MingwObjectLibraryModuleHandler ( module
);
204 handler
= new MingwKernelModuleHandler ( module
);
207 handler
= new MingwNativeCUIModuleHandler ( module
);
210 handler
= new MingwWin32CUIModuleHandler ( module
);
213 handler
= new MingwWin32GUIModuleHandler ( module
);
216 handler
= new MingwKernelModeDLLModuleHandler ( module
);
219 handler
= new MingwNativeDLLModuleHandler ( module
);
222 handler
= new MingwWin32DLLModuleHandler ( module
);
224 case KernelModeDriver
:
225 handler
= new MingwKernelModeDriverModuleHandler ( module
);
228 handler
= new MingwBootLoaderModuleHandler ( module
);
231 handler
= new MingwBootSectorModuleHandler ( module
);
234 handler
= new MingwBootProgramModuleHandler ( module
);
237 handler
= new MingwIsoModuleHandler ( module
);
240 handler
= new MingwLiveIsoModuleHandler ( module
);
243 handler
= new MingwTestModuleHandler ( module
);
246 handler
= new MingwRpcServerModuleHandler ( module
);
249 handler
= new MingwRpcClientModuleHandler ( module
);
252 handler
= new MingwAliasModuleHandler ( module
);
255 throw UnknownModuleTypeException (
256 module
.node
.location
,
264 MingwModuleHandler::GetWorkingDirectory () const
270 MingwModuleHandler::GetBasename ( const string
& filename
) const
272 size_t index
= filename
.find_last_of ( '.' );
273 if ( index
!= string::npos
)
274 return filename
.substr ( 0, index
);
279 MingwModuleHandler::GetActualSourceFilename (
280 const FileLocation
* fileLocation
) const
282 string filename
= fileLocation
->filename
;
283 string extension
= GetExtension ( filename
);
284 if ( extension
== ".spec" || extension
== ".SPEC" )
286 string basename
= GetBasename ( filename
);
287 PassThruCacheDirectory ( NormalizeFilename ( basename
+ ".stubs.c" ),
288 backend
->intermediateDirectory
);
289 return new FileLocation ( backend
->intermediateDirectory
, NormalizeFilename ( basename
+ ".stubs.c" ) );
291 else if ( extension
== ".idl" || extension
== ".IDL" )
293 string basename
= GetBasename ( filename
);
295 if ( module
.type
== RpcServer
)
296 newname
= basename
+ "_s.c";
298 newname
= basename
+ "_c.c";
299 PassThruCacheDirectory ( NormalizeFilename ( newname
),
300 backend
->intermediateDirectory
);
301 return new FileLocation ( backend
->intermediateDirectory
, NormalizeFilename ( newname
) );
304 return new FileLocation ( fileLocation
->directory
, filename
);
308 MingwModuleHandler::GetExtraDependencies (
309 const string
& filename
) const
311 string extension
= GetExtension ( filename
);
312 if ( extension
== ".idl" || extension
== ".IDL" )
314 string basename
= GetBasename ( filename
);
315 return GetRpcServerHeaderFilename ( basename
) + " " + GetRpcClientHeaderFilename ( basename
);
322 MingwModuleHandler::GetCompilationUnitDependencies (
323 const CompilationUnit
& compilationUnit
) const
325 if ( compilationUnit
.files
.size () <= 1 )
327 vector
<string
> sourceFiles
;
328 for ( size_t i
= 0; i
< compilationUnit
.files
.size (); i
++ )
330 File
& file
= *compilationUnit
.files
[i
];
331 sourceFiles
.push_back ( NormalizeFilename ( file
.name
) );
333 return v2s ( sourceFiles
, 10 );
337 MingwModuleHandler::GetModuleArchiveFilename () const
339 if ( module
.type
== StaticLibrary
)
340 return GetTargetFilename ( module
, NULL
);
341 return PassThruCacheDirectory ( ReplaceExtension (
342 NormalizeFilename ( module
.GetPath () ),
344 backend
->intermediateDirectory
);
348 MingwModuleHandler::IsGeneratedFile ( const File
& file
) const
350 string extension
= GetExtension ( file
.name
);
351 return ( extension
== ".spec" || extension
== ".SPEC" );
355 MingwModuleHandler::ReferenceObjects (
356 const Module
& module
)
358 if ( module
.type
== ObjectLibrary
)
360 if ( module
.type
== RpcServer
)
362 if ( module
.type
== RpcClient
)
368 MingwModuleHandler::GetImportLibraryDependency (
369 const Module
& importedModule
)
372 if ( ReferenceObjects ( importedModule
) )
373 dep
= GetTargetMacro ( importedModule
);
375 dep
= GetImportLibraryFilename ( importedModule
, NULL
);
380 MingwModuleHandler::GetTargets ( const Module
& dependencyModule
,
381 string_list
& targets
)
383 if ( dependencyModule
.invocations
.size () > 0 )
385 for ( size_t i
= 0; i
< dependencyModule
.invocations
.size (); i
++ )
387 Invoke
& invoke
= *dependencyModule
.invocations
[i
];
388 invoke
.GetTargets ( targets
);
392 targets
.push_back ( GetImportLibraryDependency ( dependencyModule
) );
396 MingwModuleHandler::GetModuleDependencies (
397 string_list
& dependencies
)
399 size_t iend
= module
.dependencies
.size ();
404 for ( size_t i
= 0; i
< iend
; i
++ )
406 const Dependency
& dependency
= *module
.dependencies
[i
];
407 const Module
& dependencyModule
= *dependency
.dependencyModule
;
408 GetTargets ( dependencyModule
,
411 GetDefinitionDependencies ( dependencies
);
415 MingwModuleHandler::GetSourceFilenames ( string_list
& list
,
416 bool includeGeneratedFiles
) const
420 const vector
<CompilationUnit
*>& compilationUnits
= module
.non_if_data
.compilationUnits
;
421 for ( i
= 0; i
< compilationUnits
.size (); i
++ )
423 if ( includeGeneratedFiles
|| !compilationUnits
[i
]->IsGeneratedFile () )
425 FileLocation
* sourceFileLocation
= GetActualSourceFilename (
426 compilationUnits
[i
]->GetFilename ( backend
->intermediateDirectory
) );
427 list
.push_back ( PassThruCacheDirectory ( sourceFileLocation
->filename
,
428 sourceFileLocation
->directory
) );
431 // intentionally make a copy so that we can append more work in
432 // the middle of processing without having to go recursive
433 vector
<If
*> v
= module
.non_if_data
.ifs
;
434 for ( i
= 0; i
< v
.size (); i
++ )
438 // check for sub-ifs to add to list
439 const vector
<If
*>& ifs
= rIf
.data
.ifs
;
440 for ( j
= 0; j
< ifs
.size (); j
++ )
441 v
.push_back ( ifs
[j
] );
442 const vector
<CompilationUnit
*>& compilationUnits
= rIf
.data
.compilationUnits
;
443 for ( j
= 0; j
< compilationUnits
.size (); j
++ )
445 CompilationUnit
& compilationUnit
= *compilationUnits
[j
];
446 if ( includeGeneratedFiles
|| !compilationUnit
.IsGeneratedFile () )
448 FileLocation
* sourceFileLocation
= GetActualSourceFilename (
449 compilationUnit
.GetFilename ( backend
->intermediateDirectory
) );
450 list
.push_back ( PassThruCacheDirectory ( sourceFileLocation
->filename
,
451 sourceFileLocation
->directory
) );
458 MingwModuleHandler::GetSourceFilenamesWithoutGeneratedFiles (
459 string_list
& list
) const
461 GetSourceFilenames ( list
, false );
465 MingwModuleHandler::GetObjectFilename (
466 const FileLocation
* sourceFileLocation
,
467 string_list
* pclean_files
) const
469 string sourceFilename
= sourceFileLocation
->filename
;
470 Directory
* directoryTree
;
472 string extension
= GetExtension ( sourceFilename
);
473 if ( extension
== ".rc" || extension
== ".RC" )
474 newExtension
= ".coff";
475 else if ( extension
== ".spec" || extension
== ".SPEC" )
476 newExtension
= ".stubs.o";
477 else if ( extension
== ".idl" || extension
== ".IDL" )
479 if ( module
.type
== RpcServer
)
480 newExtension
= "_s.o";
482 newExtension
= "_c.o";
487 if ( module
.type
== BootSector
)
488 directoryTree
= backend
->outputDirectory
;
490 directoryTree
= backend
->intermediateDirectory
;
492 string obj_file
= PassThruCacheDirectory (
493 NormalizeFilename ( ReplaceExtension (
494 RemoveVariables ( sourceFilename
),
499 string_list
& clean_files
= *pclean_files
;
500 CLEAN_FILE ( obj_file
);
506 MingwModuleHandler::GetModuleCleanTarget ( const Module
& module
) const
508 return module
.name
+ "_clean";
512 MingwModuleHandler::GetReferencedObjectLibraryModuleCleanTargets ( vector
<string
>& moduleNames
) const
514 for ( size_t i
= 0; i
< module
.non_if_data
.libraries
.size (); i
++ )
516 Library
& library
= *module
.non_if_data
.libraries
[i
];
517 if ( library
.importedModule
->type
== ObjectLibrary
)
518 moduleNames
.push_back ( GetModuleCleanTarget ( *library
.importedModule
) );
523 MingwModuleHandler::GenerateCleanTarget () const
525 if ( module
.type
== Alias
)
529 ".PHONY: %s_clean\n",
530 module
.name
.c_str() );
531 vector
<string
> referencedModuleNames
;
532 GetReferencedObjectLibraryModuleCleanTargets ( referencedModuleNames
);
535 GetModuleCleanTarget ( module
).c_str(),
536 v2s ( referencedModuleNames
, 10 ).c_str () );
537 for ( size_t i
= 0; i
< clean_files
.size(); i
++ )
540 fprintf ( fMakefile
, " 2>$(NUL)\n\t-@${rm}" );
541 fprintf ( fMakefile
, " %s", clean_files
[i
].c_str() );
543 fprintf ( fMakefile
, " 2>$(NUL)\n" );
544 fprintf ( fMakefile
, "clean: %s_clean\n\n", module
.name
.c_str() );
548 MingwModuleHandler::GenerateInstallTarget () const
550 if ( module
.installName
.length () == 0 )
552 fprintf ( fMakefile
, ".PHONY: %s_install\n", module
.name
.c_str() );
553 string normalizedTargetFilename
= MingwModuleHandler::PassThruCacheDirectory (
554 NormalizeFilename ( module
.installBase
+ sSep
+ module
.installName
),
555 backend
->installDirectory
);
558 module
.name
.c_str (),
559 normalizedTargetFilename
.c_str() );
563 MingwModuleHandler::GenerateDependsTarget () const
566 ".PHONY: %s_depends\n",
567 module
.name
.c_str() );
569 "%s_depends: $(RBUILD_TARGET)\n",
570 module
.name
.c_str () );
572 "\t$(ECHO_RBUILD)\n" );
574 "\t$(Q)$(RBUILD_TARGET) -dm%s mingw\n",
575 module
.name
.c_str () );
579 MingwModuleHandler::GetObjectFilenames ()
581 const vector
<CompilationUnit
*>& compilationUnits
= module
.non_if_data
.compilationUnits
;
582 if ( compilationUnits
.size () == 0 )
585 string
objectFilenames ( "" );
586 for ( size_t i
= 0; i
< compilationUnits
.size (); i
++ )
588 if ( objectFilenames
.size () > 0 )
589 objectFilenames
+= " ";
590 objectFilenames
+= GetObjectFilename ( compilationUnits
[i
]->GetFilename ( backend
->intermediateDirectory
), NULL
);
592 return objectFilenames
;
596 MingwModuleHandler::GenerateGccDefineParametersFromVector (
597 const vector
<Define
*>& defines
)
600 for ( size_t i
= 0; i
< defines
.size (); i
++ )
602 Define
& define
= *defines
[i
];
603 if (parameters
.length () > 0)
606 parameters
+= define
.name
;
607 if (define
.value
.length () > 0)
610 parameters
+= define
.value
;
617 MingwModuleHandler::GenerateGccDefineParameters () const
619 string parameters
= GenerateGccDefineParametersFromVector ( module
.project
.non_if_data
.defines
);
620 string s
= GenerateGccDefineParametersFromVector ( module
.non_if_data
.defines
);
621 if ( s
.length () > 0 )
630 MingwModuleHandler::ConcatenatePaths (
632 const string
& path2
) const
634 if ( ( path1
.length () == 0 ) || ( path1
== "." ) || ( path1
== "./" ) )
636 if ( path1
[path1
.length ()] == cSep
)
637 return path1
+ path2
;
639 return path1
+ cSep
+ path2
;
643 MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector
<Include
*>& includes
)
646 for ( size_t i
= 0; i
< includes
.size (); i
++ )
648 Include
& include
= *includes
[i
];
649 if ( parameters
.length () > 0 )
651 parameters
+= "-I" + include
.directory
;
657 MingwModuleHandler::GenerateGccIncludeParameters () const
659 string parameters
= GenerateGccIncludeParametersFromVector ( module
.non_if_data
.includes
);
660 string s
= GenerateGccIncludeParametersFromVector ( module
.project
.non_if_data
.includes
);
661 if ( s
.length () > 0 )
670 MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector
<CompilerFlag
*>& compilerFlags
) const
673 for ( size_t i
= 0; i
< compilerFlags
.size (); i
++ )
675 CompilerFlag
& compilerFlag
= *compilerFlags
[i
];
676 if ( parameters
.length () > 0 )
678 parameters
+= compilerFlag
.flag
;
684 MingwModuleHandler::GenerateLinkerParametersFromVector ( const vector
<LinkerFlag
*>& linkerFlags
) const
687 for ( size_t i
= 0; i
< linkerFlags
.size (); i
++ )
689 LinkerFlag
& linkerFlag
= *linkerFlags
[i
];
690 if ( parameters
.length () > 0 )
692 parameters
+= linkerFlag
.flag
;
698 MingwModuleHandler::GenerateImportLibraryDependenciesFromVector (
699 const vector
<Library
*>& libraries
)
701 string
dependencies ( "" );
703 for ( size_t i
= 0; i
< libraries
.size (); i
++ )
705 if ( wrap_count
++ == 5 )
706 dependencies
+= " \\\n\t\t", wrap_count
= 0;
707 else if ( dependencies
.size () > 0 )
709 dependencies
+= GetImportLibraryDependency ( *libraries
[i
]->importedModule
);
715 MingwModuleHandler::GenerateLinkerParameters () const
717 return GenerateLinkerParametersFromVector ( module
.linkerFlags
);
721 MingwModuleHandler::GenerateMacro (
722 const char* assignmentOperation
,
724 const IfableData
& data
)
727 bool generateAssignment
;
729 generateAssignment
= (use_pch
&& module
.pch
!= NULL
) || data
.includes
.size () > 0 || data
.defines
.size () > 0 || data
.compilerFlags
.size () > 0;
730 if ( generateAssignment
)
735 assignmentOperation
);
738 if ( use_pch
&& module
.pch
!= NULL
)
742 GetDirectory ( GetPrecompiledHeaderFilename () ).c_str () );
745 string compilerParameters
= GenerateCompilerParametersFromVector ( data
.compilerFlags
);
746 if ( compilerParameters
.size () > 0 )
751 compilerParameters
.c_str () );
754 for ( i
= 0; i
< data
.includes
.size(); i
++ )
756 const Include
& include
= *data
.includes
[i
];
757 string includeDirectory
;
758 if ( include
.baseModule
!= NULL
&&
759 ( include
.baseModule
->type
== RpcServer
||
760 include
.baseModule
->type
== RpcClient
) )
761 includeDirectory
= PassThruCacheDirectory ( NormalizeFilename ( include
.directory
),
762 backend
->intermediateDirectory
);
764 includeDirectory
= include
.directory
;
768 includeDirectory
.c_str() );
770 for ( i
= 0; i
< data
.defines
.size(); i
++ )
772 Define
& d
= *data
.defines
[i
];
777 if ( d
.value
.size() )
783 if ( generateAssignment
)
785 fprintf ( fMakefile
, "\n" );
790 MingwModuleHandler::GenerateMacros (
791 const char* assignmentOperation
,
792 const IfableData
& data
,
793 const vector
<LinkerFlag
*>* linkerFlags
)
797 GenerateMacro ( assignmentOperation
,
800 GenerateMacro ( assignmentOperation
,
804 if ( linkerFlags
!= NULL
)
806 string linkerParameters
= GenerateLinkerParametersFromVector ( *linkerFlags
);
807 if ( linkerParameters
.size () > 0 )
812 linkerflagsMacro
.c_str (),
814 linkerParameters
.c_str() );
818 if ( data
.libraries
.size () > 0 )
820 string deps
= GenerateImportLibraryDependenciesFromVector ( data
.libraries
);
821 if ( deps
.size () > 0 )
832 const vector
<If
*>& ifs
= data
.ifs
;
833 for ( i
= 0; i
< ifs
.size(); i
++ )
836 if ( rIf
.data
.defines
.size()
837 || rIf
.data
.includes
.size()
838 || rIf
.data
.libraries
.size()
839 || rIf
.data
.compilationUnits
.size()
840 || rIf
.data
.compilerFlags
.size()
841 || rIf
.data
.ifs
.size() )
845 "%s (\"$(%s)\",\"%s\")\n",
846 rIf
.negated
? "ifneq" : "ifeq",
847 rIf
.property
.c_str(),
861 MingwModuleHandler::CleanupCompilationUnitVector ( vector
<CompilationUnit
*>& compilationUnits
)
863 for (size_t i
= 0; i
< compilationUnits
.size (); i
++)
864 delete compilationUnits
[i
];
868 MingwModuleHandler::GetModuleSpecificCompilationUnits ( vector
<CompilationUnit
*>& compilationUnits
)
873 MingwModuleHandler::GenerateObjectMacros (
874 const char* assignmentOperation
,
875 const IfableData
& data
,
876 const vector
<LinkerFlag
*>* linkerFlags
)
880 const vector
<CompilationUnit
*>& compilationUnits
= data
.compilationUnits
;
881 if ( compilationUnits
.size () > 0 )
883 for ( i
= 0; i
< compilationUnits
.size (); i
++ )
885 CompilationUnit
& compilationUnit
= *compilationUnits
[i
];
886 if ( compilationUnit
.IsFirstFile () )
890 objectsMacro
.c_str(),
891 GetObjectFilename ( compilationUnit
.GetFilename ( backend
->intermediateDirectory
), NULL
).c_str (),
892 objectsMacro
.c_str() );
898 objectsMacro
.c_str (),
899 assignmentOperation
);
900 for ( i
= 0; i
< compilationUnits
.size(); i
++ )
902 CompilationUnit
& compilationUnit
= *compilationUnits
[i
];
903 if ( !compilationUnit
.IsFirstFile () )
908 ( i
%10 == 9 ? " \\\n\t" : " " ),
909 GetObjectFilename ( compilationUnit
.GetFilename ( backend
->intermediateDirectory
), NULL
).c_str () );
912 fprintf ( fMakefile
, "\n" );
915 const vector
<If
*>& ifs
= data
.ifs
;
916 for ( i
= 0; i
< ifs
.size(); i
++ )
919 if ( rIf
.data
.defines
.size()
920 || rIf
.data
.includes
.size()
921 || rIf
.data
.libraries
.size()
922 || rIf
.data
.compilationUnits
.size()
923 || rIf
.data
.compilerFlags
.size()
924 || rIf
.data
.ifs
.size() )
928 "%s (\"$(%s)\",\"%s\")\n",
929 rIf
.negated
? "ifneq" : "ifeq",
930 rIf
.property
.c_str(),
932 GenerateObjectMacros (
942 vector
<CompilationUnit
*> sourceCompilationUnits
;
943 GetModuleSpecificCompilationUnits ( sourceCompilationUnits
);
944 for ( i
= 0; i
< sourceCompilationUnits
.size (); i
++ )
949 objectsMacro
.c_str(),
950 GetObjectFilename ( sourceCompilationUnits
[i
]->GetFilename ( backend
->intermediateDirectory
), NULL
).c_str () );
952 CleanupCompilationUnitVector ( sourceCompilationUnits
);
956 MingwModuleHandler::GetPrecompiledHeaderFilename () const
958 const string
& basePchFilename
= module
.pch
->file
.name
+ ".gch";
959 return PassThruCacheDirectory ( NormalizeFilename ( basePchFilename
),
960 backend
->intermediateDirectory
);
964 MingwModuleHandler::GenerateGccCommand (
965 const FileLocation
* sourceFileLocation
,
966 const string
& extraDependencies
,
968 const string
& cflagsMacro
)
970 string sourceFilename
= PassThruCacheDirectory ( sourceFileLocation
);
971 string dependencies
= sourceFilename
;
972 if ( extraDependencies
!= "" )
973 dependencies
+= " " + extraDependencies
;
974 if ( module
.pch
&& use_pch
)
975 dependencies
+= " " + GetPrecompiledHeaderFilename ();
977 /* WIDL generated headers may be used */
978 vector
<string
> rpcDependencies
;
979 GetRpcHeaderDependencies ( rpcDependencies
);
980 dependencies
+= " " + v2s ( rpcDependencies
, 5 );
981 dependencies
+= " " + NormalizeFilename ( module
.xmlbuildFile
);
983 string objectFilename
= GetObjectFilename (
984 sourceFileLocation
, &clean_files
);
987 objectFilename
.c_str (),
988 dependencies
.c_str (),
989 GetDirectory ( objectFilename
).c_str () );
990 fprintf ( fMakefile
, "\t$(ECHO_CC)\n" );
992 "\t%s -c $< -o $@ %s\n",
994 cflagsMacro
.c_str () );
998 MingwModuleHandler::GenerateGccAssemblerCommand (
999 const FileLocation
* sourceFileLocation
,
1001 const string
& cflagsMacro
)
1003 string sourceFilename
= PassThruCacheDirectory ( sourceFileLocation
);
1004 string dependencies
= sourceFilename
;
1005 dependencies
+= " " + NormalizeFilename ( module
.xmlbuildFile
);
1006 string objectFilename
= GetObjectFilename (
1007 sourceFileLocation
, &clean_files
);
1008 fprintf ( fMakefile
,
1010 objectFilename
.c_str (),
1011 dependencies
.c_str (),
1012 GetDirectory ( objectFilename
).c_str () );
1013 fprintf ( fMakefile
, "\t$(ECHO_GAS)\n" );
1014 fprintf ( fMakefile
,
1015 "\t%s -x assembler-with-cpp -c $< -o $@ -D__ASM__ %s\n",
1017 cflagsMacro
.c_str () );
1021 MingwModuleHandler::GenerateNasmCommand (
1022 const FileLocation
* sourceFileLocation
,
1023 const string
& nasmflagsMacro
)
1025 string sourceFilename
= PassThruCacheDirectory ( sourceFileLocation
);
1026 string dependencies
= sourceFilename
;
1027 dependencies
+= " " + NormalizeFilename ( module
.xmlbuildFile
);
1028 string objectFilename
= GetObjectFilename (
1029 sourceFileLocation
, &clean_files
);
1030 fprintf ( fMakefile
,
1032 objectFilename
.c_str (),
1033 dependencies
.c_str (),
1034 GetDirectory ( objectFilename
).c_str () );
1035 fprintf ( fMakefile
, "\t$(ECHO_NASM)\n" );
1036 fprintf ( fMakefile
,
1037 "\t%s -f win32 $< -o $@ %s\n",
1039 nasmflagsMacro
.c_str () );
1043 MingwModuleHandler::GenerateWindresCommand (
1044 const FileLocation
* sourceFileLocation
,
1045 const string
& windresflagsMacro
)
1047 string sourceFilename
= PassThruCacheDirectory ( sourceFileLocation
);
1048 string dependencies
= sourceFilename
;
1049 dependencies
+= " " + NormalizeFilename ( module
.xmlbuildFile
);
1050 string objectFilename
= GetObjectFilename ( sourceFileLocation
, &clean_files
);
1051 string sourceFilenamePart
= ReplaceExtension ( GetFilename ( sourceFilename
), "" );
1052 string rciFilename
= ros_temp
+ module
.name
+ "." + sourceFilenamePart
+ ".rci.tmp";
1053 string resFilename
= ros_temp
+ module
.name
+ "." + sourceFilenamePart
+ ".res.tmp";
1054 if ( module
.useWRC
)
1056 fprintf ( fMakefile
,
1057 "%s: %s $(WRC_TARGET) | %s\n",
1058 objectFilename
.c_str (),
1059 dependencies
.c_str (),
1060 GetDirectory ( objectFilename
).c_str () );
1061 fprintf ( fMakefile
, "\t$(ECHO_WRC)\n" );
1062 fprintf ( fMakefile
,
1063 "\t${gcc} -xc -E -DRC_INVOKED ${%s} %s > %s\n",
1064 windresflagsMacro
.c_str (),
1065 sourceFilename
.c_str (),
1066 rciFilename
.c_str () );
1067 fprintf ( fMakefile
,
1068 "\t$(Q)$(WRC_TARGET) ${%s} %s %s\n",
1069 windresflagsMacro
.c_str (),
1070 rciFilename
.c_str (),
1071 resFilename
.c_str () );
1072 fprintf ( fMakefile
,
1073 "\t-@${rm} %s 2>$(NUL)\n",
1074 rciFilename
.c_str () );
1075 fprintf ( fMakefile
,
1076 "\t${windres} %s -o $@\n",
1077 resFilename
.c_str () );
1078 fprintf ( fMakefile
,
1079 "\t-@${rm} %s 2>$(NUL)\n",
1080 resFilename
.c_str () );
1084 fprintf ( fMakefile
,
1085 "%s: %s $(WRC_TARGET) | %s\n",
1086 objectFilename
.c_str (),
1087 dependencies
.c_str (),
1088 GetDirectory ( objectFilename
).c_str () );
1089 fprintf ( fMakefile
, "\t$(ECHO_WRC)\n" );
1090 fprintf ( fMakefile
,
1091 "\t${windres} $(%s) %s -o $@\n",
1092 windresflagsMacro
.c_str (),
1093 sourceFilename
.c_str () );
1098 MingwModuleHandler::GenerateWinebuildCommands (
1099 const FileLocation
* sourceFileLocation
)
1101 string sourceFilename
= PassThruCacheDirectory ( sourceFileLocation
);
1102 string dependencies
= sourceFilename
;
1103 dependencies
+= " " + NormalizeFilename ( module
.xmlbuildFile
);
1105 string basename
= GetBasename ( sourceFilename
);
1106 string def_file
= PassThruCacheDirectory (
1107 basename
+ ".spec.def",
1108 backend
->intermediateDirectory
);
1109 CLEAN_FILE(def_file
);
1111 string stub_file
= PassThruCacheDirectory (
1112 basename
+ ".stubs.c",
1113 backend
->intermediateDirectory
);
1114 CLEAN_FILE(stub_file
)
1116 fprintf ( fMakefile
,
1117 "%s: %s $(WINEBUILD_TARGET) | %s\n",
1119 dependencies
.c_str (),
1120 GetDirectory ( def_file
).c_str () );
1121 fprintf ( fMakefile
, "\t$(ECHO_WINEBLD)\n" );
1122 fprintf ( fMakefile
,
1123 "\t%s -o %s --def -E %s\n",
1124 "$(Q)$(WINEBUILD_TARGET)",
1126 sourceFilename
.c_str () );
1127 fprintf ( fMakefile
,
1128 "%s: %s $(WINEBUILD_TARGET)\n",
1130 sourceFilename
.c_str () );
1131 fprintf ( fMakefile
, "\t$(ECHO_WINEBLD)\n" );
1132 fprintf ( fMakefile
,
1133 "\t%s -o %s --pedll %s\n",
1134 "$(Q)$(WINEBUILD_TARGET)",
1136 sourceFilename
.c_str () );
1140 MingwModuleHandler::GetWidlFlags ( const CompilationUnit
& compilationUnit
)
1142 return compilationUnit
.GetSwitches ();
1146 MingwModuleHandler::GetRpcServerHeaderFilename ( string basename
) const
1148 return PassThruCacheDirectory ( basename
+ "_s.h",
1149 backend
->intermediateDirectory
);
1153 MingwModuleHandler::GenerateWidlCommandsServer (
1154 const CompilationUnit
& compilationUnit
,
1155 const string
& widlflagsMacro
)
1157 FileLocation
* sourceFileLocation
= compilationUnit
.GetFilename ( backend
->intermediateDirectory
);
1158 string filename
= sourceFileLocation
->filename
;
1159 string dependencies
= filename
;
1160 dependencies
+= " " + NormalizeFilename ( module
.xmlbuildFile
);
1162 string basename
= GetBasename ( filename
);
1164 string generatedHeaderFilename
= GetRpcServerHeaderFilename ( basename
);
1165 CLEAN_FILE(generatedHeaderFilename
);
1167 string generatedServerFilename
= PassThruCacheDirectory (
1169 backend
->intermediateDirectory
);
1170 CLEAN_FILE(generatedServerFilename
);
1172 fprintf ( fMakefile
,
1173 "%s %s: %s $(WIDL_TARGET) | %s\n",
1174 generatedServerFilename
.c_str (),
1175 generatedHeaderFilename
.c_str (),
1176 dependencies
.c_str (),
1177 GetDirectory ( generatedServerFilename
).c_str () );
1178 fprintf ( fMakefile
, "\t$(ECHO_WIDL)\n" );
1179 fprintf ( fMakefile
,
1180 "\t%s %s %s -h -H %s -s -S %s %s\n",
1181 "$(Q)$(WIDL_TARGET)",
1182 GetWidlFlags ( compilationUnit
).c_str (),
1183 widlflagsMacro
.c_str (),
1184 generatedHeaderFilename
.c_str (),
1185 generatedServerFilename
.c_str (),
1186 filename
.c_str () );
1190 MingwModuleHandler::GetRpcClientHeaderFilename ( string basename
) const
1192 return PassThruCacheDirectory ( basename
+ "_c.h",
1193 backend
->intermediateDirectory
);
1197 MingwModuleHandler::GenerateWidlCommandsClient (
1198 const CompilationUnit
& compilationUnit
,
1199 const string
& widlflagsMacro
)
1201 FileLocation
* sourceFileLocation
= compilationUnit
.GetFilename ( backend
->intermediateDirectory
);
1202 string filename
= sourceFileLocation
->filename
;
1203 string dependencies
= filename
;
1204 dependencies
+= " " + NormalizeFilename ( module
.xmlbuildFile
);
1206 string basename
= GetBasename ( filename
);
1208 string generatedHeaderFilename
= GetRpcClientHeaderFilename ( basename
);
1209 CLEAN_FILE(generatedHeaderFilename
);
1211 string generatedClientFilename
= PassThruCacheDirectory (
1213 backend
->intermediateDirectory
);
1214 CLEAN_FILE(generatedClientFilename
);
1216 fprintf ( fMakefile
,
1217 "%s %s: %s $(WIDL_TARGET) | %s\n",
1218 generatedClientFilename
.c_str (),
1219 generatedHeaderFilename
.c_str (),
1220 dependencies
.c_str (),
1221 GetDirectory ( generatedClientFilename
).c_str () );
1222 fprintf ( fMakefile
, "\t$(ECHO_WIDL)\n" );
1223 fprintf ( fMakefile
,
1224 "\t%s %s %s -h -H %s -c -C %s %s\n",
1225 "$(Q)$(WIDL_TARGET)",
1226 GetWidlFlags ( compilationUnit
).c_str (),
1227 widlflagsMacro
.c_str (),
1228 generatedHeaderFilename
.c_str (),
1229 generatedClientFilename
.c_str (),
1230 filename
.c_str () );
1234 MingwModuleHandler::GenerateWidlCommands (
1235 const CompilationUnit
& compilationUnit
,
1236 const string
& widlflagsMacro
)
1238 if ( module
.type
== RpcServer
)
1239 GenerateWidlCommandsServer ( compilationUnit
,
1242 GenerateWidlCommandsClient ( compilationUnit
,
1247 MingwModuleHandler::GenerateCommands (
1248 const CompilationUnit
& compilationUnit
,
1251 const string
& cflagsMacro
,
1252 const string
& nasmflagsMacro
,
1253 const string
& windresflagsMacro
,
1254 const string
& widlflagsMacro
)
1256 FileLocation
* sourceFileLocation
= compilationUnit
.GetFilename ( backend
->intermediateDirectory
);
1257 string filename
= sourceFileLocation
->filename
;
1258 string extension
= GetExtension ( filename
);
1259 if ( extension
== ".c" || extension
== ".C" )
1261 GenerateGccCommand ( sourceFileLocation
,
1262 GetCompilationUnitDependencies ( compilationUnit
),
1267 else if ( extension
== ".cc" || extension
== ".CC" ||
1268 extension
== ".cpp" || extension
== ".CPP" ||
1269 extension
== ".cxx" || extension
== ".CXX" )
1271 GenerateGccCommand ( sourceFileLocation
,
1272 GetCompilationUnitDependencies ( compilationUnit
),
1277 else if ( extension
== ".s" || extension
== ".S" )
1279 GenerateGccAssemblerCommand ( sourceFileLocation
,
1284 else if ( extension
== ".asm" || extension
== ".ASM" )
1286 GenerateNasmCommand ( sourceFileLocation
,
1290 else if ( extension
== ".rc" || extension
== ".RC" )
1292 GenerateWindresCommand ( sourceFileLocation
,
1293 windresflagsMacro
);
1296 else if ( extension
== ".spec" || extension
== ".SPEC" )
1298 GenerateWinebuildCommands ( sourceFileLocation
);
1299 GenerateGccCommand ( GetActualSourceFilename ( sourceFileLocation
),
1305 else if ( extension
== ".idl" || extension
== ".IDL" )
1307 GenerateWidlCommands ( compilationUnit
,
1309 GenerateGccCommand ( GetActualSourceFilename ( sourceFileLocation
),
1310 GetExtraDependencies ( filename
),
1316 throw InvalidOperationException ( __FILE__
,
1318 "Unsupported filename extension '%s' in file '%s'",
1320 filename
.c_str () );
1324 MingwModuleHandler::GenerateBuildMapCode ()
1326 fprintf ( fMakefile
,
1327 "ifeq ($(ROS_BUILDMAP),full)\n" );
1329 string mapFilename
= PassThruCacheDirectory (
1330 GetBasename ( module
.GetPath () ) + ".map",
1331 backend
->outputDirectory
);
1332 CLEAN_FILE ( mapFilename
);
1334 fprintf ( fMakefile
,
1335 "\t$(ECHO_OBJDUMP)\n" );
1336 fprintf ( fMakefile
,
1337 "\t$(Q)${objdump} -d -S $@ > %s\n",
1338 mapFilename
.c_str () );
1340 fprintf ( fMakefile
,
1342 fprintf ( fMakefile
,
1343 "ifeq ($(ROS_BUILDMAP),yes)\n" );
1345 fprintf ( fMakefile
,
1347 fprintf ( fMakefile
,
1348 "\t$(Q)${nm} --numeric-sort $@ > %s\n",
1349 mapFilename
.c_str () );
1351 fprintf ( fMakefile
,
1354 fprintf ( fMakefile
,
1359 MingwModuleHandler::GenerateBuildNonSymbolStrippedCode ()
1361 fprintf ( fMakefile
,
1362 "ifeq ($(ROS_BUILDNOSTRIP),yes)\n" );
1364 string filename
= module
.GetPath ();
1365 string outputFilename
= PassThruCacheDirectory (
1367 backend
->outputDirectory
);
1368 string nostripFilename
= PassThruCacheDirectory (
1369 GetBasename ( filename
) + ".nostrip" + GetExtension ( filename
),
1370 backend
->outputDirectory
);
1371 CLEAN_FILE ( nostripFilename
);
1373 fprintf ( fMakefile
,
1375 fprintf ( fMakefile
,
1376 "\t${cp} %s %s 1>$(NUL)\n",
1377 outputFilename
.c_str (),
1378 nostripFilename
.c_str () );
1380 fprintf ( fMakefile
,
1385 MergeStringVector ( const vector
<string
>& input
,
1386 vector
<string
>& output
)
1390 int wrap_count
= -1;
1391 for ( size_t i
= 0; i
< input
.size (); i
++ )
1393 if ( input
[i
].size () == 0 )
1395 if ( wrap_count
++ == wrap_at
)
1397 output
.push_back ( s
);
1401 else if ( s
.size () > 0)
1405 if ( s
.length () > 0 )
1406 output
.push_back ( s
);
1410 MingwModuleHandler::GetObjectsVector ( const IfableData
& data
,
1411 vector
<string
>& objectFiles
) const
1413 for ( size_t i
= 0; i
< data
.compilationUnits
.size (); i
++ )
1415 CompilationUnit
& compilationUnit
= *data
.compilationUnits
[i
];
1416 objectFiles
.push_back ( GetObjectFilename ( compilationUnit
.GetFilename ( backend
->intermediateDirectory
), NULL
) );
1421 MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const
1423 if ( backend
->configuration
.CleanAsYouGo
)
1425 vector
<string
> objectFiles
;
1426 GetObjectsVector ( module
.non_if_data
,
1428 vector
<string
> lines
;
1429 MergeStringVector ( objectFiles
,
1431 for ( size_t i
= 0; i
< lines
.size (); i
++ )
1433 fprintf ( fMakefile
,
1434 "\t-@${rm} %s 2>$(NUL)\n",
1435 lines
[i
].c_str () );
1441 MingwModuleHandler::GenerateRunRsymCode () const
1443 fprintf ( fMakefile
,
1444 "\t$(ECHO_RSYM)\n" );
1445 fprintf ( fMakefile
,
1446 "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );
1450 MingwModuleHandler::GenerateLinkerCommand (
1451 const string
& dependencies
,
1452 const string
& linker
,
1453 const string
& linkerParameters
,
1454 const string
& objectsMacro
,
1455 const string
& libsMacro
,
1456 const string
& pefixupParameters
)
1458 string
target ( GetTargetMacro ( module
) );
1459 string
target_folder ( GetDirectory ( GetTargetFilename ( module
, NULL
) ) );
1460 string definitionFilename
= GetDefinitionFilename ();
1462 string linkerScriptArgument
;
1463 if ( module
.linkerScript
!= NULL
)
1464 linkerScriptArgument
= ssprintf ( "-Wl,-T,%s", module
.linkerScript
->directory
.c_str () );
1466 linkerScriptArgument
= "";
1468 fprintf ( fMakefile
,
1469 "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
1471 definitionFilename
.c_str (),
1472 dependencies
.c_str (),
1473 target_folder
.c_str () );
1474 fprintf ( fMakefile
, "\t$(ECHO_LD)\n" );
1475 string
targetName ( module
.GetTargetName () );
1477 if ( module
.IsDLL () )
1479 string temp_exp
= ros_temp
+ module
.name
+ ".temp.exp";
1480 CLEAN_FILE ( temp_exp
);
1482 string killAt
= module
.mangledSymbols
? "" : "--kill-at";
1483 fprintf ( fMakefile
,
1484 "\t${dlltool} --dllname %s --def %s --output-exp %s %s\n",
1485 targetName
.c_str (),
1486 definitionFilename
.c_str (),
1490 fprintf ( fMakefile
,
1491 "\t%s %s %s %s -o %s %s %s %s\n",
1493 linkerParameters
.c_str (),
1494 linkerScriptArgument
.c_str (),
1497 objectsMacro
.c_str (),
1499 GetLinkerMacro ().c_str () );
1501 fprintf ( fMakefile
,
1502 "\t$(Q)$(PEFIXUP_TARGET) %s -exports %s\n",
1504 pefixupParameters
.c_str() );
1506 fprintf ( fMakefile
,
1507 "\t-@${rm} %s 2>$(NUL)\n",
1508 temp_exp
.c_str () );
1512 fprintf ( fMakefile
,
1513 "\t%s %s %s -o %s %s %s %s\n",
1515 linkerParameters
.c_str (),
1516 linkerScriptArgument
.c_str (),
1518 objectsMacro
.c_str (),
1520 GetLinkerMacro ().c_str () );
1522 if ( pefixupParameters
.length() != 0 )
1524 fprintf ( fMakefile
,
1525 "\t$(Q)$(PEFIXUP_TARGET) %s -exports %s\n",
1527 pefixupParameters
.c_str() );
1531 GenerateBuildMapCode ();
1532 GenerateBuildNonSymbolStrippedCode ();
1533 GenerateRunRsymCode ();
1534 GenerateCleanObjectsAsYouGoCode ();
1538 MingwModuleHandler::GeneratePhonyTarget() const
1540 string
targetMacro ( GetTargetMacro ( module
) );
1541 fprintf ( fMakefile
,
1543 targetMacro
.c_str ());
1544 fprintf ( fMakefile
, "%s: | %s\n",
1545 targetMacro
.c_str (),
1546 GetDirectory ( GetTargetFilename ( module
, NULL
) ).c_str () );
1550 MingwModuleHandler::GenerateObjectFileTargets (
1551 const IfableData
& data
,
1554 const string
& cflagsMacro
,
1555 const string
& nasmflagsMacro
,
1556 const string
& windresflagsMacro
,
1557 const string
& widlflagsMacro
)
1561 const vector
<CompilationUnit
*>& compilationUnits
= data
.compilationUnits
;
1562 for ( i
= 0; i
< compilationUnits
.size (); i
++ )
1564 GenerateCommands ( *compilationUnits
[i
],
1571 fprintf ( fMakefile
,
1575 const vector
<If
*>& ifs
= data
.ifs
;
1576 for ( i
= 0; i
< ifs
.size(); i
++ )
1578 GenerateObjectFileTargets ( ifs
[i
]->data
,
1587 vector
<CompilationUnit
*> sourceCompilationUnits
;
1588 GetModuleSpecificCompilationUnits ( sourceCompilationUnits
);
1589 for ( i
= 0; i
< sourceCompilationUnits
.size (); i
++ )
1591 GenerateCommands ( *sourceCompilationUnits
[i
],
1599 CleanupCompilationUnitVector ( sourceCompilationUnits
);
1603 MingwModuleHandler::GenerateObjectFileTargets (
1606 const string
& cflagsMacro
,
1607 const string
& nasmflagsMacro
,
1608 const string
& windresflagsMacro
,
1609 const string
& widlflagsMacro
)
1611 if ( module
.pch
&& use_pch
)
1613 const string
& baseHeaderFilename
= module
.pch
->file
.name
;
1614 const string
& pchFilename
= GetPrecompiledHeaderFilename ();
1615 CLEAN_FILE(pchFilename
);
1616 string dependencies
= baseHeaderFilename
;
1617 /* WIDL generated headers may be used */
1618 vector
<string
> rpcDependencies
;
1619 GetRpcHeaderDependencies ( rpcDependencies
);
1620 dependencies
+= " " + v2s ( rpcDependencies
, 5 );
1621 fprintf ( fMakefile
,
1623 pchFilename
.c_str(),
1624 dependencies
.c_str() );
1625 fprintf ( fMakefile
, "\t$(ECHO_PCH)\n" );
1626 fprintf ( fMakefile
,
1627 "\t%s -o %s %s -g %s\n\n",
1628 module
.cplusplus
? cppc
.c_str() : cc
.c_str(),
1629 pchFilename
.c_str(),
1630 cflagsMacro
.c_str(),
1631 baseHeaderFilename
.c_str() );
1634 GenerateObjectFileTargets ( module
.non_if_data
,
1641 fprintf ( fMakefile
, "\n" );
1645 MingwModuleHandler::GenerateArchiveTarget ( const string
& ar
,
1646 const string
& objs_macro
) const
1648 string
archiveFilename ( GetModuleArchiveFilename () );
1650 fprintf ( fMakefile
,
1652 archiveFilename
.c_str (),
1653 objs_macro
.c_str (),
1654 GetDirectory(archiveFilename
).c_str() );
1656 fprintf ( fMakefile
, "\t$(ECHO_AR)\n" );
1658 fprintf ( fMakefile
,
1661 objs_macro
.c_str ());
1663 GenerateCleanObjectsAsYouGoCode ();
1665 fprintf ( fMakefile
, "\n" );
1667 return archiveFilename
;
1671 MingwModuleHandler::GetCFlagsMacro () const
1673 return ssprintf ( "$(%s_CFLAGS)",
1674 module
.name
.c_str () );
1678 MingwModuleHandler::GetObjectsMacro ( const Module
& module
)
1680 return ssprintf ( "$(%s_OBJS)",
1681 module
.name
.c_str () );
1685 MingwModuleHandler::GetLinkingDependenciesMacro () const
1687 return ssprintf ( "$(%s_LINKDEPS)", module
.name
.c_str () );
1691 MingwModuleHandler::GetLibsMacro () const
1693 return ssprintf ( "$(%s_LIBS)", module
.name
.c_str () );
1697 MingwModuleHandler::GetLinkerMacro () const
1699 return ssprintf ( "$(%s_LFLAGS)",
1700 module
.name
.c_str () );
1704 MingwModuleHandler::GetModuleTargets ( const Module
& module
)
1706 if ( ReferenceObjects ( module
) )
1707 return GetObjectsMacro ( module
);
1709 return GetTargetFilename ( module
, NULL
);
1713 MingwModuleHandler::GenerateObjectMacro ()
1715 objectsMacro
= ssprintf ("%s_OBJS", module
.name
.c_str ());
1717 GenerateObjectMacros (
1720 &module
.linkerFlags
);
1722 // future references to the macro will be to get its values
1723 objectsMacro
= ssprintf ("$(%s)", objectsMacro
.c_str ());
1727 MingwModuleHandler::GenerateTargetMacro ()
1729 fprintf ( fMakefile
,
1731 GetTargetMacro ( module
, false ).c_str (),
1732 GetModuleTargets ( module
).c_str () );
1736 MingwModuleHandler::GetRpcHeaderDependencies (
1737 vector
<string
>& dependencies
) const
1739 for ( size_t i
= 0; i
< module
.non_if_data
.libraries
.size (); i
++ )
1741 Library
& library
= *module
.non_if_data
.libraries
[i
];
1742 if ( library
.importedModule
->type
== RpcServer
||
1743 library
.importedModule
->type
== RpcClient
)
1745 for ( size_t j
= 0; j
< library
.importedModule
->non_if_data
.compilationUnits
.size (); j
++ )
1747 CompilationUnit
& compilationUnit
= *library
.importedModule
->non_if_data
.compilationUnits
[j
];
1748 FileLocation
* sourceFileLocation
= compilationUnit
.GetFilename ( backend
->intermediateDirectory
);
1749 string extension
= GetExtension ( sourceFileLocation
->filename
);
1750 if ( extension
== ".idl" || extension
== ".IDL" )
1752 string basename
= GetBasename ( sourceFileLocation
->filename
);
1753 if ( library
.importedModule
->type
== RpcServer
)
1754 dependencies
.push_back ( GetRpcServerHeaderFilename ( basename
) );
1755 if ( library
.importedModule
->type
== RpcClient
)
1756 dependencies
.push_back ( GetRpcClientHeaderFilename ( basename
) );
1764 MingwModuleHandler::GenerateOtherMacros ()
1766 cflagsMacro
= ssprintf ("%s_CFLAGS", module
.name
.c_str ());
1767 nasmflagsMacro
= ssprintf ("%s_NASMFLAGS", module
.name
.c_str ());
1768 windresflagsMacro
= ssprintf ("%s_RCFLAGS", module
.name
.c_str ());
1769 widlflagsMacro
= ssprintf ("%s_WIDLFLAGS", module
.name
.c_str ());
1770 linkerflagsMacro
= ssprintf ("%s_LFLAGS", module
.name
.c_str ());
1771 libsMacro
= ssprintf("%s_LIBS", module
.name
.c_str ());
1772 linkDepsMacro
= ssprintf ("%s_LINKDEPS", module
.name
.c_str ());
1777 &module
.linkerFlags
);
1780 if ( module
.importLibrary
)
1782 const vector
<CompilationUnit
*>& compilationUnits
= module
.non_if_data
.compilationUnits
;
1783 for ( size_t i
= 0; i
< compilationUnits
.size (); i
++ )
1785 CompilationUnit
& compilationUnit
= *compilationUnits
[i
];
1786 FileLocation
* sourceFileLocation
= compilationUnit
.GetFilename ( backend
->intermediateDirectory
);
1787 string extension
= GetExtension ( sourceFileLocation
->filename
);
1788 if ( extension
== ".spec" || extension
== ".SPEC" )
1789 GetSpecObjectDependencies ( s
, sourceFileLocation
->filename
);
1792 if ( s
.size () > 0 )
1797 linkDepsMacro
.c_str() );
1798 for ( size_t i
= 0; i
< s
.size(); i
++ )
1799 fprintf ( fMakefile
,
1802 fprintf ( fMakefile
, "\n" );
1805 string globalCflags
= "-g";
1806 if ( backend
->usePipe
)
1807 globalCflags
+= " -pipe";
1808 if ( !module
.allowWarnings
)
1809 globalCflags
+= " -Werror";
1813 "%s += $(PROJECT_CFLAGS) %s\n",
1814 cflagsMacro
.c_str (),
1815 globalCflags
.c_str () );
1819 "%s += $(PROJECT_RCFLAGS)\n",
1820 windresflagsMacro
.c_str () );
1824 "%s += $(PROJECT_WIDLFLAGS)\n",
1825 widlflagsMacro
.c_str () );
1829 "%s_LFLAGS += $(PROJECT_LFLAGS) -g\n",
1830 module
.name
.c_str () );
1835 linkDepsMacro
.c_str (),
1836 libsMacro
.c_str () );
1838 string cflags
= TypeSpecificCFlags();
1839 if ( cflags
.size() > 0 )
1841 fprintf ( fMakefile
,
1843 cflagsMacro
.c_str (),
1847 string nasmflags
= TypeSpecificNasmFlags();
1848 if ( nasmflags
.size () > 0 )
1850 fprintf ( fMakefile
,
1852 nasmflagsMacro
.c_str (),
1853 nasmflags
.c_str () );
1856 string linkerflags
= TypeSpecificLinkerFlags();
1857 if ( linkerflags
.size() > 0 )
1859 fprintf ( fMakefile
,
1861 linkerflagsMacro
.c_str (),
1862 linkerflags
.c_str () );
1865 fprintf ( fMakefile
, "\n\n" );
1867 // future references to the macros will be to get their values
1868 cflagsMacro
= ssprintf ("$(%s)", cflagsMacro
.c_str ());
1869 nasmflagsMacro
= ssprintf ("$(%s)", nasmflagsMacro
.c_str ());
1870 widlflagsMacro
= ssprintf ("$(%s)", widlflagsMacro
.c_str ());
1874 MingwModuleHandler::GenerateRules ()
1876 string cc
= ( module
.host
== HostTrue
? "${host_gcc}" : "${gcc}" );
1877 string cppc
= ( module
.host
== HostTrue
? "${host_gpp}" : "${gpp}" );
1878 string ar
= ( module
.host
== HostTrue
? "${host_ar}" : "${ar}" );
1880 if ( module
.name
!= "zlib" ) /* Avoid make warning */
1882 string proxyMakefile
= PassThruCacheDirectory (
1883 NormalizeFilename ( module
.GetBasePath () + sSep
+ "makefile" ),
1884 backend
->outputDirectory
);
1885 CLEAN_FILE ( proxyMakefile
);
1888 string targetMacro
= GetTargetMacro ( module
);
1889 CLEAN_FILE ( targetMacro
);
1891 // generate phony target for module name
1892 fprintf ( fMakefile
, ".PHONY: %s\n",
1893 module
.name
.c_str () );
1894 string dependencies
= GetTargetMacro ( module
);
1895 if ( module
.type
== Test
)
1896 dependencies
+= " $(REGTESTS_RUN_TARGET)";
1897 fprintf ( fMakefile
, "%s: %s\n\n",
1898 module
.name
.c_str (),
1899 dependencies
.c_str () );
1900 if ( module
.type
== Test
)
1902 fprintf ( fMakefile
,
1904 targetMacro
.c_str ());
1907 if ( !ReferenceObjects ( module
) )
1909 string
ar_target ( GenerateArchiveTarget ( ar
, objectsMacro
) );
1910 if ( targetMacro
!= ar_target
)
1911 CLEAN_FILE ( ar_target
);
1914 GenerateObjectFileTargets ( cc
,
1923 MingwModuleHandler::GetInvocationDependencies (
1924 const Module
& module
,
1925 string_list
& dependencies
)
1927 for ( size_t i
= 0; i
< module
.invocations
.size (); i
++ )
1929 Invoke
& invoke
= *module
.invocations
[i
];
1930 if ( invoke
.invokeModule
== &module
)
1931 /* Protect against circular dependencies */
1933 invoke
.GetTargets ( dependencies
);
1938 MingwModuleHandler::GenerateInvocations () const
1940 if ( module
.invocations
.size () == 0 )
1943 size_t iend
= module
.invocations
.size ();
1944 for ( size_t i
= 0; i
< iend
; i
++ )
1946 const Invoke
& invoke
= *module
.invocations
[i
];
1948 if ( invoke
.invokeModule
->type
!= BuildTool
)
1950 throw XMLInvalidBuildFileException (
1951 module
.node
.location
,
1952 "Only modules of type buildtool can be invoked." );
1955 string invokeTarget
= module
.GetInvocationTarget ( i
);
1956 string_list invoke_targets
;
1957 assert ( invoke_targets
.size() );
1958 invoke
.GetTargets ( invoke_targets
);
1959 fprintf ( fMakefile
,
1961 invokeTarget
.c_str () );
1962 fprintf ( fMakefile
,
1964 invokeTarget
.c_str () );
1965 size_t j
, jend
= invoke_targets
.size();
1966 for ( j
= 0; j
< jend
; j
++ )
1968 fprintf ( fMakefile
,
1970 invoke_targets
[i
].c_str () );
1972 fprintf ( fMakefile
, "\n\n%s", invoke_targets
[0].c_str () );
1973 for ( j
= 1; j
< jend
; j
++ )
1974 fprintf ( fMakefile
,
1976 invoke_targets
[i
].c_str () );
1977 fprintf ( fMakefile
,
1979 NormalizeFilename ( invoke
.invokeModule
->GetPath () ).c_str () );
1980 fprintf ( fMakefile
, "\t$(ECHO_INVOKE)\n" );
1981 fprintf ( fMakefile
,
1983 NormalizeFilename ( invoke
.invokeModule
->GetPath () ).c_str (),
1984 invoke
.GetParameters ().c_str () );
1989 MingwModuleHandler::GetPreconditionDependenciesName () const
1991 return module
.name
+ "_precondition";
1995 MingwModuleHandler::GetDefaultDependencies (
1996 string_list
& dependencies
) const
1998 /* Avoid circular dependency */
1999 if ( module
.type
!= BuildTool
2000 && module
.name
!= "zlib"
2001 && module
.name
!= "hostzlib" )
2003 dependencies
.push_back ( "$(INIT)" );
2007 MingwModuleHandler::GeneratePreconditionDependencies ()
2009 string preconditionDependenciesName
= GetPreconditionDependenciesName ();
2010 string_list sourceFilenames
;
2011 GetSourceFilenamesWithoutGeneratedFiles ( sourceFilenames
);
2012 string_list dependencies
;
2013 GetDefaultDependencies ( dependencies
);
2014 GetModuleDependencies ( dependencies
);
2016 GetInvocationDependencies ( module
, dependencies
);
2018 if ( dependencies
.size() )
2020 fprintf ( fMakefile
,
2022 preconditionDependenciesName
.c_str () );
2023 for ( size_t i
= 0; i
< dependencies
.size(); i
++ )
2024 fprintf ( fMakefile
,
2026 dependencies
[i
].c_str () );
2027 fprintf ( fMakefile
, "\n\n" );
2030 for ( size_t i
= 0; i
< sourceFilenames
.size(); i
++ )
2032 fprintf ( fMakefile
,
2034 sourceFilenames
[i
].c_str(),
2035 preconditionDependenciesName
.c_str ());
2037 fprintf ( fMakefile
, "\n" );
2041 MingwModuleHandler::IsWineModule () const
2043 if ( module
.importLibrary
== NULL
)
2046 size_t index
= module
.importLibrary
->definition
.rfind ( ".spec.def" );
2047 return ( index
!= string::npos
);
2051 MingwModuleHandler::GetDefinitionFilename () const
2053 if ( module
.importLibrary
!= NULL
)
2055 string defFilename
= module
.GetBasePath () + sSep
+ module
.importLibrary
->definition
;
2056 if ( IsWineModule () )
2057 return PassThruCacheDirectory ( NormalizeFilename ( defFilename
),
2058 backend
->intermediateDirectory
);
2063 return "tools" + sSep
+ "rbuild" + sSep
+ "empty.def";
2067 MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
2069 if ( module
.importLibrary
!= NULL
)
2071 string
library_target (
2072 GetImportLibraryFilename ( module
, &clean_files
) );
2073 string defFilename
= GetDefinitionFilename ();
2076 GetDefinitionDependencies ( deps
);
2078 fprintf ( fMakefile
, "# IMPORT LIBRARY RULE:\n" );
2080 fprintf ( fMakefile
, "%s: %s",
2081 library_target
.c_str (),
2082 defFilename
.c_str () );
2084 size_t i
, iend
= deps
.size();
2085 for ( i
= 0; i
< iend
; i
++ )
2086 fprintf ( fMakefile
, " %s",
2089 fprintf ( fMakefile
, " | %s\n",
2090 GetDirectory ( GetImportLibraryFilename ( module
, NULL
) ).c_str () );
2092 fprintf ( fMakefile
, "\t$(ECHO_DLLTOOL)\n" );
2094 string killAt
= module
.mangledSymbols
? "" : "--kill-at";
2095 fprintf ( fMakefile
,
2096 "\t${dlltool} --dllname %s --def %s --output-lib %s %s\n\n",
2097 module
.GetTargetName ().c_str (),
2098 defFilename
.c_str (),
2099 library_target
.c_str (),
2105 MingwModuleHandler::GetSpecObjectDependencies (
2106 string_list
& dependencies
,
2107 const string
& filename
) const
2109 string basename
= GetBasename ( filename
);
2110 string defDependency
= PassThruCacheDirectory (
2111 NormalizeFilename ( basename
+ ".spec.def" ),
2112 backend
->intermediateDirectory
);
2113 dependencies
.push_back ( defDependency
);
2114 string stubsDependency
= PassThruCacheDirectory (
2115 NormalizeFilename ( basename
+ ".stubs.c" ),
2116 backend
->intermediateDirectory
);
2117 dependencies
.push_back ( stubsDependency
);
2121 MingwModuleHandler::GetWidlObjectDependencies (
2122 string_list
& dependencies
,
2123 const string
& filename
) const
2125 string basename
= GetBasename ( filename
);
2126 string serverSourceDependency
= PassThruCacheDirectory (
2127 NormalizeFilename ( basename
+ "_s.c" ),
2128 backend
->intermediateDirectory
);
2129 dependencies
.push_back ( serverSourceDependency
);
2130 dependencies
.push_back ( GetRpcServerHeaderFilename ( basename
) );
2134 MingwModuleHandler::GetDefinitionDependencies (
2135 string_list
& dependencies
) const
2137 string dkNkmLibNoFixup
= "dk/nkm/lib";
2138 const vector
<CompilationUnit
*>& compilationUnits
= module
.non_if_data
.compilationUnits
;
2139 for ( size_t i
= 0; i
< compilationUnits
.size (); i
++ )
2141 CompilationUnit
& compilationUnit
= *compilationUnits
[i
];
2142 FileLocation
* sourceFileLocation
= compilationUnit
.GetFilename ( backend
->intermediateDirectory
);
2143 string extension
= GetExtension ( sourceFileLocation
->filename
);
2144 if ( extension
== ".spec" || extension
== ".SPEC" )
2145 GetSpecObjectDependencies ( dependencies
, sourceFileLocation
->filename
);
2146 if ( extension
== ".idl" || extension
== ".IDL" )
2147 GetWidlObjectDependencies ( dependencies
, sourceFileLocation
->filename
);
2152 MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module
& module_
)
2153 : MingwModuleHandler ( module_
)
2158 MingwBuildToolModuleHandler::Process ()
2160 GenerateBuildToolModuleTarget ();
2164 MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ()
2166 string
targetMacro ( GetTargetMacro (module
) );
2167 string objectsMacro
= GetObjectsMacro ( module
);
2168 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2169 string libsMacro
= GetLibsMacro ();
2174 if ( module
.cplusplus
)
2175 linker
= "${host_gpp}";
2177 linker
= "${host_gcc}";
2179 fprintf ( fMakefile
, "%s: %s %s | %s\n",
2180 targetMacro
.c_str (),
2181 objectsMacro
.c_str (),
2182 linkDepsMacro
.c_str (),
2183 GetDirectory(GetTargetFilename(module
,NULL
)).c_str () );
2184 fprintf ( fMakefile
, "\t$(ECHO_LD)\n" );
2185 fprintf ( fMakefile
,
2186 "\t%s %s -o $@ %s %s\n\n",
2188 GetLinkerMacro ().c_str (),
2189 objectsMacro
.c_str (),
2190 libsMacro
.c_str () );
2194 MingwKernelModuleHandler::MingwKernelModuleHandler (
2195 const Module
& module_
)
2197 : MingwModuleHandler ( module_
)
2202 MingwKernelModuleHandler::Process ()
2204 GenerateKernelModuleTarget ();
2208 MingwKernelModuleHandler::GenerateKernelModuleTarget ()
2210 string
targetMacro ( GetTargetMacro ( module
) );
2211 string workingDirectory
= GetWorkingDirectory ( );
2212 string objectsMacro
= GetObjectsMacro ( module
);
2213 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2214 string libsMacro
= GetLibsMacro ();
2216 GenerateImportLibraryTargetIfNeeded ();
2218 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2222 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2224 string linkerParameters
= ssprintf ( "-Wl,-T,%s%cntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
2225 module
.GetBasePath ().c_str (),
2227 module
.entrypoint
.c_str (),
2228 module
.baseaddress
.c_str () );
2229 GenerateLinkerCommand ( dependencies
,
2238 GeneratePhonyTarget();
2243 MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler (
2244 const Module
& module_
)
2246 : MingwModuleHandler ( module_
)
2251 MingwStaticLibraryModuleHandler::Process ()
2253 GenerateStaticLibraryModuleTarget ();
2257 MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ()
2263 MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler (
2264 const Module
& module_
)
2266 : MingwModuleHandler ( module_
)
2271 MingwObjectLibraryModuleHandler::Process ()
2273 GenerateObjectLibraryModuleTarget ();
2277 MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ()
2283 MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (
2284 const Module
& module_
)
2286 : MingwModuleHandler ( module_
)
2291 MingwKernelModeDLLModuleHandler::Process ()
2293 GenerateKernelModeDLLModuleTarget ();
2297 MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ()
2299 string
targetMacro ( GetTargetMacro ( module
) );
2300 string workingDirectory
= GetWorkingDirectory ( );
2301 string objectsMacro
= GetObjectsMacro ( module
);
2302 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2303 string libsMacro
= GetLibsMacro ();
2305 GenerateImportLibraryTargetIfNeeded ();
2307 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2311 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2313 string linkerParameters
= ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
2314 module
.entrypoint
.c_str (),
2315 module
.baseaddress
.c_str () );
2316 GenerateLinkerCommand ( dependencies
,
2325 GeneratePhonyTarget();
2330 MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler (
2331 const Module
& module_
)
2333 : MingwModuleHandler ( module_
)
2338 MingwKernelModeDriverModuleHandler::Process ()
2340 GenerateKernelModeDriverModuleTarget ();
2345 MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ()
2347 string
targetMacro ( GetTargetMacro (module
) );
2348 string workingDirectory
= GetWorkingDirectory ();
2349 string objectsMacro
= GetObjectsMacro ( module
);
2350 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2351 string libsMacro
= GetLibsMacro ();
2353 GenerateImportLibraryTargetIfNeeded ();
2355 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2359 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2361 string linkerParameters
= ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared",
2362 module
.entrypoint
.c_str (),
2363 module
.baseaddress
.c_str () );
2364 GenerateLinkerCommand ( dependencies
,
2373 GeneratePhonyTarget();
2378 MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler (
2379 const Module
& module_
)
2381 : MingwModuleHandler ( module_
)
2386 MingwNativeDLLModuleHandler::Process ()
2388 GenerateNativeDLLModuleTarget ();
2392 MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ()
2394 string
targetMacro ( GetTargetMacro (module
) );
2395 string workingDirectory
= GetWorkingDirectory ( );
2396 string objectsMacro
= GetObjectsMacro ( module
);
2397 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2398 string libsMacro
= GetLibsMacro ();
2400 GenerateImportLibraryTargetIfNeeded ();
2402 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2406 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2408 string linkerParameters
= ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -shared",
2409 module
.entrypoint
.c_str (),
2410 module
.baseaddress
.c_str () );
2411 GenerateLinkerCommand ( dependencies
,
2420 GeneratePhonyTarget();
2425 MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler (
2426 const Module
& module_
)
2428 : MingwModuleHandler ( module_
)
2433 MingwNativeCUIModuleHandler::Process ()
2435 GenerateNativeCUIModuleTarget ();
2439 MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ()
2441 string
targetMacro ( GetTargetMacro (module
) );
2442 string workingDirectory
= GetWorkingDirectory ( );
2443 string objectsMacro
= GetObjectsMacro ( module
);
2444 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2445 string libsMacro
= GetLibsMacro ();
2447 GenerateImportLibraryTargetIfNeeded ();
2449 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2453 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2455 string linkerParameters
= ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib",
2456 module
.entrypoint
.c_str (),
2457 module
.baseaddress
.c_str () );
2458 GenerateLinkerCommand ( dependencies
,
2467 GeneratePhonyTarget();
2472 MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler (
2473 const Module
& module_
)
2475 : MingwModuleHandler ( module_
)
2480 MingwWin32DLLModuleHandler::Process ()
2482 GenerateWin32DLLModuleTarget ();
2486 MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ()
2488 string
targetMacro ( GetTargetMacro (module
) );
2489 string workingDirectory
= GetWorkingDirectory ( );
2490 string objectsMacro
= GetObjectsMacro ( module
);
2491 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2492 string libsMacro
= GetLibsMacro ();
2494 GenerateImportLibraryTargetIfNeeded ();
2496 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2500 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2503 if ( module
.cplusplus
)
2508 string linkerParameters
= ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -shared",
2509 module
.entrypoint
.c_str (),
2510 module
.baseaddress
.c_str () );
2511 GenerateLinkerCommand ( dependencies
,
2520 GeneratePhonyTarget();
2525 MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler (
2526 const Module
& module_
)
2528 : MingwModuleHandler ( module_
)
2533 MingwWin32CUIModuleHandler::Process ()
2535 GenerateWin32CUIModuleTarget ();
2539 MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ()
2541 string
targetMacro ( GetTargetMacro (module
) );
2542 string workingDirectory
= GetWorkingDirectory ( );
2543 string objectsMacro
= GetObjectsMacro ( module
);
2544 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2545 string libsMacro
= GetLibsMacro ();
2547 GenerateImportLibraryTargetIfNeeded ();
2549 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2553 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2556 if ( module
.cplusplus
)
2561 string linkerParameters
= ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
2562 module
.entrypoint
.c_str (),
2563 module
.baseaddress
.c_str () );
2564 GenerateLinkerCommand ( dependencies
,
2573 GeneratePhonyTarget();
2578 MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler (
2579 const Module
& module_
)
2581 : MingwModuleHandler ( module_
)
2586 MingwWin32GUIModuleHandler::Process ()
2588 GenerateWin32GUIModuleTarget ();
2592 MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ()
2594 string
targetMacro ( GetTargetMacro (module
) );
2595 string workingDirectory
= GetWorkingDirectory ( );
2596 string objectsMacro
= GetObjectsMacro ( module
);
2597 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2598 string libsMacro
= GetLibsMacro ();
2600 GenerateImportLibraryTargetIfNeeded ();
2602 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
2606 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
2609 if ( module
.cplusplus
)
2614 string linkerParameters
= ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
2615 module
.entrypoint
.c_str (),
2616 module
.baseaddress
.c_str () );
2617 GenerateLinkerCommand ( dependencies
,
2626 GeneratePhonyTarget();
2631 MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler (
2632 const Module
& module_
)
2634 : MingwModuleHandler ( module_
)
2639 MingwBootLoaderModuleHandler::Process ()
2641 GenerateBootLoaderModuleTarget ();
2645 MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
2647 string
targetName ( module
.GetTargetName () );
2648 string
targetMacro ( GetTargetMacro (module
) );
2649 string workingDirectory
= GetWorkingDirectory ();
2650 string junk_tmp
= ros_temp
+ module
.name
+ ".junk.tmp";
2651 CLEAN_FILE ( junk_tmp
);
2652 string objectsMacro
= GetObjectsMacro ( module
);
2653 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2654 string libsMacro
= GetLibsMacro ();
2658 fprintf ( fMakefile
, "%s: %s %s | %s\n",
2659 targetMacro
.c_str (),
2660 objectsMacro
.c_str (),
2661 linkDepsMacro
.c_str (),
2662 GetDirectory(GetTargetFilename(module
,NULL
)).c_str () );
2664 fprintf ( fMakefile
, "\t$(ECHO_LD)\n" );
2666 fprintf ( fMakefile
,
2667 "\t${ld} %s -N -Ttext=0x8000 -o %s %s %s\n",
2668 GetLinkerMacro ().c_str (),
2670 objectsMacro
.c_str (),
2671 linkDepsMacro
.c_str () );
2672 fprintf ( fMakefile
,
2673 "\t${objcopy} -O binary %s $@\n",
2674 junk_tmp
.c_str () );
2675 fprintf ( fMakefile
,
2676 "\t-@${rm} %s 2>$(NUL)\n",
2677 junk_tmp
.c_str () );
2681 MingwBootSectorModuleHandler::MingwBootSectorModuleHandler (
2682 const Module
& module_
)
2684 : MingwModuleHandler ( module_
)
2689 MingwBootSectorModuleHandler::Process ()
2691 GenerateBootSectorModuleTarget ();
2695 MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ()
2697 string objectsMacro
= GetObjectsMacro ( module
);
2701 fprintf ( fMakefile
, ".PHONY: %s\n\n",
2702 module
.name
.c_str ());
2703 fprintf ( fMakefile
,
2705 module
.name
.c_str (),
2706 objectsMacro
.c_str () );
2710 MingwBootProgramModuleHandler::MingwBootProgramModuleHandler (
2711 const Module
& module_
)
2712 : MingwModuleHandler ( module_
)
2717 MingwBootProgramModuleHandler::Process ()
2719 GenerateBootProgramModuleTarget ();
2723 MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget ()
2725 string
targetName ( module
.GetTargetName () );
2726 string
targetMacro ( GetTargetMacro (module
) );
2727 string workingDirectory
= GetWorkingDirectory ();
2728 string junk_tmp
= ros_temp
+ module
.name
+ ".junk.tmp";
2729 string junk_elf
= ros_temp
+ module
.name
+ ".junk.elf";
2730 string junk_cpy
= ros_temp
+ module
.name
+ ".junk.cpy";
2731 CLEAN_FILE ( junk_tmp
);
2732 CLEAN_FILE ( junk_elf
);
2733 CLEAN_FILE ( junk_cpy
);
2734 string objectsMacro
= GetObjectsMacro ( module
);
2735 string linkDepsMacro
= GetLinkingDependenciesMacro ();
2736 string libsMacro
= GetLibsMacro ();
2737 const Module
*payload
= module
.project
.LocateModule ( module
.payload
);
2741 fprintf ( fMakefile
, "%s: %s %s %s | %s\n",
2742 targetMacro
.c_str (),
2743 objectsMacro
.c_str (),
2744 linkDepsMacro
.c_str (),
2745 payload
->name
.c_str (),
2746 GetDirectory(GetTargetFilename(module
,NULL
)).c_str () );
2748 fprintf ( fMakefile
, "\t$(ECHO_BOOTPROG)\n" );
2750 fprintf ( fMakefile
, "\t$(BOOTPROG_PREPARE) $(OUTPUT)$(SEP)%s %s\n",
2751 NormalizeFilename( payload
->GetPath() ).c_str (),
2752 junk_cpy
.c_str () );
2754 fprintf ( fMakefile
, "\t${objcopy} $(BOOTPROG_FLATFORMAT) %s %s\n",
2756 junk_tmp
.c_str () );
2758 fprintf ( fMakefile
, "\t${ld} $(BOOTPROG_LINKFORMAT) %s %s -g -o %s\n",
2759 linkDepsMacro
.c_str (),
2761 junk_elf
.c_str () );
2763 fprintf ( fMakefile
, "\t${objcopy} $(BOOTPROG_COPYFORMAT) %s %s\n",
2765 module
.GetPath().c_str () );
2767 fprintf ( fMakefile
,
2768 "\t-@${rm} %s %s %s 2>$(NUL)\n",
2769 junk_tmp
.c_str (), junk_elf
.c_str (), junk_cpy
.c_str () );
2773 MingwIsoModuleHandler::MingwIsoModuleHandler (
2774 const Module
& module_
)
2776 : MingwModuleHandler ( module_
)
2781 MingwIsoModuleHandler::Process ()
2783 GenerateIsoModuleTarget ();
2787 MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (
2788 const string
& bootcdDirectory
)
2790 for ( size_t i
= 0; i
< module
.project
.modules
.size (); i
++ )
2792 const Module
& m
= *module
.project
.modules
[i
];
2795 if ( m
.bootstrap
!= NULL
)
2797 string sourceFilename
= PassThruCacheDirectory (
2798 NormalizeFilename ( m
.GetPath () ),
2799 backend
->outputDirectory
);
2800 string
targetFilenameNoFixup ( bootcdDirectory
+ sSep
+ m
.bootstrap
->base
+ sSep
+ m
.bootstrap
->nameoncd
);
2801 string targetFilename
= MingwModuleHandler::PassThruCacheDirectory (
2802 NormalizeFilename ( targetFilenameNoFixup
),
2803 backend
->outputDirectory
);
2804 fprintf ( fMakefile
,
2806 fprintf ( fMakefile
,
2807 "\t${cp} %s %s 1>$(NUL)\n",
2808 sourceFilename
.c_str (),
2809 targetFilename
.c_str () );
2815 MingwIsoModuleHandler::OutputCdfileCopyCommands (
2816 const string
& bootcdDirectory
)
2818 for ( size_t i
= 0; i
< module
.project
.cdfiles
.size (); i
++ )
2820 const CDFile
& cdfile
= *module
.project
.cdfiles
[i
];
2821 string targetFilenameNoFixup
= bootcdDirectory
+ sSep
+ cdfile
.base
+ sSep
+ cdfile
.nameoncd
;
2822 string targetFilename
= MingwModuleHandler::PassThruCacheDirectory (
2823 NormalizeFilename ( targetFilenameNoFixup
),
2824 backend
->outputDirectory
);
2825 fprintf ( fMakefile
,
2827 fprintf ( fMakefile
,
2828 "\t${cp} %s %s 1>$(NUL)\n",
2829 cdfile
.GetPath ().c_str (),
2830 targetFilename
.c_str () );
2835 MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string
& bootcdDirectory
)
2838 for ( size_t i
= 0; i
< module
.project
.modules
.size (); i
++ )
2840 const Module
& m
= *module
.project
.modules
[i
];
2843 if ( m
.bootstrap
!= NULL
)
2845 string
targetDirectory ( bootcdDirectory
+ sSep
+ m
.bootstrap
->base
);
2846 if ( directories
.size () > 0 )
2848 directories
+= PassThruCacheDirectory (
2849 NormalizeFilename ( targetDirectory
),
2850 backend
->outputDirectory
);
2857 MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string
& bootcdDirectory
)
2860 for ( size_t i
= 0; i
< module
.project
.cdfiles
.size (); i
++ )
2862 const CDFile
& cdfile
= *module
.project
.cdfiles
[i
];
2863 string
targetDirectory ( bootcdDirectory
+ sSep
+ cdfile
.base
);
2864 if ( directories
.size () > 0 )
2866 directories
+= PassThruCacheDirectory (
2867 NormalizeFilename ( targetDirectory
),
2868 backend
->outputDirectory
);
2874 MingwIsoModuleHandler::GetCdDirectories ( const string
& bootcdDirectory
)
2876 string directories
= GetBootstrapCdDirectories ( bootcdDirectory
);
2877 directories
+= " " + GetNonModuleCdDirectories ( bootcdDirectory
);
2882 MingwIsoModuleHandler::GetBootstrapCdFiles (
2883 vector
<string
>& out
) const
2885 for ( size_t i
= 0; i
< module
.project
.modules
.size (); i
++ )
2887 const Module
& m
= *module
.project
.modules
[i
];
2890 if ( m
.bootstrap
!= NULL
)
2892 string filename
= PassThruCacheDirectory (
2893 NormalizeFilename ( m
.GetPath () ),
2894 backend
->outputDirectory
);
2895 out
.push_back ( filename
);
2901 MingwIsoModuleHandler::GetNonModuleCdFiles (
2902 vector
<string
>& out
) const
2904 for ( size_t i
= 0; i
< module
.project
.cdfiles
.size (); i
++ )
2906 const CDFile
& cdfile
= *module
.project
.cdfiles
[i
];
2907 out
.push_back ( cdfile
.GetPath () );
2912 MingwIsoModuleHandler::GetCdFiles (
2913 vector
<string
>& out
) const
2915 GetBootstrapCdFiles ( out
);
2916 GetNonModuleCdFiles ( out
);
2920 MingwIsoModuleHandler::GenerateIsoModuleTarget ()
2922 string bootcdDirectory
= "cd";
2923 string bootcd
= PassThruCacheDirectory (
2924 NormalizeFilename ( bootcdDirectory
+ sSep
),
2925 backend
->outputDirectory
);
2926 string isoboot
= PassThruCacheDirectory (
2927 NormalizeFilename ( "boot" + sSep
+ "freeldr" + sSep
+ "bootsect" + sSep
+ "isoboot.o" ),
2928 backend
->outputDirectory
);
2929 string bootcdReactosNoFixup
= bootcdDirectory
+ sSep
+ "reactos";
2930 string bootcdReactos
= PassThruCacheDirectory (
2931 NormalizeFilename ( bootcdReactosNoFixup
+ sSep
),
2932 backend
->outputDirectory
);
2933 CLEAN_FILE ( bootcdReactos
);
2934 string reactosInf
= PassThruCacheDirectory (
2935 NormalizeFilename ( bootcdReactosNoFixup
+ sSep
+ "reactos.inf" ),
2936 backend
->outputDirectory
);
2937 string reactosDff
= NormalizeFilename ( "bootdata" + sSep
+ "packages" + sSep
+ "reactos.dff" );
2938 string cdDirectories
= GetCdDirectories ( bootcdDirectory
);
2939 vector
<string
> vCdFiles
;
2940 GetCdFiles ( vCdFiles
);
2941 string cdFiles
= v2s ( vCdFiles
, 5 );
2943 fprintf ( fMakefile
, ".PHONY: %s\n\n",
2944 module
.name
.c_str ());
2945 fprintf ( fMakefile
,
2946 "%s: all %s %s %s %s $(CABMAN_TARGET) $(CDMAKE_TARGET)\n",
2947 module
.name
.c_str (),
2949 bootcdReactos
.c_str (),
2950 cdDirectories
.c_str (),
2952 fprintf ( fMakefile
, "\t$(ECHO_CABMAN)\n" );
2953 fprintf ( fMakefile
,
2954 "\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I -P $(OUTPUT)\n",
2955 reactosDff
.c_str (),
2956 bootcdReactos
.c_str () );
2957 fprintf ( fMakefile
,
2958 "\t$(Q)$(CABMAN_TARGET) -C %s -RC %s -L %s -N -P $(OUTPUT)\n",
2959 reactosDff
.c_str (),
2960 reactosInf
.c_str (),
2961 bootcdReactos
.c_str ());
2962 fprintf ( fMakefile
,
2963 "\t-@${rm} %s 2>$(NUL)\n",
2964 reactosInf
.c_str () );
2965 OutputBootstrapfileCopyCommands ( bootcdDirectory
);
2966 OutputCdfileCopyCommands ( bootcdDirectory
);
2967 fprintf ( fMakefile
, "\t$(ECHO_CDMAKE)\n" );
2968 fprintf ( fMakefile
,
2969 "\t$(Q)$(CDMAKE_TARGET) -v -m -b %s %s REACTOS ReactOS.iso\n",
2972 fprintf ( fMakefile
,
2977 MingwLiveIsoModuleHandler::MingwLiveIsoModuleHandler (
2978 const Module
& module_
)
2980 : MingwModuleHandler ( module_
)
2985 MingwLiveIsoModuleHandler::Process ()
2987 GenerateLiveIsoModuleTarget ();
2991 MingwLiveIsoModuleHandler::CreateDirectory ( const string
& directory
)
2993 string normalizedDirectory
= MingwModuleHandler::PassThruCacheDirectory (
2994 NormalizeFilename ( directory
) + sSep
,
2995 backend
->outputDirectory
);
2999 MingwLiveIsoModuleHandler::OutputCopyCommand ( const string
& sourceFilename
,
3000 const string
& targetFilename
,
3001 const string
& targetDirectory
)
3003 string normalizedTargetFilename
= MingwModuleHandler::PassThruCacheDirectory (
3004 NormalizeFilename ( targetDirectory
+ sSep
+ targetFilename
),
3005 backend
->outputDirectory
);
3006 fprintf ( fMakefile
,
3008 fprintf ( fMakefile
,
3009 "\t${cp} %s %s 1>$(NUL)\n",
3010 sourceFilename
.c_str (),
3011 normalizedTargetFilename
.c_str () );
3015 MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string
& livecdDirectory
,
3016 string
& reactosDirectory
)
3018 for ( size_t i
= 0; i
< module
.project
.modules
.size (); i
++ )
3020 const Module
& m
= *module
.project
.modules
[i
];
3023 if ( m
.installName
.length () > 0 )
3025 const Module
& aliasedModule
= backend
->GetAliasedModuleOrModule ( m
);
3026 string sourceFilename
= MingwModuleHandler::PassThruCacheDirectory (
3027 NormalizeFilename ( aliasedModule
.GetPath () ),
3028 backend
->outputDirectory
);
3029 OutputCopyCommand ( sourceFilename
,
3031 livecdDirectory
+ sSep
+ reactosDirectory
+ sSep
+ m
.installBase
);
3037 MingwLiveIsoModuleHandler::OutputNonModuleCopyCommands ( string
& livecdDirectory
,
3038 string
& reactosDirectory
)
3040 for ( size_t i
= 0; i
< module
.project
.installfiles
.size (); i
++ )
3042 const InstallFile
& installfile
= *module
.project
.installfiles
[i
];
3043 OutputCopyCommand ( installfile
.GetPath (),
3044 installfile
.newname
,
3045 livecdDirectory
+ sSep
+ reactosDirectory
+ sSep
+ installfile
.base
);
3050 MingwLiveIsoModuleHandler::OutputProfilesDirectoryCommands ( string
& livecdDirectory
)
3052 CreateDirectory ( livecdDirectory
+ sSep
+ "Profiles" );
3053 CreateDirectory ( livecdDirectory
+ sSep
+ "Profiles" + sSep
+ "All Users") ;
3054 CreateDirectory ( livecdDirectory
+ sSep
+ "Profiles" + sSep
+ "All Users" + sSep
+ "Desktop" );
3055 CreateDirectory ( livecdDirectory
+ sSep
+ "Profiles" + sSep
+ "Default User" );
3056 CreateDirectory ( livecdDirectory
+ sSep
+ "Profiles" + sSep
+ "Default User" + sSep
+ "Desktop" );
3057 CreateDirectory ( livecdDirectory
+ sSep
+ "Profiles" + sSep
+ "Default User" + sSep
+ "My Documents" );
3059 string livecdIni
= "bootdata" + sSep
+ "livecd.ini";
3060 OutputCopyCommand ( livecdIni
,
3066 MingwLiveIsoModuleHandler::OutputLoaderCommands ( string
& livecdDirectory
)
3068 string freeldr
= PassThruCacheDirectory (
3069 NormalizeFilename ( "boot" + sSep
+ "freeldr" + sSep
+ "freeldr" + sSep
+ "freeldr.sys" ),
3070 backend
->outputDirectory
);
3071 CreateDirectory ( livecdDirectory
+ sSep
+ "loader" );
3072 OutputCopyCommand ( freeldr
,
3074 livecdDirectory
+ sSep
+ "loader" );
3078 MingwLiveIsoModuleHandler::OutputRegistryCommands ( string
& livecdDirectory
)
3080 string reactosSystem32ConfigDirectory
= NormalizeFilename (
3081 MingwModuleHandler::PassThruCacheDirectory (
3082 livecdDirectory
+ sSep
+ "reactos" + sSep
+ "system32" + sSep
+ "config" + sSep
,
3083 backend
->outputDirectory
) );
3084 fprintf ( fMakefile
,
3085 "\t$(ECHO_MKHIVE)\n" );
3086 fprintf ( fMakefile
,
3087 "\t$(MKHIVE_TARGET) bootdata %s bootdata%clivecd.inf bootdata%chiveinst.inf\n",
3088 reactosSystem32ConfigDirectory
.c_str (),
3094 MingwLiveIsoModuleHandler::GenerateLiveIsoModuleTarget ()
3096 string livecdDirectory
= "livecd";
3097 string livecd
= PassThruCacheDirectory (
3098 NormalizeFilename ( livecdDirectory
+ sSep
),
3099 backend
->outputDirectory
);
3100 string isoboot
= PassThruCacheDirectory (
3101 NormalizeFilename ( "boot" + sSep
+ "freeldr" + sSep
+ "bootsect" + sSep
+ "isoboot.o" ),
3102 backend
->outputDirectory
);
3103 string reactosDirectory
= "reactos";
3104 string livecdReactosNoFixup
= livecdDirectory
+ sSep
+ reactosDirectory
;
3105 string livecdReactos
= NormalizeFilename ( PassThruCacheDirectory (
3106 NormalizeFilename ( livecdReactosNoFixup
+ sSep
),
3107 backend
->outputDirectory
) );
3108 CLEAN_FILE ( livecdReactos
);
3110 fprintf ( fMakefile
, ".PHONY: %s\n\n",
3111 module
.name
.c_str ());
3112 fprintf ( fMakefile
,
3113 "%s: all %s %s $(MKHIVE_TARGET) $(CDMAKE_TARGET)\n",
3114 module
.name
.c_str (),
3116 livecdReactos
.c_str () );
3117 OutputModuleCopyCommands ( livecdDirectory
,
3119 OutputNonModuleCopyCommands ( livecdDirectory
,
3121 OutputProfilesDirectoryCommands ( livecdDirectory
);
3122 OutputLoaderCommands ( livecdDirectory
);
3123 OutputRegistryCommands ( livecdDirectory
);
3124 fprintf ( fMakefile
, "\t$(ECHO_CDMAKE)\n" );
3125 fprintf ( fMakefile
,
3126 "\t$(Q)$(CDMAKE_TARGET) -v -m -j -b %s %s REACTOS ReactOS-LiveCD.iso\n",
3129 fprintf ( fMakefile
,
3134 MingwTestModuleHandler::MingwTestModuleHandler (
3135 const Module
& module_
)
3137 : MingwModuleHandler ( module_
)
3142 MingwTestModuleHandler::Process ()
3144 GenerateTestModuleTarget ();
3148 MingwTestModuleHandler::GetModuleSpecificCompilationUnits ( vector
<CompilationUnit
*>& compilationUnits
)
3150 string basePath
= "$(INTERMEDIATE)" + sSep
+ module
.GetBasePath ();
3151 compilationUnits
.push_back ( new CompilationUnit ( new File ( basePath
+ sSep
+ "_hooks.c", false, "", false ) ) );
3152 compilationUnits
.push_back ( new CompilationUnit ( new File ( basePath
+ sSep
+ "_stubs.S", false, "", false ) ) );
3153 compilationUnits
.push_back ( new CompilationUnit ( new File ( basePath
+ sSep
+ "_startup.c", false, "", false ) ) );
3157 MingwTestModuleHandler::GenerateTestModuleTarget ()
3159 string
targetMacro ( GetTargetMacro ( module
) );
3160 string workingDirectory
= GetWorkingDirectory ( );
3161 string objectsMacro
= GetObjectsMacro ( module
);
3162 string linkDepsMacro
= GetLinkingDependenciesMacro ();
3163 string libsMacro
= GetLibsMacro ();
3165 GenerateImportLibraryTargetIfNeeded ();
3167 if ( module
.non_if_data
.compilationUnits
.size () > 0 )
3171 string dependencies
= linkDepsMacro
+ " " + objectsMacro
;
3174 if ( module
.cplusplus
)
3179 string linkerParameters
= ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",
3180 module
.entrypoint
.c_str (),
3181 module
.baseaddress
.c_str () );
3182 GenerateLinkerCommand ( dependencies
,
3191 GeneratePhonyTarget();
3196 MingwRpcServerModuleHandler::MingwRpcServerModuleHandler (
3197 const Module
& module_
)
3199 : MingwModuleHandler ( module_
)
3204 MingwRpcServerModuleHandler::Process ()
3210 MingwRpcClientModuleHandler::MingwRpcClientModuleHandler (
3211 const Module
& module_
)
3213 : MingwModuleHandler ( module_
)
3218 MingwRpcClientModuleHandler::Process ()
3224 MingwAliasModuleHandler::MingwAliasModuleHandler (
3225 const Module
& module_
)
3227 : MingwModuleHandler ( module_
)
3232 MingwAliasModuleHandler::Process ()