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"
22 #include "modulehandler.h"
29 typedef set
<string
> set_string
;
33 v2s ( const string_list
& v
, int wrap_at
)
39 for ( size_t i
= 0; i
< v
.size(); i
++ )
43 if ( wrap_at
> 0 && wrap_count
++ == wrap_at
)
53 static class MingwFactory
: public Backend::Factory
56 MingwFactory() : Factory ( "mingw" ) {}
57 Backend
* operator() ( Project
& project
,
58 Configuration
& configuration
)
60 return new MingwBackend ( project
,
66 MingwBackend::MingwBackend ( Project
& project
,
67 Configuration
& configuration
)
68 : Backend ( project
, configuration
),
69 intermediateDirectory ( new Directory ("$(INTERMEDIATE)" ) ),
70 outputDirectory ( new Directory ( "$(OUTPUT)" ) ),
71 installDirectory ( new Directory ( "$(INSTALL)" ) )
76 MingwBackend::~MingwBackend()
78 delete intermediateDirectory
;
79 delete outputDirectory
;
80 delete installDirectory
;
84 MingwBackend::AddDirectoryTarget ( const string
& directory
,
85 Directory
* directoryTree
)
87 if ( directory
.length () > 0)
88 directoryTree
->Add ( directory
.c_str() );
89 return directoryTree
->name
;
93 MingwBackend::ProcessModules ()
95 printf ( "Processing modules..." );
97 vector
<MingwModuleHandler
*> v
;
99 for ( i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
101 Module
& module
= *ProjectNode
.modules
[i
];
102 if ( !module
.enabled
)
104 MingwModuleHandler
* h
= MingwModuleHandler::InstanciateHandler (
107 if ( module
.host
== HostDefault
)
109 module
.host
= h
->DefaultHost();
110 assert ( module
.host
!= HostDefault
);
115 size_t iend
= v
.size ();
117 for ( i
= 0; i
< iend
; i
++ )
118 v
[i
]->GenerateObjectMacro();
119 fprintf ( fMakefile
, "\n" );
120 for ( i
= 0; i
< iend
; i
++ )
121 v
[i
]->GenerateTargetMacro();
122 fprintf ( fMakefile
, "\n" );
124 GenerateAllTarget ( v
);
125 GenerateInitTarget ();
126 GenerateRegTestsRunTarget ();
128 for ( i
= 0; i
< iend
; i
++ )
129 v
[i
]->GenerateOtherMacros();
131 for ( i
= 0; i
< iend
; i
++ )
133 MingwModuleHandler
& h
= *v
[i
];
134 h
.GeneratePreconditionDependencies ();
136 h
.GenerateInvocations ();
137 h
.GenerateCleanTarget ();
138 h
.GenerateInstallTarget ();
139 h
.GenerateDependsTarget ();
147 MingwBackend::Process ()
149 if ( configuration
.CheckDependenciesForModuleOnly
)
150 CheckAutomaticDependenciesForModuleOnly ();
156 MingwBackend::CheckAutomaticDependenciesForModuleOnly ()
158 if ( configuration
.AutomaticDependencies
)
160 Module
* module
= ProjectNode
.LocateModule ( configuration
.CheckDependenciesForModuleOnlyModule
);
161 if ( module
== NULL
)
163 printf ( "Module '%s' does not exist\n",
164 configuration
.CheckDependenciesForModuleOnlyModule
.c_str () );
168 printf ( "Checking automatic dependencies for module '%s'...",
169 module
->name
.c_str () );
170 AutomaticDependency
automaticDependency ( ProjectNode
);
171 automaticDependency
.CheckAutomaticDependenciesForModule ( *module
,
172 configuration
.Verbose
);
178 MingwBackend::ProcessNormal ()
182 DetectNetwideAssembler ();
183 DetectPipeSupport ();
187 GenerateGlobalVariables ();
188 GenerateXmlBuildFilesMacro ();
190 GenerateInstallTarget ();
191 GenerateTestTarget ();
192 GenerateDirectoryTargets ();
193 GenerateDirectories ();
194 UnpackWineResources ();
195 GenerateTestSupportCode ();
196 GenerateProxyMakefiles ();
197 CheckAutomaticDependencies ();
202 MingwBackend::CreateMakefile ()
204 fMakefile
= fopen ( ProjectNode
.makefile
.c_str (), "w" );
206 throw AccessDeniedException ( ProjectNode
.makefile
);
207 MingwModuleHandler::SetBackend ( this );
208 MingwModuleHandler::SetMakefile ( fMakefile
);
209 MingwModuleHandler::SetUsePch ( use_pch
);
213 MingwBackend::CloseMakefile () const
216 fclose ( fMakefile
);
220 MingwBackend::GenerateHeader () const
222 fprintf ( fMakefile
, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" );
226 MingwBackend::GenerateIncludesAndDefines ( IfableData
& data
) const
228 string includeParameters
= MingwModuleHandler::GenerateGccIncludeParametersFromVector ( data
.includes
);
229 string defineParameters
= MingwModuleHandler::GenerateGccDefineParametersFromVector ( data
.defines
);
230 return includeParameters
+ " " + defineParameters
;
234 MingwBackend::GenerateProjectCFlagsMacro ( const char* assignmentOperation
,
235 IfableData
& data
) const
240 assignmentOperation
);
244 GenerateIncludesAndDefines ( data
).c_str() );
246 fprintf ( fMakefile
, "\n" );
250 MingwBackend::GenerateGlobalCFlagsAndProperties (
251 const char* assignmentOperation
,
252 IfableData
& data
) const
256 for ( i
= 0; i
< data
.properties
.size(); i
++ )
258 Property
& prop
= *data
.properties
[i
];
259 fprintf ( fMakefile
, "%s := %s\n",
261 prop
.value
.c_str() );
264 if ( data
.includes
.size() || data
.defines
.size() )
266 GenerateProjectCFlagsMacro ( assignmentOperation
,
270 for ( i
= 0; i
< data
.ifs
.size(); i
++ )
272 If
& rIf
= *data
.ifs
[i
];
273 if ( rIf
.data
.defines
.size()
274 || rIf
.data
.includes
.size()
275 || rIf
.data
.ifs
.size() )
279 "ifeq (\"$(%s)\",\"%s\")\n",
280 rIf
.property
.c_str(),
282 GenerateGlobalCFlagsAndProperties (
293 MingwBackend::GenerateProjectGccOptionsMacro ( const char* assignmentOperation
,
294 IfableData
& data
) const
300 "PROJECT_GCCOPTIONS %s",
301 assignmentOperation
);
303 for ( i
= 0; i
< data
.compilerFlags
.size(); i
++ )
308 data
.compilerFlags
[i
]->flag
.c_str() );
311 fprintf ( fMakefile
, "\n" );
315 MingwBackend::GenerateProjectGccOptions (
316 const char* assignmentOperation
,
317 IfableData
& data
) const
321 if ( data
.compilerFlags
.size() )
323 GenerateProjectGccOptionsMacro ( assignmentOperation
,
327 for ( i
= 0; i
< data
.ifs
.size(); i
++ )
329 If
& rIf
= *data
.ifs
[i
];
330 if ( rIf
.data
.compilerFlags
.size()
331 || rIf
.data
.ifs
.size() )
335 "ifeq (\"$(%s)\",\"%s\")\n",
336 rIf
.property
.c_str(),
338 GenerateProjectGccOptions (
349 MingwBackend::GenerateProjectLFLAGS () const
352 for ( size_t i
= 0; i
< ProjectNode
.linkerFlags
.size (); i
++ )
354 LinkerFlag
& linkerFlag
= *ProjectNode
.linkerFlags
[i
];
355 if ( lflags
.length () > 0 )
357 lflags
+= linkerFlag
.flag
;
363 MingwBackend::GenerateGlobalVariables () const
367 compilerPrefix
.c_str () );
370 nasmCommand
.c_str () );
372 GenerateGlobalCFlagsAndProperties ( "=", ProjectNode
.non_if_data
);
373 GenerateProjectGccOptions ( "=", ProjectNode
.non_if_data
);
375 fprintf ( fMakefile
, "PROJECT_RCFLAGS := $(PROJECT_CFLAGS)\n" );
376 fprintf ( fMakefile
, "PROJECT_WIDLFLAGS := $(PROJECT_CFLAGS)\n" );
377 fprintf ( fMakefile
, "PROJECT_LFLAGS := %s\n",
378 GenerateProjectLFLAGS ().c_str () );
379 fprintf ( fMakefile
, "PROJECT_CFLAGS += -Wall\n" );
380 fprintf ( fMakefile
, "PROJECT_CFLAGS += $(PROJECT_GCCOPTIONS)\n" );
381 fprintf ( fMakefile
, "\n" );
385 MingwBackend::IncludeInAllTarget ( const Module
& module
) const
387 if ( MingwModuleHandler::ReferenceObjects ( module
) )
389 if ( module
.type
== BootSector
)
391 if ( module
.type
== Iso
)
393 if ( module
.type
== LiveIso
)
395 if ( module
.type
== Test
)
397 if ( module
.type
== Alias
)
403 MingwBackend::GenerateAllTarget ( const vector
<MingwModuleHandler
*>& handlers
) const
405 fprintf ( fMakefile
, "all:" );
407 size_t iend
= handlers
.size ();
408 for ( size_t i
= 0; i
< iend
; i
++ )
410 const Module
& module
= handlers
[i
]->module
;
411 if ( IncludeInAllTarget ( module
) )
413 if ( wrap_count
++ == 5 )
414 fprintf ( fMakefile
, " \\\n\t\t" ), wrap_count
= 0;
417 GetTargetMacro(module
).c_str () );
420 fprintf ( fMakefile
, "\n\t\n\n" );
424 MingwBackend::GetBuildToolDependencies () const
427 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
429 Module
& module
= *ProjectNode
.modules
[i
];
430 if ( !module
.enabled
)
432 if ( module
.type
== BuildTool
)
434 if ( dependencies
.length () > 0 )
436 dependencies
+= module
.GetDependencyPath ();
443 MingwBackend::GenerateInitTarget () const
447 GetBuildToolDependencies ().c_str () );
448 fprintf ( fMakefile
, "\n" );
452 MingwBackend::GenerateRegTestsRunTarget () const
455 "REGTESTS_RUN_TARGET = regtests.dll\n" );
457 "$(REGTESTS_RUN_TARGET): $(REGTESTS_TARGET)\n" );
459 "\t$(cp) $(REGTESTS_TARGET) $(REGTESTS_RUN_TARGET)\n" );
460 fprintf ( fMakefile
, "\n" );
464 MingwBackend::GenerateXmlBuildFilesMacro() const
467 "XMLBUILDFILES = %s \\\n",
468 ProjectNode
.GetProjectFilename ().c_str () );
469 string xmlbuildFilenames
;
470 int numberOfExistingFiles
= 0;
471 for ( size_t i
= 0; i
< ProjectNode
.xmlbuildfiles
.size (); i
++ )
473 XMLInclude
& xmlbuildfile
= *ProjectNode
.xmlbuildfiles
[i
];
474 if ( !xmlbuildfile
.fileExists
)
476 numberOfExistingFiles
++;
477 if ( xmlbuildFilenames
.length () > 0 )
478 xmlbuildFilenames
+= " ";
479 xmlbuildFilenames
+= NormalizeFilename ( xmlbuildfile
.topIncludeFilename
);
480 if ( numberOfExistingFiles
% 5 == 4 || i
== ProjectNode
.xmlbuildfiles
.size () - 1 )
484 xmlbuildFilenames
.c_str ());
485 if ( i
== ProjectNode
.xmlbuildfiles
.size () - 1 )
487 fprintf ( fMakefile
, "\n" );
494 xmlbuildFilenames
.resize ( 0 );
496 numberOfExistingFiles
++;
498 fprintf ( fMakefile
, "\n" );
502 MingwBackend::GetBin2ResExecutable ()
504 return NormalizeFilename ( Environment::GetOutputPath () + sSep
+ "tools/bin2res/bin2res" + ExePostfix
);
508 MingwBackend::UnpackWineResources ()
510 printf ( "Unpacking WINE resources..." );
511 WineResource
wineResource ( ProjectNode
,
512 GetBin2ResExecutable () );
513 wineResource
.UnpackResources ( configuration
.Verbose
);
518 MingwBackend::GenerateTestSupportCode ()
520 printf ( "Generating test support code..." );
521 TestSupportCode
testSupportCode ( ProjectNode
);
522 testSupportCode
.GenerateTestSupportCode ( configuration
.Verbose
);
527 MingwBackend::GetProxyMakefileTree () const
529 if ( configuration
.GenerateProxyMakefilesInSourceTree
)
532 return Environment::GetOutputPath ();
536 MingwBackend::GenerateProxyMakefiles ()
538 printf ( "Generating proxy makefiles..." );
539 ProxyMakefile
proxyMakefile ( ProjectNode
);
540 proxyMakefile
.GenerateProxyMakefiles ( configuration
.Verbose
,
541 GetProxyMakefileTree () );
546 MingwBackend::CheckAutomaticDependencies ()
548 if ( configuration
.AutomaticDependencies
)
550 printf ( "Checking automatic dependencies..." );
551 AutomaticDependency
automaticDependency ( ProjectNode
);
552 automaticDependency
.CheckAutomaticDependencies ( configuration
.Verbose
);
558 MingwBackend::IncludeDirectoryTarget ( const string
& directory
) const
560 if ( directory
== "$(INTERMEDIATE)" + sSep
+ "tools")
567 MingwBackend::GenerateDirectories ()
569 printf ( "Creating directories..." );
570 intermediateDirectory
->GenerateTree ( "", configuration
.Verbose
);
571 outputDirectory
->GenerateTree ( "", configuration
.Verbose
);
572 if ( !configuration
.MakeHandlesInstallDirectories
)
573 installDirectory
->GenerateTree ( "", configuration
.Verbose
);
578 MingwBackend::TryToDetectThisCompiler ( const string
& compiler
)
580 string command
= ssprintf (
582 FixSeparatorForSystemCommand(compiler
).c_str (),
585 int exitcode
= system ( command
.c_str () );
586 return (exitcode
== 0);
590 MingwBackend::DetectCompiler ()
592 printf ( "Detecting compiler..." );
594 bool detectedCompiler
= false;
595 const string
& ROS_PREFIXValue
= Environment::GetVariable ( "ROS_PREFIX" );
596 if ( ROS_PREFIXValue
.length () > 0 )
598 compilerPrefix
= ROS_PREFIXValue
;
599 compilerCommand
= compilerPrefix
+ "-gcc";
600 detectedCompiler
= TryToDetectThisCompiler ( compilerCommand
);
603 if ( !detectedCompiler
)
606 compilerCommand
= "gcc";
607 detectedCompiler
= TryToDetectThisCompiler ( compilerCommand
);
610 if ( !detectedCompiler
)
612 compilerPrefix
= "mingw32";
613 compilerCommand
= compilerPrefix
+ "-gcc";
614 detectedCompiler
= TryToDetectThisCompiler ( compilerCommand
);
616 if ( detectedCompiler
)
617 printf ( "detected (%s)\n", compilerCommand
.c_str () );
619 printf ( "not detected\n" );
623 MingwBackend::TryToDetectThisNetwideAssembler ( const string
& assembler
)
625 string command
= ssprintf (
627 FixSeparatorForSystemCommand(assembler
).c_str (),
630 int exitcode
= system ( command
.c_str () );
631 return (exitcode
== 0);
635 MingwBackend::TryToDetectThisBinutils ( const string
& binutils
)
637 string command
= ssprintf (
639 FixSeparatorForSystemCommand(binutils
).c_str (),
642 int exitcode
= system ( command
.c_str () );
643 return (exitcode
== 0);
647 MingwBackend::GetBinutilsVersion ( const string
& binutilsCommand
)
653 string versionCommand
= ssprintf ( "%s -v",
654 binutilsCommand
.c_str (),
657 fp
= popen ( versionCommand
.c_str () , "r" );
660 ( feof ( fp
) == 0 &&
661 ( ( ch
= fgetc( fp
) ) != -1 ) );
664 buffer
[i
] = (char) ch
;
669 char separators
[] = " ";
671 char *prevtoken
= NULL
;
673 token
= strtok ( buffer
, separators
);
674 while ( token
!= NULL
)
677 token
= strtok ( NULL
, separators
);
679 string version
= string ( prevtoken
);
680 int lastDigit
= version
.find_last_not_of ( "\t\r\n" );
681 if ( lastDigit
!= -1 )
682 return string ( version
, 0, lastDigit
+1 );
688 MingwBackend::IsSupportedBinutilsVersion ( const string
& binutilsVersion
)
690 if ( ( ( strcmp ( binutilsVersion
.c_str (), "20040902") >= 0 ) &&
691 ( strcmp ( binutilsVersion
.c_str (), "20041008") <= 0 ) ) ||
692 ( strcmp ( binutilsVersion
.c_str (), "20031001") < 0 ) )
699 MingwBackend::DetectBinutils ()
701 printf ( "Detecting binutils..." );
703 bool detectedBinutils
= false;
704 const string
& ROS_PREFIXValue
= Environment::GetVariable ( "ROS_PREFIX" );
705 if ( ROS_PREFIXValue
.length () > 0 )
707 binutilsPrefix
= ROS_PREFIXValue
;
708 binutilsCommand
= binutilsPrefix
+ "-ld";
709 detectedBinutils
= TryToDetectThisBinutils ( binutilsCommand
);
712 if ( !detectedBinutils
)
715 binutilsCommand
= "ld";
716 detectedBinutils
= TryToDetectThisBinutils ( binutilsCommand
);
719 if ( !detectedBinutils
)
721 binutilsPrefix
= "mingw32";
722 binutilsCommand
= binutilsPrefix
+ "-ld";
723 detectedBinutils
= TryToDetectThisBinutils ( binutilsCommand
);
725 if ( detectedBinutils
)
727 string binutilsVersion
= GetBinutilsVersion ( binutilsCommand
);
728 if ( IsSupportedBinutilsVersion ( binutilsVersion
) )
729 printf ( "detected (%s)\n", binutilsCommand
.c_str () );
732 printf ( "detected (%s), but with unsupported version (%s)\n",
733 binutilsCommand
.c_str (),
734 binutilsVersion
.c_str () );
735 throw UnsupportedBuildToolException ( binutilsCommand
, binutilsVersion
);
739 printf ( "not detected\n" );
743 MingwBackend::DetectNetwideAssembler ()
745 printf ( "Detecting netwide assembler..." );
747 nasmCommand
= "nasm";
748 bool detectedNasm
= TryToDetectThisNetwideAssembler ( nasmCommand
);
752 nasmCommand
= "nasmw";
753 detectedNasm
= TryToDetectThisNetwideAssembler ( nasmCommand
);
758 nasmCommand
= "yasm";
759 detectedNasm
= TryToDetectThisNetwideAssembler ( nasmCommand
);
762 printf ( "detected (%s)\n", nasmCommand
.c_str () );
764 printf ( "not detected\n" );
768 MingwBackend::DetectPipeSupport ()
770 printf ( "Detecting compiler -pipe support..." );
772 string pipe_detection
= "tools" + sSep
+ "rbuild" + sSep
+ "backend" + sSep
+ "mingw" + sSep
+ "pipe_detection.c";
773 string pipe_detectionObjectFilename
= ReplaceExtension ( pipe_detection
,
775 string command
= ssprintf (
776 "%s -pipe -c %s -o %s 1>%s 2>%s",
777 FixSeparatorForSystemCommand(compilerCommand
).c_str (),
778 pipe_detection
.c_str (),
779 pipe_detectionObjectFilename
.c_str (),
782 int exitcode
= system ( command
.c_str () );
783 FILE* f
= fopen ( pipe_detectionObjectFilename
.c_str (), "rb" );
786 usePipe
= (exitcode
== 0);
788 unlink ( pipe_detectionObjectFilename
.c_str () );
794 printf ( "detected\n" );
796 printf ( "not detected\n" );
800 MingwBackend::DetectPCHSupport ()
802 printf ( "Detecting compiler pre-compiled header support..." );
804 string path
= "tools" + sSep
+ "rbuild" + sSep
+ "backend" + sSep
+ "mingw" + sSep
+ "pch_detection.h";
805 string cmd
= ssprintf (
806 "%s -c %s 1>%s 2>%s",
807 FixSeparatorForSystemCommand(compilerCommand
).c_str (),
811 system ( cmd
.c_str () );
814 FILE* f
= fopen ( path
.c_str (), "rb" );
819 unlink ( path
.c_str () );
825 printf ( "detected\n" );
827 printf ( "not detected\n" );
831 MingwBackend::GetNonModuleInstallTargetFiles (
832 vector
<string
>& out
) const
834 for ( size_t i
= 0; i
< ProjectNode
.installfiles
.size (); i
++ )
836 const InstallFile
& installfile
= *ProjectNode
.installfiles
[i
];
837 string targetFilenameNoFixup
= installfile
.base
+ sSep
+ installfile
.newname
;
838 string targetFilename
= MingwModuleHandler::PassThruCacheDirectory (
839 NormalizeFilename ( targetFilenameNoFixup
),
841 out
.push_back ( targetFilename
);
846 MingwBackend::GetModuleInstallTargetFiles (
847 vector
<string
>& out
) const
849 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
851 const Module
& module
= *ProjectNode
.modules
[i
];
852 if ( !module
.enabled
)
854 if ( module
.installName
.length () > 0 )
856 string targetFilenameNoFixup
;
857 if ( module
.installBase
.length () > 0 )
858 targetFilenameNoFixup
= module
.installBase
+ sSep
+ module
.installName
;
860 targetFilenameNoFixup
= module
.installName
;
861 string targetFilename
= MingwModuleHandler::PassThruCacheDirectory (
862 NormalizeFilename ( targetFilenameNoFixup
),
864 out
.push_back ( targetFilename
);
870 MingwBackend::GetInstallTargetFiles (
871 vector
<string
>& out
) const
873 GetNonModuleInstallTargetFiles ( out
);
874 GetModuleInstallTargetFiles ( out
);
878 MingwBackend::OutputInstallTarget ( const string
& sourceFilename
,
879 const string
& targetFilename
,
880 const string
& targetDirectory
)
882 string fullTargetFilename
;
883 if ( targetDirectory
.length () > 0)
884 fullTargetFilename
= targetDirectory
+ sSep
+ targetFilename
;
886 fullTargetFilename
= targetFilename
;
887 string normalizedTargetFilename
= MingwModuleHandler::PassThruCacheDirectory (
888 NormalizeFilename ( fullTargetFilename
),
890 string normalizedTargetDirectory
= MingwModuleHandler::PassThruCacheDirectory (
891 NormalizeFilename ( targetDirectory
),
895 normalizedTargetFilename
.c_str (),
896 sourceFilename
.c_str (),
897 normalizedTargetDirectory
.c_str () );
901 "\t${cp} %s %s 1>$(NUL)\n",
902 sourceFilename
.c_str (),
903 normalizedTargetFilename
.c_str () );
907 MingwBackend::OutputNonModuleInstallTargets ()
909 for ( size_t i
= 0; i
< ProjectNode
.installfiles
.size (); i
++ )
911 const InstallFile
& installfile
= *ProjectNode
.installfiles
[i
];
912 OutputInstallTarget ( installfile
.GetPath (),
919 MingwBackend::GetAliasedModuleOrModule ( const Module
& module
) const
921 if ( module
.aliasedModuleName
.size () > 0 )
923 const Module
* aliasedModule
= ProjectNode
.LocateModule ( module
.aliasedModuleName
);
924 assert ( aliasedModule
);
925 return *aliasedModule
;
932 MingwBackend::OutputModuleInstallTargets ()
934 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
936 const Module
& module
= *ProjectNode
.modules
[i
];
937 if ( !module
.enabled
)
939 if ( module
.installName
.length () > 0 )
941 const Module
& aliasedModule
= GetAliasedModuleOrModule ( module
);
942 string sourceFilename
= MingwModuleHandler::PassThruCacheDirectory (
943 NormalizeFilename ( aliasedModule
.GetPath () ),
945 OutputInstallTarget ( sourceFilename
,
947 module
.installBase
);
953 MingwBackend::GetRegistrySourceFiles ()
955 return "bootdata" + sSep
+ "hivecls.inf "
956 "bootdata" + sSep
+ "hivedef.inf "
957 "bootdata" + sSep
+ "hiveinst.inf "
958 "bootdata" + sSep
+ "hivesft.inf "
959 "bootdata" + sSep
+ "hivesys.inf";
963 MingwBackend::GetRegistryTargetFiles ()
965 string system32ConfigDirectory
= NormalizeFilename (
966 MingwModuleHandler::PassThruCacheDirectory (
967 "system32" + sSep
+ "config" + sSep
,
968 installDirectory
) );
969 return system32ConfigDirectory
+ sSep
+ "default " +
970 system32ConfigDirectory
+ sSep
+ "sam " +
971 system32ConfigDirectory
+ sSep
+ "security " +
972 system32ConfigDirectory
+ sSep
+ "software " +
973 system32ConfigDirectory
+ sSep
+ "system";
977 MingwBackend::OutputRegistryInstallTarget ()
979 string system32ConfigDirectory
= NormalizeFilename (
980 MingwModuleHandler::PassThruCacheDirectory (
981 "system32" + sSep
+ "config" + sSep
,
982 installDirectory
) );
984 string registrySourceFiles
= GetRegistrySourceFiles ();
985 string registryTargetFiles
= GetRegistryTargetFiles ();
987 "install_registry: %s\n",
988 registryTargetFiles
.c_str () );
990 "%s: %s %s $(MKHIVE_TARGET)\n",
991 registryTargetFiles
.c_str (),
992 registrySourceFiles
.c_str (),
993 system32ConfigDirectory
.c_str () );
995 "\t$(ECHO_MKHIVE)\n" );
997 "\t$(MKHIVE_TARGET) bootdata %s bootdata%chiveinst.inf\n",
998 system32ConfigDirectory
.c_str (),
1000 fprintf ( fMakefile
,
1005 MingwBackend::GenerateInstallTarget ()
1007 vector
<string
> vInstallTargetFiles
;
1008 GetInstallTargetFiles ( vInstallTargetFiles
);
1009 string installTargetFiles
= v2s ( vInstallTargetFiles
, 5 );
1010 string registryTargetFiles
= GetRegistryTargetFiles ();
1012 fprintf ( fMakefile
,
1014 installTargetFiles
.c_str (),
1015 registryTargetFiles
.c_str () );
1016 OutputNonModuleInstallTargets ();
1017 OutputModuleInstallTargets ();
1018 OutputRegistryInstallTarget ();
1019 fprintf ( fMakefile
,
1024 MingwBackend::GetModuleTestTargets (
1025 vector
<string
>& out
) const
1027 for ( size_t i
= 0; i
< ProjectNode
.modules
.size (); i
++ )
1029 const Module
& module
= *ProjectNode
.modules
[i
];
1030 if ( !module
.enabled
)
1032 if ( module
.type
== Test
)
1033 out
.push_back ( module
.name
);
1038 MingwBackend::GenerateTestTarget ()
1040 vector
<string
> vTestTargets
;
1041 GetModuleTestTargets ( vTestTargets
);
1042 string testTargets
= v2s ( vTestTargets
, 5 );
1044 fprintf ( fMakefile
,
1046 testTargets
.c_str () );
1047 fprintf ( fMakefile
,
1052 MingwBackend::GenerateDirectoryTargets ()
1054 intermediateDirectory
->CreateRule ( fMakefile
, "" );
1055 outputDirectory
->CreateRule ( fMakefile
, "" );
1056 installDirectory
->CreateRule ( fMakefile
, "" );