7 #include "modulehandler.h"
10 #define MKDIR(s) mkdir(s)
12 #define MKDIR(s) mkdir(s, 0755)
20 typedef set
<string
> set_string
;
24 v2s ( const string_list
& v
, int wrap_at
)
30 for ( size_t i
= 0; i
< v
.size(); i
++ )
34 if ( wrap_at
> 0 && wrap_count
++ == wrap_at
)
44 Directory::Directory ( const string
& name_
)
50 Directory::Add ( const char* subdir
)
53 string s1
= string ( subdir
);
54 if ( ( i
= s1
.find ( '$' ) ) != string::npos
)
56 throw InvalidOperationException ( __FILE__
,
58 "No environment variables can be used here. Path was %s",
62 const char* p
= strpbrk ( subdir
, "/\\" );
64 p
= subdir
+ strlen(subdir
);
65 string
s ( subdir
, p
-subdir
);
66 if ( subdirs
.find(s
) == subdirs
.end() )
67 subdirs
[s
] = new Directory(s
);
69 subdirs
[s
]->Add ( p
);
73 Directory::mkdir_p ( const char* path
)
76 directory
= opendir ( path
);
77 if ( directory
!= NULL
)
79 closedir ( directory
);
83 if ( MKDIR ( path
) != 0 )
84 throw AccessDeniedException ( string ( path
) );
89 Directory::CreateDirectory ( string path
)
93 if ( isalpha ( path
[0] ) && path
[1] == ':' && path
[2] == CSEP
)
95 nextIndex
= path
.find ( CSEP
, 3);
98 nextIndex
= path
.find ( CSEP
);
100 bool directoryWasCreated
= false;
101 while ( nextIndex
!= string::npos
)
103 nextIndex
= path
.find ( CSEP
, index
+ 1 );
104 directoryWasCreated
= mkdir_p ( path
.substr ( 0, nextIndex
).c_str () );
107 return directoryWasCreated
;
111 Directory::ReplaceVariable ( string name
,
115 size_t i
= path
.find ( name
);
116 if ( i
!= string::npos
)
117 return path
.replace ( i
, name
.length (), value
);
123 Directory::ResolveVariablesInPath ( char* buf
,
126 string s
= ReplaceVariable ( "$(INTERMEDIATE)", Environment::GetIntermediatePath (), path
);
127 s
= ReplaceVariable ( "$(OUTPUT)", Environment::GetOutputPath (), s
);
128 s
= ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s
);
129 strcpy ( buf
, s
.c_str () );
133 Directory::GenerateTree ( const string
& parent
,
138 if ( parent
.size () > 0 )
142 path
= parent
+ SSEP
+ name
;
143 ResolveVariablesInPath ( buf
, path
);
144 if ( CreateDirectory ( buf
) && verbose
)
145 printf ( "Created %s\n", buf
);
150 for ( directory_map::iterator i
= subdirs
.begin ();
154 i
->second
->GenerateTree ( path
, verbose
);
159 Directory::EscapeSpaces ( string path
)
166 newpath
= newpath
+ "\\ ";
168 newpath
= newpath
+ *p
;
175 Directory::CreateRule ( FILE* f
,
176 const string
& parent
)
180 if ( parent
.size() > 0 )
182 string escapedParent
= EscapeSpaces ( parent
);
185 escapedParent
.c_str (),
187 EscapeSpaces ( name
).c_str (),
188 escapedParent
.c_str () );
191 "\t$(ECHO_MKDIR)\n" );
196 path
= parent
+ SSEP
+ name
;
201 for ( directory_map::iterator i
= subdirs
.begin();
205 i
->second
->CreateRule ( f
, path
);
210 static class MingwFactory
: public Backend::Factory
213 MingwFactory() : Factory ( "mingw" ) {}
214 Backend
* operator() ( Project
& project
,
215 Configuration
& configuration
)
217 return new MingwBackend ( project
,
223 MingwBackend::MingwBackend ( Project
& project
,
224 Configuration
& configuration
)
225 : Backend ( project
, configuration
),
226 intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ),
227 outputDirectory ( new Directory ( "$(OUTPUT)" ) ),
228 installDirectory ( new Directory ( "$(INSTALL)" ) )
233 MingwBackend::~MingwBackend()
235 delete intermediateDirectory
;
236 delete outputDirectory
;
237 delete installDirectory
;
241 MingwBackend::AddDirectoryTarget ( const string
& directory
,
242 Directory
* directoryTree
)
244 if ( directory
.length () > 0)
245 directoryTree
->Add ( directory
.c_str() );
246 return directoryTree
->name
;
250 MingwBackend::ProcessModules ()
252 printf ( "Processing modules..." );
254 vector
<MingwModuleHandler
*> v
;
256 for ( i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
258 Module
& module
= *ProjectNode
.modules
[i
];
259 if ( !module
.enabled
)
261 MingwModuleHandler
* h
= MingwModuleHandler::InstanciateHandler (
264 if ( module
.host
== HostDefault
)
266 module
.host
= h
->DefaultHost();
267 assert ( module
.host
!= HostDefault
);
272 size_t iend
= v
.size ();
274 for ( i
= 0; i
< iend
; i
++ )
275 v
[i
]->GenerateObjectMacro();
276 fprintf ( fMakefile
, "\n" );
277 for ( i
= 0; i
< iend
; i
++ )
278 v
[i
]->GenerateTargetMacro();
279 fprintf ( fMakefile
, "\n" );
281 GenerateAllTarget ( v
);
282 GenerateInitTarget ();
283 GenerateRegTestsRunTarget ();
285 for ( i
= 0; i
< iend
; i
++ )
286 v
[i
]->GenerateOtherMacros();
288 for ( i
= 0; i
< iend
; i
++ )
290 MingwModuleHandler
& h
= *v
[i
];
291 h
.GeneratePreconditionDependencies ();
293 h
.GenerateInvocations ();
294 h
.GenerateCleanTarget ();
295 h
.GenerateInstallTarget ();
296 h
.GenerateDependsTarget ();
304 MingwBackend::Process ()
306 if ( configuration
.CheckDependenciesForModuleOnly
)
307 CheckAutomaticDependenciesForModuleOnly ();
313 MingwBackend::CheckAutomaticDependenciesForModuleOnly ()
315 if ( configuration
.AutomaticDependencies
)
317 Module
* module
= ProjectNode
.LocateModule ( configuration
.CheckDependenciesForModuleOnlyModule
);
318 if ( module
== NULL
)
320 printf ( "Module '%s' does not exist\n",
321 configuration
.CheckDependenciesForModuleOnlyModule
.c_str () );
325 printf ( "Checking automatic dependencies for module '%s'...",
326 module
->name
.c_str () );
327 AutomaticDependency
automaticDependency ( ProjectNode
);
328 automaticDependency
.CheckAutomaticDependencies ( *module
,
329 configuration
.Verbose
);
335 MingwBackend::ProcessNormal ()
338 DetectNetwideAssembler ();
339 DetectPipeSupport ();
343 GenerateGlobalVariables ();
344 GenerateXmlBuildFilesMacro ();
346 GenerateInstallTarget ();
347 GenerateTestTarget ();
348 GenerateDirectoryTargets ();
349 GenerateDirectories ();
350 UnpackWineResources ();
351 GenerateTestSupportCode ();
352 GenerateProxyMakefiles ();
353 CheckAutomaticDependencies ();
358 MingwBackend::CreateMakefile ()
360 fMakefile
= fopen ( ProjectNode
.makefile
.c_str (), "w" );
362 throw AccessDeniedException ( ProjectNode
.makefile
);
363 MingwModuleHandler::SetBackend ( this );
364 MingwModuleHandler::SetMakefile ( fMakefile
);
365 MingwModuleHandler::SetUsePch ( use_pch
);
369 MingwBackend::CloseMakefile () const
372 fclose ( fMakefile
);
376 MingwBackend::GenerateHeader () const
378 fprintf ( fMakefile
, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" );
382 MingwBackend::GenerateIncludesAndDefines ( IfableData
& data
) const
384 string includeParameters
= MingwModuleHandler::GenerateGccIncludeParametersFromVector ( data
.includes
);
385 string defineParameters
= MingwModuleHandler::GenerateGccDefineParametersFromVector ( data
.defines
);
386 return includeParameters
+ " " + defineParameters
;
390 MingwBackend::GenerateProjectCFlagsMacro ( const char* assignmentOperation
,
391 IfableData
& data
) const
396 assignmentOperation
);
400 GenerateIncludesAndDefines ( data
).c_str() );
402 fprintf ( fMakefile
, "\n" );
406 MingwBackend::GenerateGlobalCFlagsAndProperties (
407 const char* assignmentOperation
,
408 IfableData
& data
) const
412 for ( i
= 0; i
< data
.properties
.size(); i
++ )
414 Property
& prop
= *data
.properties
[i
];
415 fprintf ( fMakefile
, "%s := %s\n",
417 prop
.value
.c_str() );
420 if ( data
.includes
.size() || data
.defines
.size() )
422 GenerateProjectCFlagsMacro ( assignmentOperation
,
426 for ( i
= 0; i
< data
.ifs
.size(); i
++ )
428 If
& rIf
= *data
.ifs
[i
];
429 if ( rIf
.data
.defines
.size()
430 || rIf
.data
.includes
.size()
431 || rIf
.data
.ifs
.size() )
435 "ifeq (\"$(%s)\",\"%s\")\n",
436 rIf
.property
.c_str(),
438 GenerateGlobalCFlagsAndProperties (
449 MingwBackend::GenerateProjectGccOptionsMacro ( const char* assignmentOperation
,
450 IfableData
& data
) const
456 "PROJECT_GCCOPTIONS %s",
457 assignmentOperation
);
459 for ( i
= 0; i
< data
.compilerFlags
.size(); i
++ )
464 data
.compilerFlags
[i
]->flag
.c_str() );
467 fprintf ( fMakefile
, "\n" );
471 MingwBackend::GenerateProjectGccOptions (
472 const char* assignmentOperation
,
473 IfableData
& data
) const
477 if ( data
.compilerFlags
.size() )
479 GenerateProjectGccOptionsMacro ( assignmentOperation
,
483 for ( i
= 0; i
< data
.ifs
.size(); i
++ )
485 If
& rIf
= *data
.ifs
[i
];
486 if ( rIf
.data
.compilerFlags
.size()
487 || rIf
.data
.ifs
.size() )
491 "ifeq (\"$(%s)\",\"%s\")\n",
492 rIf
.property
.c_str(),
494 GenerateProjectGccOptions (
505 MingwBackend::GenerateProjectLFLAGS () const
508 for ( size_t i
= 0; i
< ProjectNode
.linkerFlags
.size (); i
++ )
510 LinkerFlag
& linkerFlag
= *ProjectNode
.linkerFlags
[i
];
511 if ( lflags
.length () > 0 )
513 lflags
+= linkerFlag
.flag
;
519 MingwBackend::GenerateGlobalVariables () const
523 compilerPrefix
.c_str () );
526 nasmCommand
.c_str () );
528 GenerateGlobalCFlagsAndProperties ( "=", ProjectNode
.non_if_data
);
529 GenerateProjectGccOptions ( "=", ProjectNode
.non_if_data
);
531 fprintf ( fMakefile
, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS)\n" );
532 fprintf ( fMakefile
, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS)\n" );
533 fprintf ( fMakefile
, "PROJECT_LFLAGS := %s\n",
534 GenerateProjectLFLAGS ().c_str () );
535 fprintf ( fMakefile
, "PROJECT_CFLAGS += -Wall\n" );
536 fprintf ( fMakefile
, "PROJECT_CFLAGS += $(PROJECT_GCCOPTIONS)\n" );
537 fprintf ( fMakefile
, "\n" );
541 MingwBackend::IncludeInAllTarget ( const Module
& module
) const
543 if ( MingwModuleHandler::ReferenceObjects ( module
) )
545 if ( module
.type
== BootSector
)
547 if ( module
.type
== Iso
)
549 if ( module
.type
== LiveIso
)
551 if ( module
.type
== Test
)
557 MingwBackend::GenerateAllTarget ( const vector
<MingwModuleHandler
*>& handlers
) const
559 fprintf ( fMakefile
, "all:" );
561 size_t iend
= handlers
.size ();
562 for ( size_t i
= 0; i
< iend
; i
++ )
564 const Module
& module
= handlers
[i
]->module
;
565 if ( IncludeInAllTarget ( module
) )
567 if ( wrap_count
++ == 5 )
568 fprintf ( fMakefile
, " \\\n\t\t" ), wrap_count
= 0;
571 GetTargetMacro(module
).c_str () );
574 fprintf ( fMakefile
, "\n\t\n\n" );
578 MingwBackend::GetBuildToolDependencies () const
581 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
583 Module
& module
= *ProjectNode
.modules
[i
];
584 if ( !module
.enabled
)
586 if ( module
.type
== BuildTool
)
588 if ( dependencies
.length () > 0 )
590 dependencies
+= module
.GetDependencyPath ();
597 MingwBackend::GenerateInitTarget () const
601 GetBuildToolDependencies ().c_str () );
602 fprintf ( fMakefile
, "\n" );
606 MingwBackend::GenerateRegTestsRunTarget () const
609 "REGTESTS_RUN_TARGET = regtests.dll\n" );
611 "$(REGTESTS_RUN_TARGET): $(REGTESTS_TARGET)\n" );
613 "\t$(cp) $(REGTESTS_TARGET) $(REGTESTS_RUN_TARGET)\n" );
614 fprintf ( fMakefile
, "\n" );
618 MingwBackend::GenerateXmlBuildFilesMacro() const
621 "XMLBUILDFILES = %s \\\n",
622 ProjectNode
.GetProjectFilename ().c_str () );
623 string xmlbuildFilenames
;
624 int numberOfExistingFiles
= 0;
625 for ( size_t i
= 0; i
< ProjectNode
.xmlbuildfiles
.size (); i
++ )
627 XMLInclude
& xmlbuildfile
= *ProjectNode
.xmlbuildfiles
[i
];
628 if ( !xmlbuildfile
.fileExists
)
630 numberOfExistingFiles
++;
631 if ( xmlbuildFilenames
.length () > 0 )
632 xmlbuildFilenames
+= " ";
633 xmlbuildFilenames
+= NormalizeFilename ( xmlbuildfile
.topIncludeFilename
);
634 if ( numberOfExistingFiles
% 5 == 4 || i
== ProjectNode
.xmlbuildfiles
.size () - 1 )
638 xmlbuildFilenames
.c_str ());
639 if ( i
== ProjectNode
.xmlbuildfiles
.size () - 1 )
641 fprintf ( fMakefile
, "\n" );
648 xmlbuildFilenames
.resize ( 0 );
650 numberOfExistingFiles
++;
652 fprintf ( fMakefile
, "\n" );
656 MingwBackend::GetBin2ResExecutable ()
658 return NormalizeFilename ( Environment::GetOutputPath () + SSEP
+ "tools/bin2res/bin2res" + EXEPOSTFIX
);
662 MingwBackend::UnpackWineResources ()
664 printf ( "Unpacking WINE resources..." );
665 WineResource
wineResource ( ProjectNode
,
666 GetBin2ResExecutable () );
667 wineResource
.UnpackResources ( configuration
.Verbose
);
672 MingwBackend::GenerateTestSupportCode ()
674 printf ( "Generating test support code..." );
675 TestSupportCode
testSupportCode ( ProjectNode
);
676 testSupportCode
.GenerateTestSupportCode ( configuration
.Verbose
);
681 MingwBackend::GetProxyMakefileTree () const
683 if ( configuration
.GenerateProxyMakefilesInSourceTree
)
686 return Environment::GetOutputPath ();
690 MingwBackend::GenerateProxyMakefiles ()
692 printf ( "Generating proxy makefiles..." );
693 ProxyMakefile
proxyMakefile ( ProjectNode
);
694 proxyMakefile
.GenerateProxyMakefiles ( configuration
.Verbose
,
695 GetProxyMakefileTree () );
700 MingwBackend::CheckAutomaticDependencies ()
702 if ( configuration
.AutomaticDependencies
)
704 printf ( "Checking automatic dependencies..." );
705 AutomaticDependency
automaticDependency ( ProjectNode
);
706 automaticDependency
.CheckAutomaticDependencies ( configuration
.Verbose
);
712 MingwBackend::IncludeDirectoryTarget ( const string
& directory
) const
714 if ( directory
== "$(INTERMEDIATE)" SSEP
"tools")
721 MingwBackend::GenerateDirectories ()
723 printf ( "Creating directories..." );
724 intermediateDirectory
->GenerateTree ( "", configuration
.Verbose
);
725 outputDirectory
->GenerateTree ( "", configuration
.Verbose
);
726 if ( !configuration
.MakeHandlesInstallDirectories
)
727 installDirectory
->GenerateTree ( "", configuration
.Verbose
);
732 MingwBackend::TryToDetectThisCompiler ( const string
& compiler
)
734 string command
= ssprintf (
739 int exitcode
= system ( command
.c_str () );
740 return (exitcode
== 0);
744 MingwBackend::DetectCompiler ()
746 printf ( "Detecting compiler..." );
748 bool detectedCompiler
= false;
749 const string
& ROS_PREFIXValue
= Environment::GetVariable ( "ROS_PREFIX" );
750 if ( ROS_PREFIXValue
.length () > 0 )
752 compilerPrefix
= ROS_PREFIXValue
;
753 compilerCommand
= compilerPrefix
+ "-gcc";
754 detectedCompiler
= TryToDetectThisCompiler ( compilerCommand
);
757 if ( !detectedCompiler
)
760 compilerCommand
= "gcc";
761 detectedCompiler
= TryToDetectThisCompiler ( compilerCommand
);
764 if ( !detectedCompiler
)
766 compilerPrefix
= "mingw32";
767 compilerCommand
= compilerPrefix
+ "-gcc";
768 detectedCompiler
= TryToDetectThisCompiler ( compilerCommand
);
770 if ( detectedCompiler
)
771 printf ( "detected (%s)\n", compilerCommand
.c_str () );
773 printf ( "not detected\n" );
777 MingwBackend::TryToDetectThisNetwideAssembler ( const string
& assembler
)
779 string command
= ssprintf (
784 int exitcode
= system ( command
.c_str () );
785 return (exitcode
== 0);
789 MingwBackend::DetectNetwideAssembler ()
791 printf ( "Detecting netwide assembler..." );
793 nasmCommand
= "nasm";
794 bool detectedNasm
= TryToDetectThisNetwideAssembler ( nasmCommand
);
798 nasmCommand
= "nasmw";
799 detectedNasm
= TryToDetectThisNetwideAssembler ( nasmCommand
);
803 printf ( "detected (%s)\n", nasmCommand
.c_str () );
805 printf ( "not detected\n" );
809 MingwBackend::DetectPipeSupport ()
811 printf ( "Detecting compiler -pipe support..." );
813 string pipe_detection
= "tools" SSEP
"rbuild" SSEP
"backend" SSEP
"mingw" SSEP
"pipe_detection.c";
814 string pipe_detectionObjectFilename
= ReplaceExtension ( pipe_detection
,
816 string command
= ssprintf (
817 "%s -pipe -c %s -o %s 1>%s 2>%s",
818 compilerCommand
.c_str (),
819 pipe_detection
.c_str (),
820 pipe_detectionObjectFilename
.c_str (),
823 int exitcode
= system ( command
.c_str () );
824 FILE* f
= fopen ( pipe_detectionObjectFilename
.c_str (), "rb" );
827 usePipe
= (exitcode
== 0);
829 unlink ( pipe_detectionObjectFilename
.c_str () );
835 printf ( "detected\n" );
837 printf ( "not detected\n" );
841 MingwBackend::DetectPCHSupport ()
843 printf ( "Detecting compiler pre-compiled header support..." );
845 string path
= "tools" SSEP
"rbuild" SSEP
"backend" SSEP
"mingw" SSEP
"pch_detection.h";
846 string cmd
= ssprintf (
847 "%s -c %s 1>%s 2>%s",
848 compilerCommand
.c_str (),
852 system ( cmd
.c_str () );
855 FILE* f
= fopen ( path
.c_str (), "rb" );
860 unlink ( path
.c_str () );
866 printf ( "detected\n" );
868 printf ( "not detected\n" );
872 MingwBackend::GetNonModuleInstallTargetFiles (
873 vector
<string
>& out
) const
875 for ( size_t i
= 0; i
< ProjectNode
.installfiles
.size (); i
++ )
877 const InstallFile
& installfile
= *ProjectNode
.installfiles
[i
];
878 string targetFilenameNoFixup
= installfile
.base
+ SSEP
+ installfile
.newname
;
879 string targetFilename
= MingwModuleHandler::PassThruCacheDirectory (
880 NormalizeFilename ( targetFilenameNoFixup
),
882 out
.push_back ( targetFilename
);
887 MingwBackend::GetModuleInstallTargetFiles (
888 vector
<string
>& out
) const
890 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
892 const Module
& module
= *ProjectNode
.modules
[i
];
893 if ( !module
.enabled
)
895 if ( module
.installName
.length () > 0 )
897 string targetFilenameNoFixup
;
898 if ( module
.installBase
.length () > 0 )
899 targetFilenameNoFixup
= module
.installBase
+ SSEP
+ module
.installName
;
901 targetFilenameNoFixup
= module
.installName
;
902 string targetFilename
= MingwModuleHandler::PassThruCacheDirectory (
903 NormalizeFilename ( targetFilenameNoFixup
),
905 out
.push_back ( targetFilename
);
911 MingwBackend::GetInstallTargetFiles (
912 vector
<string
>& out
) const
914 GetNonModuleInstallTargetFiles ( out
);
915 GetModuleInstallTargetFiles ( out
);
919 MingwBackend::OutputInstallTarget ( const string
& sourceFilename
,
920 const string
& targetFilename
,
921 const string
& targetDirectory
)
923 string fullTargetFilename
;
924 if ( targetDirectory
.length () > 0)
925 fullTargetFilename
= targetDirectory
+ SSEP
+ targetFilename
;
927 fullTargetFilename
= targetFilename
;
928 string normalizedTargetFilename
= MingwModuleHandler::PassThruCacheDirectory (
929 NormalizeFilename ( fullTargetFilename
),
931 string normalizedTargetDirectory
= MingwModuleHandler::PassThruCacheDirectory (
932 NormalizeFilename ( targetDirectory
),
936 normalizedTargetFilename
.c_str (),
937 sourceFilename
.c_str (),
938 normalizedTargetDirectory
.c_str () );
942 "\t${cp} %s %s 1>$(NUL)\n",
943 sourceFilename
.c_str (),
944 normalizedTargetFilename
.c_str () );
948 MingwBackend::OutputNonModuleInstallTargets ()
950 for ( size_t i
= 0; i
< ProjectNode
.installfiles
.size (); i
++ )
952 const InstallFile
& installfile
= *ProjectNode
.installfiles
[i
];
953 OutputInstallTarget ( installfile
.GetPath (),
960 MingwBackend::OutputModuleInstallTargets ()
962 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
964 const Module
& module
= *ProjectNode
.modules
[i
];
965 if ( !module
.enabled
)
967 if ( module
.installName
.length () > 0 )
969 string sourceFilename
= MingwModuleHandler::PassThruCacheDirectory (
970 NormalizeFilename ( module
.GetPath () ),
972 OutputInstallTarget ( sourceFilename
,
974 module
.installBase
);
980 MingwBackend::GetRegistrySourceFiles ()
982 return "bootdata" SSEP
"hivecls.inf "
983 "bootdata" SSEP
"hivedef.inf "
984 "bootdata" SSEP
"hiveinst.inf "
985 "bootdata" SSEP
"hivesft.inf "
986 "bootdata" SSEP
"hivesys.inf";
990 MingwBackend::GetRegistryTargetFiles ()
992 string system32ConfigDirectory
= NormalizeFilename (
993 MingwModuleHandler::PassThruCacheDirectory (
994 "system32" SSEP
"config" SSEP
,
995 installDirectory
) );
996 return system32ConfigDirectory
+ SSEP
"default " +
997 system32ConfigDirectory
+ SSEP
"sam " +
998 system32ConfigDirectory
+ SSEP
"security " +
999 system32ConfigDirectory
+ SSEP
"software " +
1000 system32ConfigDirectory
+ SSEP
"system";
1004 MingwBackend::OutputRegistryInstallTarget ()
1006 string system32ConfigDirectory
= NormalizeFilename (
1007 MingwModuleHandler::PassThruCacheDirectory (
1008 "system32" SSEP
"config" SSEP
,
1009 installDirectory
) );
1011 string registrySourceFiles
= GetRegistrySourceFiles ();
1012 string registryTargetFiles
= GetRegistryTargetFiles ();
1013 fprintf ( fMakefile
,
1014 "install_registry: %s\n",
1015 registryTargetFiles
.c_str () );
1016 fprintf ( fMakefile
,
1017 "%s: %s %s $(MKHIVE_TARGET)\n",
1018 registryTargetFiles
.c_str (),
1019 registrySourceFiles
.c_str (),
1020 system32ConfigDirectory
.c_str () );
1021 fprintf ( fMakefile
,
1022 "\t$(ECHO_MKHIVE)\n" );
1023 fprintf ( fMakefile
,
1024 "\t$(MKHIVE_TARGET) bootdata %s bootdata" SSEP
"hiveinst.inf\n",
1025 system32ConfigDirectory
.c_str () );
1026 fprintf ( fMakefile
,
1031 MingwBackend::GenerateInstallTarget ()
1033 vector
<string
> vInstallTargetFiles
;
1034 GetInstallTargetFiles ( vInstallTargetFiles
);
1035 string installTargetFiles
= v2s ( vInstallTargetFiles
, 5 );
1036 string registryTargetFiles
= GetRegistryTargetFiles ();
1038 fprintf ( fMakefile
,
1040 installTargetFiles
.c_str (),
1041 registryTargetFiles
.c_str () );
1042 OutputNonModuleInstallTargets ();
1043 OutputModuleInstallTargets ();
1044 OutputRegistryInstallTarget ();
1045 fprintf ( fMakefile
,
1050 MingwBackend::GetModuleTestTargets (
1051 vector
<string
>& out
) const
1053 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
1055 const Module
& module
= *ProjectNode
.modules
[i
];
1056 if ( !module
.enabled
)
1058 if ( module
.type
== Test
)
1059 out
.push_back ( module
.name
);
1064 MingwBackend::GenerateTestTarget ()
1066 vector
<string
> vTestTargets
;
1067 GetModuleTestTargets ( vTestTargets
);
1068 string testTargets
= v2s ( vTestTargets
, 5 );
1070 fprintf ( fMakefile
,
1072 testTargets
.c_str () );
1073 fprintf ( fMakefile
,
1078 MingwBackend::GenerateDirectoryTargets ()
1080 intermediateDirectory
->CreateRule ( fMakefile
, "" );
1081 outputDirectory
->CreateRule ( fMakefile
, "" );
1082 installDirectory
->CreateRule ( fMakefile
, "" );