13 #include "backend/backend.h"
14 #include "backend/mingw/mingw.h"
19 static string BuildSystem
;
20 static string RootXmlFile
= "ReactOS.xml";
21 static Configuration configuration
;
24 ParseMakeSwitch ( char switchChar2
)
26 switch ( switchChar2
)
29 configuration
.MakeHandlesInstallDirectories
= true;
32 printf ( "Unknown switch -m%c",
40 ParseProxyMakefileSwitch ( char switchChar2
)
42 switch ( switchChar2
)
45 configuration
.GenerateProxyMakefilesInSourceTree
= true;
48 printf ( "Unknown switch -p%c",
56 ParseSwitch ( int argc
, char** argv
, int index
)
58 char switchChar
= strlen ( argv
[index
] ) > 1 ? argv
[index
][1] : ' ';
59 char switchChar2
= strlen ( argv
[index
] ) > 2 ? argv
[index
][2] : ' ';
63 configuration
.Verbose
= true;
66 configuration
.CleanAsYouGo
= true;
69 configuration
.AutomaticDependencies
= false;
72 RootXmlFile
= string(&argv
[index
][2]);
75 return ParseMakeSwitch ( switchChar2
);
77 return ParseProxyMakefileSwitch ( switchChar2
);
79 printf ( "Unknown switch -%c",
87 ParseArguments ( int argc
, char** argv
)
92 for ( int i
= 1; i
< argc
; i
++ )
94 if ( argv
[i
][0] == '-' )
96 if ( !ParseSwitch ( argc
, argv
, i
) )
100 BuildSystem
= argv
[i
];
107 main ( int argc
, char** argv
)
109 if ( !ParseArguments ( argc
, argv
) )
111 printf ( "Generates project files for buildsystems\n\n" );
112 printf ( " rbuild [switches] buildsystem\n\n" );
113 printf ( "Switches:\n" );
114 printf ( " -v Be verbose.\n" );
115 printf ( " -c Clean as you go. Delete generated files as soon as they are not needed anymore.\n" );
116 printf ( " -d Disable automatic dependencies.\n" );
117 printf ( " -rfile.xml Name of the root xml file. Default is ReactOS.xml.\n" );
118 printf ( " -mi Let make handle creation of install directories. Rbuild will not generate the directories.\n" );
119 printf ( " -ps Generate proxy makefiles in source tree instead of the output tree.\n" );
121 printf ( " buildsystem Target build system. Can be one of:\n" );
122 printf ( " mingw MinGW\n" );
123 printf ( " devcpp DevC++\n" );
128 string
projectFilename ( RootXmlFile
);
129 printf ( "Reading build files..." );
130 Project
project ( projectFilename
);
132 project
.WriteConfigurationFile ();
133 project
.ExecuteInvocations ();
134 Backend
* backend
= Backend::Factory::Create ( BuildSystem
,
142 catch (Exception
& ex
)
145 ex
.Message
.c_str () );