提交 29a2d0db 编写于 作者: M Miguel de Icaza

[genproj] Steps towards making pre-build scripts cross platform; Lots more build now

上级 d7928067
all: genproj.exe
all: genproj.exe prepare.exe
mono genproj.exe
genproj.exe: genproj.cs
mcs genproj.cs -pkg:dotnet -r:System.Xml.Linq
\ No newline at end of file
mcs genproj.cs -r:System.Xml.Linq
prepare.exe: prepare.cs
mcs prepare.cs
$(ProjectDir)\..\..\..\mono\msvc\scripts\prepare.exe $(ProjectDir)..\.. xml
$(ProjectDir)\..\..\jay\jay.exe -ct < $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\System.Xml.XPath\Parser.jay > $(ProjectDir)\System.Xml.XPath\Parser.cs
echo #define XSLT_PATTERN > $(ProjectDir)\Mono.Xml.Xsl\PatternParser.cs
$(ProjectDir)\..\..\jay\jay.exe -ct < $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Mono.Xml.Xsl\PatternParser.jay >> $(ProjectDir)\Mono.Xml.Xsl\PatternParser.cs
echo #define XSLT_PATTERN > $(ProjectDir)\Mono.Xml.Xsl\PatternTokenizer.cs
type $(ProjectDir)\System.Xml.XPath\Tokenizer.cs >> $(ProjectDir)\Mono.Xml.Xsl\PatternTokenizer.cs
@MONO@ $(ProjectDir)\..\..\..\msvc\scripts\prepare.exe $(ProjectDir)..\.. xml
$(ProjectDir)\..\..\jay\jay -ct < $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\System.Xml.XPath\Parser.jay > $(ProjectDir)\System.Xml.XPath\Parser.cs
echo "#define XSLT_PATTERN" > $(ProjectDir)\Mono.Xml.Xsl\PatternParser.cs
$(ProjectDir)\..\..\jay\jay -ct < $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Mono.Xml.Xsl\PatternParser.jay >> $(ProjectDir)\Mono.Xml.Xsl\PatternParser.cs
echo "#define XSLT_PATTERN" > $(ProjectDir)\Mono.Xml.Xsl\PatternTokenizer.cs
@CAT@ $(ProjectDir)\System.Xml.XPath\Tokenizer.cs >> $(ProjectDir)\Mono.Xml.Xsl\PatternTokenizer.cs
\ No newline at end of file
......@@ -53,9 +53,7 @@
</Target>
-->
<PropertyGroup>
<PreBuildEvent>
@PREBUILD@
</PreBuildEvent>
@POSTBUILD@
</PropertyGroup>
<ItemGroup>
......
......@@ -630,11 +630,26 @@ class MsbuildGenerator {
// inputs/LIBRARY.pre
//
string prebuild = Load (library + ".pre");
string prebuild_windows, prebuild_unix;
int q = library.IndexOf ("-");
if (q != -1)
prebuild = prebuild + Load (library.Substring (0, q) + ".pre");
if (prebuild.IndexOf ("@MONO@") != -1){
prebuild_unix = prebuild.Replace ("@MONO@", "mono").Replace ("@CAT@", "cat");
prebuild_windows = prebuild.Replace ("@MONO@", "").Replace ("@CAT@", "type");
} else {
prebuild_unix = prebuild;
prebuild_windows = prebuild;
}
const string condition_unix = "Condition=\" '$(OS)' != 'Windows_NT' \"";
const string condition_windows = "Condition=\" '$(OS)' == 'Windows_NT' \"";
prebuild =
" <PreBuildEvent " + condition_unix + ">\n" + prebuild_unix + "\n </PreBuildEvent>\n" +
" <PreBuildEvent " + condition_windows + ">\n" + prebuild_windows + "\n </PreBuildEvent>\n";
var all_args = new Queue<string []> ();
all_args.Enqueue (flags.Split ());
while (all_args.Count > 0) {
......@@ -794,8 +809,6 @@ class MsbuildGenerator {
build_output_dir = "bin\\Debug\\" + library;
const string condition_unix = "Condition=\" '$(OS)' != 'Windows_NT' \"";
const string condition_windows = "Condition=\" '$(OS)' == 'Windows_NT' \"";
string postbuild_unix = string.Empty;
string postbuild_windows = string.Empty;
......@@ -850,23 +863,16 @@ class MsbuildGenerator {
refs.AppendFormat (" <ProjectReference Include=\"{0}\">{1}", GetRelativePath (result.csprojFileName, lastMatching.csprojFileName), NewLine);
refs.Append (" <Project>" + lastMatching.projectGuid + "</Project>" + NewLine);
refs.Append (" <Name>" + Path.GetFileNameWithoutExtension (lastMatching.csprojFileName) + "</Name>" + NewLine);
//refs.Append(" <HintPath>" + r + "</HintPath>" + NewLine);
refs.Append (" </ProjectReference>" + NewLine);
if (!result.projReferences.Contains (lastMatching))
result.projReferences.Add (lastMatching);
}
static string GetRelativePath (string referencerPath, string referenceePath)
static string GetRelativePath (string from, string to)
{
// F:\src\mono\msvc\scripts\
//..\..\mcs\class\System\System-net_2_0.csproj
//..\..\mcs\class\corlib\corlib-net_2_0.csproj
// So from \System\, corlib needs to be referenced as:
// ..\corlib\corlib-net_2_0.csproj
// Could be possible to use PathRelativePathTo, but this is a P/Invoke to Win32 API.
// For now, simpler but less robust:
return referenceePath.Replace (@"..\..\mcs\class", "..").Replace ("/", "\\");
var fromUri = new Uri (Path.GetFullPath (from));
var toUri = new Uri (Path.GetFullPath (to));
return fromUri.MakeRelativeUri (toUri).ToString ();
}
static VsCsproj GetMatchingCsproj (string dllReferenceName, List<VsCsproj> projects)
......@@ -1032,4 +1038,4 @@ public class Driver {
return false;
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册