338 lines
15 KiB
XML
338 lines
15 KiB
XML
<Project DefaultTarget="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<Import Project="..\..\Paths.targets"/>
|
|
|
|
<PropertyGroup>
|
|
<CorlibObjPath>$(APPRUNTIMENATIVEDIR)\Corlib.obj</CorlibObjPath>
|
|
<BINDIR>$(OBJROOT)\$(OBJRELRUNTIMEDIR)</BINDIR>
|
|
<CFLAGS>$(CFLAGS) /Gr /I$(BINDIR) /I$(SINGULARITY_ROOT)\boot\include /DSINGULARITY_PROCESS=1</CFLAGS>
|
|
<AFLAGS>$(AFLAGS) /DSINGULARITY_PROCESS</AFLAGS>
|
|
<CORLIB_IL>$(APPRUNTIMEDIR)\Corlib.dll</CORLIB_IL>
|
|
<MASTER>$(SINGULARITY_ROOT)\Kernel</MASTER>
|
|
<NativeLibPath>$(APPRUNTIMENATIVEDIR)\native.lib</NativeLibPath>
|
|
<Collector>$(COLLECTOR_APP)</Collector>
|
|
</PropertyGroup>
|
|
|
|
|
|
<Import Project="$(SINGULARITY_ROOT)\Kernel\GC.targets"/>
|
|
|
|
|
|
|
|
<PropertyGroup>
|
|
|
|
<!-- bartok common flags -->
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /Singularity</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /UnnameTracedPtrs=true</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /OmitFramePointer=false </BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /GCInlineAllocations=false </BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /GCInlineWriteBarrier=false</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /GenCoffLineNumber=false</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /WholeProgram=true</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /Warnings=true </BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /DisablePInvoke=true</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /BackEndComments=true</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) $(BARTOK_COLLECTOR)</BARTOK_FLAGS>
|
|
|
|
<!-- bartok flags for corlib.obj -->
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) </CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) /CompileOnly=true </CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) /Warnings=true </CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) $(BARTOK_COLLECTOR)</CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) /r:$(LIBSDIR)\Singularity.V1.dll</CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) /r:$(ILLSDIR)\Console.ill</CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) /r:$(APPRUNTIMEDIR)\ILHelpers.dll</CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) /out: $(APPRUNTIMENATIVEDIR)\CorLib.obj</CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) /outdir: $(APPRUNTIMENATIVEDIR) </CORLIB_BARTOK_FLAGS>
|
|
<CORLIB_BARTOK_FLAGS>$(CORLIB_BARTOK_FLAGS) $(APPRUNTIMEDIR)\Corlib.dll </CORLIB_BARTOK_FLAGS>
|
|
|
|
<!-- bartok flags for testapp.obj -->
|
|
<TESTAPP_BARTOK_FLAGS>/verbosity:silence</TESTAPP_BARTOK_FLAGS>
|
|
<TESTAPP_BARTOK_FLAGS>$(TESTAPP_BARTOK_FLAGS) /GenAsmHeader="$(APPRUNTIMENATIVEDIR)\halclass.inc"</TESTAPP_BARTOK_FLAGS>
|
|
<TESTAPP_BARTOK_FLAGS>$(TESTAPP_BARTOK_FLAGS) /GenCppHeader="$(APPRUNTIMENATIVEDIR)\halclass.h"</TESTAPP_BARTOK_FLAGS>
|
|
<TESTAPP_BARTOK_FLAGS>$(TESTAPP_BARTOK_FLAGS) /IrTreeShake=false</TESTAPP_BARTOK_FLAGS>
|
|
<TESTAPP_BARTOK_FLAGS>$(TESTAPP_BARTOK_FLAGS) /IrTreeShakeLate=false</TESTAPP_BARTOK_FLAGS>
|
|
<TESTAPP_BARTOK_FLAGS>$(TESTAPP_BARTOK_FLAGS) /out:$(APPRUNTIMENATIVEDIR)\testapp.obj</TESTAPP_BARTOK_FLAGS>
|
|
<TESTAPP_BARTOK_FLAGS>$(TESTAPP_BARTOK_FLAGS) /outdir:$(APPRUNTIMENATIVEDIR)</TESTAPP_BARTOK_FLAGS>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Kernel\App.Corlib.csproj"/>
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Kernel\System.Compiler.Runtime\System.Compiler.Runtime.App.csproj"/>
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Kernel\SingSharp.Runtime\Microsoft.SingSharp.Runtime.App.csproj"/>
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Kernel\SpecSharp.Contracts\Corlib.Contracts.csproj"/>
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Libraries\Singularity.V1\Singularity.V1.csproj"/>
|
|
<ProjectReference Include="ILHelpers.csproj"/>
|
|
</ItemGroup>
|
|
|
|
<!-- Configuration-sensitive values -->
|
|
<Choose>
|
|
<When Condition="'$(Configuration)'=='Prototype'">
|
|
<PropertyGroup>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /IrSimpleInliner=false</BARTOK_FLAGS>
|
|
</PropertyGroup>
|
|
</When>
|
|
</Choose>
|
|
|
|
<!-- Machine-sensitive values -->
|
|
<Choose>
|
|
<When Condition="'$(Machine)'=='x86'">
|
|
<PropertyGroup>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /LinkedStacks=true</BARTOK_FLAGS>
|
|
<BARTOK_FLAGS>$(BARTOK_FLAGS) /SymbolicDebug=true</BARTOK_FLAGS>
|
|
<NativeSrcDir>$(MASTER)\Native</NativeSrcDir>
|
|
</PropertyGroup>
|
|
<ItemGroup>
|
|
<NativeIncludes Include="$(NativeSrcDir)\hal.h"/>
|
|
<NativeSources Include="$(NativeSrcDir)\hal.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\BootInfo.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\IoPort.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Buffer.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Decimal.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\DebugStub.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Math.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Number.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\PEImage.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Processor.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Stacks.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Thread.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Tracing.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\Monitoring.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\halexn.cpp"/>
|
|
<NativeSources Include="$(NativeSrcDir)\halstack.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\halforgc.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\halasm.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_lldiv.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_llmul.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_llshl.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_llshr.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_llrem.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_memcpy.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_memset.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_ulldiv.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_ulldvrm.asm"/>
|
|
<NativeSources Include="$(NativeSrcDir)\_ullrem.asm"/>
|
|
</ItemGroup>
|
|
</When>
|
|
</Choose>
|
|
|
|
|
|
<!-- ================================== TARGETS ================================================== -->
|
|
|
|
<Target Name="BuildCorlibObj"
|
|
Inputs="$(CORLIB_IL)"
|
|
Outputs="$(CorlibObjPath)"
|
|
DependsOnTargets="BuildDependentProjects"
|
|
>
|
|
|
|
<Message Text="Building Corlib.obj"/>
|
|
<!-- /GenAsmHeader="$(APPRUNTIMEDIR)\halclass.inc" /GenCppHeader="$(APPRUNTIMEDIR)\halclass.h" -->
|
|
<!-- We specify the working directory to work around issues dealing with inheritance of the PATH variable. -->
|
|
<MakeDir Directories="$(APPRUNTIMENATIVEDIR)"/>
|
|
<Exec WorkingDirectory="$(BARTOK_DIR)"
|
|
Command="$(BARTOK) $(BARTOK_FLAGS) $(CORLIB_BARTOK_FLAGS)"/>
|
|
</Target>
|
|
|
|
|
|
|
|
<!--
|
|
|
|
############################################################### Native Library
|
|
|
|
-->
|
|
|
|
<!--
|
|
Note: This target uses batching. All tasks within the target will be executed, once for each distinct
|
|
NativeSources item.
|
|
|
|
Notes about dependency checking: In general, we do not attempt to do fine-grained dependency checking
|
|
on #include dependencies, because:
|
|
* doing so is error-prone (the dependencies are in the code, not in the project)
|
|
* we don't have much C++ code, so it compiles fast
|
|
* nearly all of the C++ files depend on halclass.h, which is generated when any IL changes
|
|
|
|
So we just punt, and declare that all native sources depend on halclass.h (and halclass.inc),
|
|
and the handful of native header files that we have, which are declared as NativeIncludes items.
|
|
This means that we are conservative about dependencies; we may rebuild code when it is not strictly
|
|
necessary, but this is better than not building code that really has changed.
|
|
|
|
This target depends on BuildTestAppObj because that target generates halclass.h / halclass.inc.
|
|
-->
|
|
<Target Name="BuildNativeSources"
|
|
DependsOnTargets="BuildTestAppObj"
|
|
Inputs="
|
|
%(NativeSources.identity);
|
|
@(NativeIncludes);
|
|
$(APPRUNTIMENATIVEDIR)\halclass.h;
|
|
$(APPRUNTIMENATIVEDIR)\halclass.inc;
|
|
"
|
|
Outputs="$(APPRUNTIMENATIVEDIR)\%(NativeSources.filename).obj"
|
|
>
|
|
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) $(GC_ML_DEFS) /I$(APPRUNTIMENATIVEDIR) /I$(NativeSrcDir) /Fd$(APPRUNTIMENATIVEDIR)\native.pdb /Fo$(APPRUNTIMENATIVEDIR)\%(NativeSources.filename).obj /c %(NativeSources.identity) "
|
|
Condition="'%(NativeSources.extension)'=='.c' or '%(NativeSources.extension)'=='.cpp'"
|
|
/>
|
|
<Exec Command="$(AS) $(AFLAGS) $(ACFLAGS) $(GC_ML_DEFS) /I$(APPRUNTIMENATIVEDIR) /I$(NativeSrcDir) /Fo$(APPRUNTIMENATIVEDIR)\%(NativeSources.filename).obj /c %(NativeSources.identity) "
|
|
Condition="'%(NativeSources.extension)'=='.asm'"/>
|
|
</Target>
|
|
|
|
<Target Name="LinkNativeLib"
|
|
DependsOnTargets="BuildNativeSources"
|
|
Inputs="@(NativeSources->'$(APPRUNTIMENATIVEDIR)\%(filename).obj')"
|
|
Outputs="$(NativeLibPath)">
|
|
<Message Text="Linking native objects - $(NativeLibPath)"/>
|
|
<Delete Files="$(NativeLibPath)"/>
|
|
<Exec Command="$(LIB) /nologo /nod /out:$(NativeLibPath) @(NativeSources->'$(APPRUNTIMENATIVEDIR)\%(filename).obj',' ')"/>
|
|
</Target>
|
|
|
|
<ItemGroup>
|
|
<NibLib Include="$(APPRUNTIMENATIVEDIR)\native.lib"/>
|
|
<NibLib Include="$(APPRUNTIMENATIVEDIR)\Singularity.V1.lib"/>
|
|
</ItemGroup>
|
|
|
|
<Target Name="CopyNativeLibToNibLibCache"
|
|
Inputs="@(NibLib)"
|
|
Outputs="$(DISTRO_LIB_DIR)\%(NibLib.filename)%(NibLib.extension)"
|
|
DependsOnTargets="LinkNativeLib;BuildAbiLib">
|
|
<MakeDir Directories="$(DISTRO_LIB_DIR)"/>
|
|
<Copy SourceFiles="@(NibLib)" DestinationFolder="$(DISTRO_LIB_DIR)" SkipUnchangedFiles="true"/>
|
|
</Target>
|
|
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
$(OBJDIR)\testapp.exe : testapp.cs \
|
|
$(OBJDIR)\Corlib.dll \
|
|
$(ILLSDIR)\singularity.V1.ill \
|
|
$(OBJDIR)\ILHelpers.dll
|
|
csc /nologo $(CSFLAGS) $(GC_CSC_DEFS) /nostdlib /warnaserror+ /nowarn:169,649 \
|
|
/d:SINGULARITY /d:SINGULARITY_PROCESS /D:PTR_SIZE_32 /d:LITTLE_ENDIAN \
|
|
/d:ENDPOINT_STRUCT \
|
|
/r:$(OBJDIR)\Corlib.dll \
|
|
/r:$(LIBSDIR)\Singularity.V1.dll \
|
|
/r:$(OBJDIR)\ILHelpers.dll \
|
|
/t:exe \
|
|
/out:$(OBJDIR)\testapp.exe testapp.cs
|
|
|
|
##############################################################################
|
|
-->
|
|
|
|
<!--
|
|
<WriteLinesToFile File="$(OBJDIR)\testapp_csc.txt" Lines="
|
|
/nologo $(CSFLAGS) $(GC_CSC_DEFS) /nostdlib /warnaserror+ /nowarn:169,649
|
|
/d:SINGULARITY /d:SINGULARITY_PROCESS /D:PTR_SIZE_32 /d:LITTLE_ENDIAN
|
|
/d:ENDPOINT_STRUCT;
|
|
@(TESTAPP_EXE_REFS->'/r:%(Identity)',' ');
|
|
/t:exe
|
|
/out:$(OBJDIR)\testapp.exe testapp.cs
|
|
" Overwrite="true"/>
|
|
|
|
<Exec Command="$(BUILDDIR)\csc.exe @$(OBJDIR)\testapp_csc.txt"/>
|
|
-->
|
|
|
|
|
|
<ItemGroup>
|
|
<TestAppReference Include="$(APPRUNTIMEDIR)\Corlib.dll"/>
|
|
<TestAppReference Include="$(LIBSDIR)\Singularity.V1.dll"/>
|
|
<TestAppReference Include="$(ILLSDIR)\Console.ill"/>
|
|
<TestAppReference Include="$(APPRUNTIMEDIR)\ILHelpers.dll"/>
|
|
<TestAppReference Include="$(APPRUNTIMEDIR)\System.Compiler.Runtime.dll"/>
|
|
<TestAppReference Include="$(APPRUNTIMEDIR)\Microsoft.SingSharp.Runtime.dll"/>
|
|
</ItemGroup>
|
|
|
|
<Target Name="BuildTestAppIL">
|
|
<MSBuild Projects="TestApp.csproj" StopOnFirstFailure="$(StopOnFirstFailure)">
|
|
<Output PropertyName="TestAppILPath" TaskParameter="TargetOutputs"/>
|
|
</MSBuild>
|
|
<Message Text="TestAppILPath - $(TestAppILPath)"/>
|
|
</Target>
|
|
|
|
<Target Name="BuildTestAppObj"
|
|
Inputs="$(TestAppILPath)"
|
|
Outputs="$(APPRUNTIMENATIVEDIR)\testapp.obj;$(APPRUNTIMENATIVEDIR)\testapp_superObj.obj;$(APPRUNTIMENATIVEDIR)\halclass.inc;$(APPRUNTIMENATIVEDIR)\halclass.h"
|
|
DependsOnTargets="BuildTestAppIL"
|
|
>
|
|
<Message Text="Building testapp.obj"/>
|
|
<Message Text=" Native reference: %(TestAppReference.identity)"/>
|
|
|
|
<Exec Command="PATH $(SINGULARITY_PATH) & $(BARTOK) $(BARTOK_FLAGS) $(TESTAPP_BARTOK_FLAGS) $(TestAppILPath) @(TestAppReference,' ')"/>
|
|
<!-- > $(OBJDIR)\testapp.log -->
|
|
</Target>
|
|
|
|
<ItemGroup>
|
|
<NativeReference Include="$(OBJDIR)\native.lib"/>
|
|
<NativeReference Include="$(OBJDIR)\testapp.obj"/>
|
|
<NativeReference Include="$(APPRUNTIMENATIVEDIR)\DebugStub.obj"/>
|
|
<NativeReference Include="$(APPRUNTIMENATIVEDIR)\Processor.obj"/>
|
|
<NativeReference Include="$(OBJDIR)\testapp_superObj.obj"/>
|
|
<NativeReference Include="$(APPRUNTIMENATIVEDIR)\Singularity.V1.lib"/>
|
|
</ItemGroup>
|
|
|
|
<Target Name="LinkTestApp"
|
|
Inputs="@(NativeReference)"
|
|
Outputs="$(OBJDIR)\testapp.x86"
|
|
DependsOnTargets="BuildNativeLib;BuildTestAppObj"
|
|
>
|
|
<Message Text="Linking testapp native image"/>
|
|
<Exec Command="$(LINK) /out:$(OBJDIR)\testapp.x86 /pdb:$(OBJDIR)\testapp.x86.pdb $(LFLAGS) /fixed:no /MAP /base:0x2000000 /entry:RuntimeEntryPoint @(NativeReference,' ')"/>
|
|
</Target>
|
|
|
|
|
|
|
|
|
|
|
|
<Target Name="BuildDependentProjects">
|
|
<MSBuild Projects="@(ProjectReference)" StopOnFirstFailure="$(StopOnFirstFailure)"/>
|
|
<!-- testapp.csproj; -->
|
|
</Target>
|
|
|
|
|
|
<Target Name="Build" DependsOnTargets="
|
|
BuildDependentProjects;
|
|
BuildCorlibObj;
|
|
LinkNativeLib;
|
|
CopyNativeLibToNibLibCache;
|
|
BuildAbiLib;
|
|
">
|
|
</Target>
|
|
|
|
<!-- This builds the PE/COFF unmanaged import library for the app/kernel ABI. -->
|
|
<Target Name="BuildAbiLib"
|
|
Inputs="$(SINGULARITY_ROOT)\Kernel\$(SING_DEF_FILE)"
|
|
Outputs="$(APPRUNTIMENATIVEDIR)\Singularity.V1.lib">
|
|
|
|
<Message Text="Building ABI PE/COFF import library - $(APPRUNTIMENATIVEDIR)\Singularity.V1.lib" />
|
|
<MakeDir Directories="$(APPRUNTIMENATIVEDIR)" />
|
|
|
|
<!-- Preprocess it first. -->
|
|
<Exec Command="$(CC) $(CFLAGS) /EP /TP $(SINGULARITY_ROOT)\Kernel\$(SING_DEF_FILE) > $(APPRUNTIMENATIVEDIR)\$(SING_DEF_FILE)" />
|
|
|
|
<Message Text="Validating ABI" />
|
|
<Exec Command="$(SINGULARITY_ROOT)\Kernel\validabi.cmd $(APPRUNTIMENATIVEDIR)\$(SING_DEF_FILE)" />
|
|
<Exec Command="$(LIB) /nologo /def:$(APPRUNTIMENATIVEDIR)\$(SING_DEF_FILE) /machine:$(MACHINE) /out:$(APPRUNTIMENATIVEDIR)\Singularity.V1.lib" />
|
|
</Target>
|
|
|
|
|
|
|
|
<Target Name="Clean">
|
|
<Delete Files="
|
|
@(NativeSources->'$(APPRUNTIMENATIVEDIR)\%(filename).obj');
|
|
$(APPRUNTIMENATIVEDIR)\native.lib;
|
|
$(APPRUNTIMENATIVEDIR)\native.pdb;
|
|
$(APPRUNTIMENATIVEDIR)\$(SING_DEF_FILE);
|
|
$(APPRUNTIMENATIVEDIR)\Singularity.V1.lib;
|
|
$(APPRUNTIMENATIVEDIR)\Singularity.V1.def;
|
|
$(APPRUNTIMENATIVEDIR)\Singularity.V1.exp;
|
|
$(APPRUNTIMENATIVEDIR)\testapp.obj;
|
|
$(APPRUNTIMENATIVEDIR)\testapp_superObj.obj;
|
|
$(APPRUNTIMENATIVEDIR)\testapp_info.obj;
|
|
$(APPRUNTIMENATIVEDIR)\halclass.h;
|
|
$(APPRUNTIMENATIVEDIR)\halclass.inc;
|
|
$(APPRUNTIMENATIVEDIR)\Corlib.obj;
|
|
$(APPRUNTIMENATIVEDIR)\Corlib_info.obj;
|
|
"/>
|
|
</Target>
|
|
|
|
</Project>
|