singrdk/base/Kernel/Kernel.proj

523 lines
27 KiB
Plaintext
Raw Normal View History

2008-03-05 09:52:00 -05:00
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\Paths.targets" />
<PropertyGroup>
<SDIZEPDB>sdizepdb</SDIZEPDB>
<AFLAGS>$(AFLAGS)</AFLAGS>
<CFLAGS>$(CFLAGS) /Gr /Oi /I..\boot\include /I..\Windows\Inc /I$(KERNEL_NATIVE_DIR) /I$(SINGULARITY_ROOT)\boot\include -UDEBUG</CFLAGS>
<ACFLAGS>$(ACFLAGS) /DSINGULARITY=1 /DSINGULARITY_KERNEL=1 /I$(KERNEL_NATIVE_DIR)</ACFLAGS>
<ACFLAGS Condition="'$(SINGULARITY_MP)'=='true'">$(ACFLAGS) /DSINGULARITY_MP=1</ACFLAGS>
<ACFLAGS Condition="'$(PAGING)'=='On'">$(ACFLAGS) /DPAGING</ACFLAGS>
<LFLAGS>$(LINKFLAGS) /nodefaultlib /subsystem:native /OPT:REF /RELEASE /DLL </LFLAGS>
<KPRIDIR>$(KERNEL_NATIVE_DIR)\obj</KPRIDIR>
<KERNEL_BARTOK_LOG>&gt;$(KERNEL_NATIVE_DIR)\kernel.log</KERNEL_BARTOK_LOG>
<LBASEFLAGS>/fixed /map /base:0x310000</LBASEFLAGS>
<LENTRYFLAGS>/entry:Hal</LENTRYFLAGS>
<Collector>$(COLLECTOR_KERNEL)</Collector>
<DEFAULT_SYSCALL_BUILDER>$(BUILDDIR)\SyscallBuilder.exe</DEFAULT_SYSCALL_BUILDER>
<SYSCALL_BUILDER Condition="'$(SYSCALL_BUILDER)'==''">$(DEFAULT_SYSCALL_BUILDER)</SYSCALL_BUILDER>
</PropertyGroup>
<!-- Importing GC.targets gets us GC_ML_DEFS, and BARTOK_COLLECTOR. -->
<Import Project="GC.targets"/>
<PropertyGroup>
<BartokFlags>$(BartokFlags) /Singularity</BartokFlags>
<BartokFlags>$(BartokFlags) /verbosity:silence</BartokFlags>
<BartokFlags>$(BartokFlags) /LinkedStacksRequireExternalBound=true</BartokFlags>
<BartokFlags>$(BartokFlags) /LinkedStacksDumpBounds=true</BartokFlags>
<BartokFlags>$(BartokFlags) /BackEndComments=true</BartokFlags>
<BartokFlags>$(BartokFlags) /GCInlineAllocations=false</BartokFlags>
<BartokFlags>$(BartokFlags) /GCInlineWriteBarrier=false</BartokFlags>
<BartokFlags>$(BartokFlags) /GenAsmHeader="$(KERNEL_NATIVE_DIR)\halclass.inc"</BartokFlags>
<BartokFlags>$(BartokFlags) /GenCppHeader="$(KERNEL_NATIVE_DIR)\halclass.h"</BartokFlags>
<BartokFlags>$(BartokFlags) /OmitFramePointer=false</BartokFlags>
<BartokFlags>$(BartokFlags) /DebugInline=true</BartokFlags>
<BartokFlags>$(BartokFlags) /UnnameTracedPtrs=true</BartokFlags>
<BartokFlags>$(BartokFlags) /Warnings=true</BartokFlags>
<BartokFlags>$(BartokFlags) /WholeProgram=true</BartokFlags>
<BartokFlags>$(BartokFlags) /GenCoffLineNumber=false</BartokFlags>
<BartokFlags Condition="'$(Configuration)'=='Prototype'">$(BartokFlags) /IrSimpleInliner=false</BartokFlags>
<!--
<BartokFlags>&gt; $(KERNEL_NATIVE_DIR)\kernel.log</BartokFlags>
-->
</PropertyGroup>
<PropertyGroup>
<Collector>$(COLLECTOR_KERNEL)</Collector>
<NativeImageName>kernel</NativeImageName>
<EnableOutputLog>false</EnableOutputLog>
</PropertyGroup>
<PropertyGroup>
<AbiCandidatesFile>$(KERNEL_NATIVE_DIR)\Singularity.V1.candidates</AbiCandidatesFile>
<KernelObjPath>$(KERNEL_NATIVE_DIR)\kernel.obj</KernelObjPath>
<NativeLibPath>$(KERNEL_NATIVE_DIR)\native.lib</NativeLibPath>
</PropertyGroup>
<!-- HAL -->
<Choose>
<When Condition="'$(Platform)'=='ApicPC'">
<PropertyGroup>
<HalProject>$(SINGULARITY_ROOT)\Kernel\Singularity.Hal.ApicPC.csproj</HalProject>
</PropertyGroup>
</When>
<When Condition="'$(Platform)'=='ApicMP'">
<PropertyGroup>
<HalProject>$(SINGULARITY_ROOT)\Kernel\Singularity.Hal.ApicMP.csproj</HalProject>
</PropertyGroup>
</When>
<When Condition="'$(Platform)'=='LegacyPC'">
<PropertyGroup>
<HalProject>$(SINGULARITY_ROOT)\Kernel\Singularity.Hal.LegacyPC.csproj</HalProject>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<ERROR>The value '$(Platform)' is not a valid choice for the Platform property.</ERROR>
</PropertyGroup>
</Otherwise>
</Choose>
<Choose>
<When Condition="'$(Machine)'=='x86'">
<PropertyGroup>
<BartokFlags>$(BartokFlags) /SymbolicDebug=true</BartokFlags>
<BartokFlags>$(BartokFlags) /LinkedStacks=true</BartokFlags>
<NativeSrcDir>Native</NativeSrcDir>
</PropertyGroup>
</When>
</Choose>
<ItemGroup Condition="'$(PAGING)'=='On'">
<KernelObj Include="$(KERNEL_NATIVE_DIR)\sysentry.obj"/>
</ItemGroup>
<PropertyGroup Condition="'$(PAGING)'=='On'">
<LinkKernelDependsOn>$(LinkKernelDependsOn);sysentry_obj</LinkKernelDependsOn>
<BuildDependsOn>$(BuildDependsOn);LinkSyscallsDll</BuildDependsOn>
</PropertyGroup>
<!-- ##################################### TARGETS ############################################ -->
<Target Name="Build" DependsOnTargets="
BuildDependentProjects;
BuildKernelManifest;
LinkKernel;
BuildKernelDmp;
LinkTestApp;
BuildTestPeManifest;
$(BuildDependsOn);
">
</Target>
<!-- These items are the IL assemblies that form the managed part of the kernel. -->
<ItemGroup>
<ProjectReference Include="Kernel.Corlib.csproj" />
<ProjectReference Include="System.Compiler.Runtime\System.Compiler.Runtime.Kernel.csproj" />
<ProjectReference Include="ILHelpers.proj" />
<ProjectReference Include="SingSharp.Runtime\Microsoft.SingSharp.Runtime.Kernel.csproj" />
<ProjectReference Include="Singularity.Diagnostics\Diagnostics.csproj" />
<ProjectReference Include="Singularity.Loader\Loader.csproj" />
<ProjectReference Include="Singularity.Directory\Directory.csproj" />
<ProjectReference Include="Singularity.Stress\Stress.csproj" />
<ProjectReference Include="Singularity.Io\IoSystem.csproj" />
<ProjectReference Include="Singularity.Drivers\KernelDrivers.csproj" />
<ProjectReference Include="Singularity.Security\Security.csproj" />
<ProjectReference Include="Singularity.Security\Service\SecurityService.csproj" />
<ProjectReference Include="$(HalProject)" />
<ProjectReference Include="$(SINGULARITY_ROOT)\Contracts\Diagnostics.Contracts\Diagnostics.Contracts.Kernel.csproj" />
<ProjectReference Include="$(SINGULARITY_ROOT)\Contracts\Directory.Contracts\Directory.Contracts.Kernel.csproj" />
<ProjectReference Include="$(SINGULARITY_ROOT)\Contracts\FileSystem.Contracts\FileSystem.Contracts.Kernel.csproj" />
<ProjectReference Include="$(SINGULARITY_ROOT)\Contracts\Io.Contracts\Io.Contracts.Kernel.csproj" />
<ProjectReference Include="$(SINGULARITY_ROOT)\Contracts\Stress.Contracts\Stress.Contracts.Kernel.csproj" />
<ProjectReference Include="$(SINGULARITY_ROOT)\Contracts\Security.Contracts\Security.Contracts.Kernel.csproj" />
<ProjectReference Include="$(SINGULARITY_ROOT)\Contracts\NetStack.Contracts\NetStack.Contracts.Kernel.csproj" />
<!-- Reference project to copy the DLL, then reference it -->
<ProjectReference Include="Singularity.Drivers\NVidia_MSIL\KernelDriversNVidia_MSIL.csproj" />
<Reference Include="$(KERNEL_IL_DIR)\NVidiaDrivers.dll" />
</ItemGroup>
<Target Name="BuildDependentProjects">
<MSBuild Projects="@(ProjectReference)" StopOnFirstFailure="$(StopOnFirstFailure)">
<Output ItemName="Reference" TaskParameter="TargetOutputs"/>
</MSBuild>
</Target>
<Target Name="BuildKernelManifest"
Inputs="@(Reference)"
Outputs="$(KERNEL_NATIVE_DIR)\kernel.manifest"
DependsOnTargets="BuildDependentProjects">
<Message Text="Building kernel.manifest" />
<MakeDir Directories="$(KERNEL_NATIVE_DIR)"/>
<Exec Command="$(BUILDDIR)\mkmani /out:$(KERNEL_NATIVE_DIR)\kernel.manifest /app:kernel /cache:$(BASEDIR) @(Reference,' ')" />
</Target>
<Target Name="BuildAbiCandidates"
Inputs="$(KernelObjPath);$(NativeLibPath)"
Outputs="$(AbiCandidatesFile)"
DependsOnTargets="CompileKernelObj;BuildNativeLib">
<Message Text="Building Singularity.V1.candidates" />
<Exec Command="abi2def.cmd /version 1 /def $(AbiCandidatesFile) $(KernelObjPath) $(NativeLibPath)" />
</Target>
<!-- This target links a dummy version of the PE/COFF kernel. -->
<Target Name="LinkDummyKernel"
Outputs="$(KERNEL_NATIVE_DIR)\dummykernel.x86"
Inputs="$(KERNEL_NATIVE_DIR)\kernel.obj;$(NativeLibPath);linkdate.cpp;$(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE);dummysysentry.cpp"
DependsOnTargets="CompileKernelObj;BuildNativeLib;BuildAbiLib">
<Message Text="Building dummy kernel native .obj"/>
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /Fo$(KERNEL_NATIVE_DIR)\dummysysentry.obj /Fd$(KERNEL_NATIVE_DIR)\dummysysentry.pdb /c dummysysentry.cpp" />
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /Fo$(KERNEL_NATIVE_DIR)\linkdate.obj /Fd$(KERNEL_NATIVE_DIR)\linkdate.pdb /c linkdate.cpp" />
<Exec Command="$(LINK) /out:$(KERNEL_NATIVE_DIR)\dummykernel.x86 /def:$(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE) /pdb:$(KERNEL_NATIVE_DIR)\dummykernel.x86.pdb $(LFLAGS) /fixed /map /base:0x310000 $(LENTRYFLAGS) $(NativeLibPath) $(KERNEL_NATIVE_DIR)\linkdate.obj $(KERNEL_NATIVE_DIR)\kernel.obj $(KERNEL_NATIVE_DIR)\dummysysentry.obj $(KERNEL_NATIVE_DIR)\kernel_superObj.obj" />
<Exec Command="$(SDIZEPDB) /t:$(KERNEL_NATIVE_DIR)\kernel.txt $(KERNEL_NATIVE_DIR)\dummykernel.x86.pdb"
IgnoreExitCode="true"
Condition="'$(EnableSdize)'=='true'"/>
</Target>
<!-- This target dumps the export symbols of the dummy kernel. -->
<Target Name="CreateSyscallsSources"
Inputs="$(KERNEL_NATIVE_DIR)\dummykernel.x86"
Outputs="
$(KERNEL_NATIVE_DIR)\dummykernel.dumpbin;
$(KERNEL_NATIVE_DIR)\syscalls.h;
$(KERNEL_NATIVE_DIR)\syscalls.cpp;
$(KERNEL_NATIVE_DIR)\sysentry.cpp;
"
DependsOnTargets="LinkDummyKernel">
<Message Text="Dumping export symbols of dummy kernel"/>
<Exec Command="$(BUILDDIR)\dumpbin.exe /exports $(KERNEL_NATIVE_DIR)\dummykernel.x86 &gt; $(KERNEL_NATIVE_DIR)\dummykernel.dumpbin" />
<Exec Command="$(SYSCALL_BUILDER) /genhdr &lt; $(KERNEL_NATIVE_DIR)\dummykernel.dumpbin &gt; $(KERNEL_NATIVE_DIR)\syscalls.h" />
<Exec Command="$(SYSCALL_BUILDER) /genlib &lt; $(KERNEL_NATIVE_DIR)\dummykernel.dumpbin &gt; $(KERNEL_NATIVE_DIR)\syscalls.cpp" />
<Exec Command="$(SYSCALL_BUILDER) /genentry &lt; $(KERNEL_NATIVE_DIR)\dummykernel.dumpbin &gt; $(KERNEL_NATIVE_DIR)\sysentry.cpp"/>
</Target>
<Target Name="sysentry_obj"
Inputs="$(KERNEL_NATIVE_DIR)\sysentry.cpp;$(KERNEL_NATIVE_DIR)\syscalls.h"
Outputs="$(KERNEL_NATIVE_DIR)\sysentry.obj"
DependsOnTargets="CreateSyscallsSources">
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /Fo$(KERNEL_NATIVE_DIR)\sysentry.obj /Fd$(KERNEL_NATIVE_DIR)\sysentry.pdb /c $(KERNEL_NATIVE_DIR)\sysentry.cpp" />
</Target>
<Target Name="CompileRing3HalstackAsm"
Inputs="$(NativeSrcDir)\ring3_halstack.asm;$(KERNEL_NATIVE_DIR)\halclass.h"
Outputs="$(KERNEL_NATIVE_DIR)\ring3_halstack.obj"
DependsOnTargets="CompileKernelObj"
>
<Exec Command="$(AS) $(AFLAGS) $(ACFLAGS) /c /Fo$(KERNEL_NATIVE_DIR)\ring3_halstack.obj $(NativeSrcDir)\ring3_halstack.asm"/>
</Target>
<Target Name="CompileSyscallsObj"
Inputs="$(KERNEL_NATIVE_DIR)\syscalls.cpp;$(KERNEL_NATIVE_DIR)\syscalls.h"
Outputs="$(KERNEL_NATIVE_DIR)\syscalls.obj"
DependsOnTargets="CreateSyscallsSources">
<Exec Command="$(CC) /c $(CFLAGS) $(ACFLAGS) /Fd$(KERNEL_NATIVE_DIR)\syscalls.pdb /Fo$(KERNEL_NATIVE_DIR)\syscalls.obj $(KERNEL_NATIVE_DIR)\syscalls.cpp" />
<!-- <Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /LD /Fd$(KERNEL_NATIVE_DIR)\syscalls.pdb $(KERNEL_NATIVE_DIR)\syscalls.cpp /link /out:$(KERNEL_NATIVE_DIR)\syscalls.dll /NODEFAULTLIB /NOENTRY $(KERNEL_NATIVE_DIR)\kernel.lib" /> -->
</Target>
<ItemGroup>
<SyscallsObj Include="$(KERNEL_NATIVE_DIR)\syscalls.obj"/>
<SyscallsObj Include="$(KERNEL_NATIVE_DIR)\kernel.lib"/>
<SyscallsObj Include="$(KERNEL_NATIVE_DIR)\ring3_halstack.obj"/>
</ItemGroup>
<Target Name="LinkSyscallsDll"
Inputs="@(SyscallsObj)"
Outputs="$(KERNEL_NATIVE_DIR)\syscalls.dll"
DependsOnTargets="CompileSyscallsObj;LinkKernel;CompileRing3HalstackAsm"
>
<Exec Command="$(LINK) $(LFLAGS) /DLL /NOENTRY /MAP /out:$(KERNEL_NATIVE_DIR)\syscalls.dll /NODEFAULTLIB /pdb:$(KERNEL_NATIVE_DIR)\syscalls.dll.pdb /EXPORT:&quot;?g_LinkStack@Struct_Microsoft_Singularity_V1_Services_StackService@@SIXXZ&quot; /EXPORT:&quot;?g_UnlinkStack@Struct_Microsoft_Singularity_V1_Services_StackService@@SIXXZ&quot; @(SyscallsObj,' ')"/>
</Target>
<!--
######################################
# haryadi - - generating abi stubs
genabistub: $(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin \
Singularity\BspAbiStub.cs \
$(KERNEL_NATIVE_DIR)\MpSyscalls.x86
-->
<Target Name="genabistub"
Inputs="$(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin;Singularity\BspAbiStub.cs;$(KERNEL_NATIVE_DIR)\MpSyscalls.x86"
Outputs=""
DependsOnTargets="BuildKernelDmp">
</Target>
<Target Name="MakeDirs">
<MakeDir Directories="$(KERNEL_NATIVE_DIR);$(KPRIDIR)" />
</Target>
<Target Name="BuildAbiDumpBin"
Inputs="$(KERNEL_NATIVE_DIR)\SingularityStub.V1.lib"
Outputs="$(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin;$(KERNEL_NATIVE_DIR)\genApAbiStub.out;Singularity\BspAbiStub.cs"
DependsOnTargets="BuildAbStubLib">
<Exec Command="$(BUILDDIR)\dumpbin /exports $(KERNEL_NATIVE_DIR)\SingularityStub.V1.lib &gt; $(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin" />
<Exec Command="$(ASMP_SYSCALL_BUILDER) /genApAbiStub &lt; $(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin &gt; $(KERNEL_NATIVE_DIR)\genApAbiStub.out" />
<Exec Command="$(ASMP_SYSCALL_BUILDER) /genBspAbiStub &lt; $(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin &gt; Singularity\BspAbiStub.cs" />
</Target>
<!-- busted -->
<Target Name="BuildMpSyscallsObj"
Inputs="$(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin"
Outputs="$(KERNEL_NATIVE_DIR)\MpSyscalls.h;$(KERNEL_NATIVE_DIR)\MpSyscalls.cpp;$(KERNEL_NATIVE_DIR)\MpSyscalls.obj"
DependsOnTargets="BuildAbiDumpBin">
<Exec Command="$(ASMP_SYSCALL_BUILDER) /genMpSyscallsHeader &lt; $(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin &gt; $(KERNEL_NATIVE_DIR)\MpSyscalls.h" />
<Exec Command="$(ASMP_SYSCALL_BUILDER) /genMpSyscallsImpl &lt; $(KERNEL_NATIVE_DIR)\SingularityStub.V1.dumpbin &gt; $(KERNEL_NATIVE_DIR)\MpSyscalls.cpp" />
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /Fo$(KERNEL_NATIVE_DIR)\MpSyscalls.obj /Fd$(KERNEL_NATIVE_DIR)\MpSyscalls.pdb /c $(KERNEL_NATIVE_DIR)\MpSyscalls.cpp" />
</Target>
<!--
# pass5 depends on this .. which depends on MpSyscalls.obj
$(KERNEL_NATIVE_DIR)\MpSyscalls.x86: $(KERNEL_NATIVE_DIR)\MpSyscalls.obj $(KERNEL_NATIVE_DIR)\SingularityStub.V1.lib
$(LINK) $(LFLAGS) /fixed /MAP /out:$@ \
/pdb:$(KERNEL_NATIVE_DIR)\MpSyscalls.x86.pdb /base:0x00600000 /entry:entry \
$(KERNEL_NATIVE_DIR)\MpSyscalls.obj \
$(KERNEL_NATIVE_DIR)\SingularityStub.V1.lib
-->
<Target Name="BuildMpSyscallsNative"
Inputs="$(KERNEL_NATIVE_DIR)\MpSyscalls.obj;$(KERNEL_NATIVE_DIR)\SingularityStub.V1.lib"
Outputs="$(KERNEL_NATIVE_DIR)\MpSyscalls.x86"
DependsOnTargets="">
<Exec Command="$(LINK) $(LFLAGS) /fixed /MAP /out:$(KERNEL_NATIVE_DIR)\MpSyscalls.x86 /pdb:$(KERNEL_NATIVE_DIR)\MpSyscalls.x86.pdb /base:0x00600000 /entry:entry $(KERNEL_NATIVE_DIR)\MpSyscalls.obj $(KERNEL_NATIVE_DIR)\SingularityStub.V1.lib" />
</Target>
<ItemGroup>
<KernelObj Include="$(KERNEL_NATIVE_DIR)\kernel.obj"/>
<KernelObj Include="$(KERNEL_NATIVE_DIR)\kernel_superObj.obj"/>
</ItemGroup>
<Target Name="PreprocessAbiDef"
Inputs="$(SING_DEF_FILE)"
Outputs="$(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE)"
>
<MakeDir Directories="$(KERNEL_NATIVE_DIR)" />
<Message Text="Preprocessing ABI names - $(SING_DEF_FILE) to $(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE)" />
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /EP /TP $(SING_DEF_FILE) &gt; $(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE)" />
</Target>
<Target Name="LinkKernel"
Outputs="$(KERNEL_NATIVE_DIR)\kernel.x86;$(KERNEL_NATIVE_DIR)\kernel.lib"
Inputs="@(KernelObj);linkdate.cpp;$(NativeLibPath);$(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE)"
DependsOnTargets="CompileKernelObj;PreprocessAbiDef;BuildNativeLib;$(LinkKernelDependsOn)">
<Message Text="Linking kernel native PE image" />
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /Fo$(KERNEL_NATIVE_DIR)\linkdate.obj /Fd$(KERNEL_NATIVE_DIR)\linkdate.pdb /c linkdate.cpp" />
<Exec Command="$(LINK) /out:$(KERNEL_NATIVE_DIR)\kernel.x86 /def:$(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE) /debug /pdb:$(KERNEL_NATIVE_DIR)\kernel.x86.pdb $(LFLAGS) $(LBASEFLAGS) $(LENTRYFLAGS) $(NativeLibPath) $(KERNEL_NATIVE_DIR)\linkdate.obj @(KernelObj,' ')" />
<Exec Command="$(SDIZEPDB) /t:$(KERNEL_NATIVE_DIR)\kernel.txt $(KERNEL_NATIVE_DIR)\kernel.x86.pdb"
IgnoreExitCode="true"
Condition="'$(EnableSdize)'=='true'"/>
</Target>
<!--
This builds SINGLDR, which depends on *some* of the targets within Kernel.proj.
SINGLDR.proj and Kernel.proj both have dependencies on specific targets within each other.
MSBuild handles this correctly.
-->
<Target Name="BuildSingldr">
<MSBuild Projects="$(SINGULARITY_ROOT)\Boot\SINGLDR\SINGLDR.proj" StopOnFirstFailure="$(StopOnFirstFailure)"/>
</Target>
<Target Name="BuildKernelDmp"
Outputs="$(KERNEL_NATIVE_DIR)\kernel.dmp"
Inputs="$(KERNEL_NATIVE_DIR)\kernel.x86;$(BOOTDIR)\undump.exe;$(BOOTDIR)\Singldr"
DependsOnTargets="LinkKernel;BuildSingldr">
<Message Text="Building kernel dump file" />
<Exec Command="$(BUILDDIR)\mkcore /v /s:0x2fff00 /c:0x100 /o:$(KERNEL_NATIVE_DIR)\kernel.dmp $(KERNEL_NATIVE_DIR)\kernel.x86 $(BOOTDIR)\undump.exe /a:0x7b00 /b:$(BOOTDIR)\Singldr" />
</Target>
<!-- ############################################################# C++ Hello World. -->
<Target Name="BuildTestPeObj"
Inputs="testpe.cpp"
Outputs="$(KERNEL_NATIVE_DIR)\testpe.obj"
DependsOnTargets="">
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /FAsc /Fa$(KERNEL_NATIVE_DIR)\testpe.lst /Fo$(KERNEL_NATIVE_DIR)\testpe.obj /Fd$(KERNEL_NATIVE_DIR)\testpe.pdb /c testpe.cpp" />
</Target>
<Target Name="LinkTestApp"
Outputs="$(KERNEL_NATIVE_DIR)\testpe.x86"
Inputs="$(KERNEL_NATIVE_DIR)\testpe.obj;$(KERNEL_NATIVE_DIR)\Singularity.V1.lib"
DependsOnTargets="BuildTestPeObj;BuildAbiLib">
<Message Text="Linking native PE image of test app" />
<Exec Command="$(LINK) $(LFLAGS) /fixed:no /out:$(KERNEL_NATIVE_DIR)\testpe.x86 /pdb:$(KERNEL_NATIVE_DIR)\testpe.x86.pdb /base:0x2000000 /entry:entry $(KERNEL_NATIVE_DIR)\testpe.obj $(KERNEL_NATIVE_DIR)\Singularity.V1.lib" />
</Target>
<Target Name="BuildAbiLib"
Inputs="$(SING_DEF_FILE)"
Outputs="$(KERNEL_NATIVE_DIR)\Singularity.V1.lib">
<Message Text="Preprocessing ABI .def file: $(SING_DEF_FILE) to $(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE)" />
<MakeDir Directories="$(KERNEL_NATIVE_DIR)" />
<Exec Command="$(CC) $(CFLAGS) $(ACFLAGS) /EP /TP $(SING_DEF_FILE) &gt; $(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE)" />
<Message Text="Validating ABI" />
<Exec Command="validabi.cmd $(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE)" />
<Exec Command="$(LIB) /nologo /def:$(KERNEL_NATIVE_DIR)\$(SING_DEF_FILE) /machine:$(MACHINE) /out:$(KERNEL_NATIVE_DIR)\Singularity.V1.lib" />
</Target>
<Target Name="BuildTestPeManifest" Inputs="testpe.manifest" Outputs="$(KERNEL_NATIVE_DIR)\testpe.manifest">
<Copy SourceFiles="testpe.manifest" DestinationFolder="$(KERNEL_NATIVE_DIR)" />
</Target>
<!--
==============================================================================================
Native runtime sources
==============================================================================================
-->
<ItemGroup Condition="'$(Machine)'=='x86'">
<NativeIncludes Include="Native\hal.h"/>
<NativeIncludes Include="Native\halkd.h"/>
<NativeIncludes Include="Native\halkd1394.h"/>
<NativeSource Include="Native\Buffer.cpp"/>
<NativeSource Include="Native\Decimal.cpp"/>
<NativeSource Include="Native\Math.cpp"/>
<NativeSource Include="Native\Number.cpp"/>
<NativeSource Include="Native\PEImage.cpp"/>
<NativeSource Include="Native\Processor.cpp"/>
<NativeSource Include="Native\Stacks.cpp"/>
<NativeSource Include="Native\Thread.cpp"/>
<NativeSource Include="Native\Tracing.cpp"/>
<NativeSource Include="Native\Monitoring.cpp"/>
<NativeSource Include="Native\halexn.cpp"/>
<NativeSource Include="Native\halforgc.asm"/>
<NativeSource Include="Native\halasm.asm"/>
<NativeSource Include="Native\_lldiv.asm"/>
<NativeSource Include="Native\_llmul.asm"/>
<NativeSource Include="Native\_llshl.asm"/>
<NativeSource Include="Native\_llshr.asm"/>
<NativeSource Include="Native\_llrem.asm"/>
<NativeSource Include="Native\_memcpy.asm"/>
<NativeSource Include="Native\_memset.asm"/>
<NativeSource Include="Native\_ulldiv.asm"/>
<NativeSource Include="Native\_ulldvrm.asm"/>
<NativeSource Include="Native\_ullrem.asm"/>
<NativeSource Include="Native\halstack.asm"/>
<NativeSource Include="Native\ring0_halstack.asm"/>
<NativeSource Include="Native\halkd.cpp"/>
<NativeSource Include="Native\halkd1394.cpp"/>
<NativeSource Include="Native\halkdcom.cpp"/>
<NativeSource Include="Native\hal.cpp"/>
<NativeSource Include="Native\BootInfo.cpp"/>
<NativeSource Include="Native\halcpu.asm"/>
<NativeSource Include="Native\halidt.asm"/>
<NativeSource Include="Native\IoPort.cpp"/>
<NativeSource Include="Native\MpBootInfo.cpp"/>
</ItemGroup>
<!-- This target creates __native_objs items from NativeSource items. -->
<Target Name="CreateNativeItems">
<CreateItem Include="$(KPRIDIR)\%(NativeSource.filename).obj">
<Output ItemName="__native_objs" TaskParameter="Include"/>
</CreateItem>
</Target>
<!--
Note: This target uses batching. All tasks within the target will be executed, once for each distinct
value of %(NativeSources.identity).
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 CompileKernelObj because Bartok generates halclass.h / halclass.inc.
-->
<Target Name="CompileNativeSources"
Inputs="
%(NativeSource.identity);
%(NativeSource.Dependencies);
@(NativeIncludes);
$(KERNEL_NATIVE_DIR)\halclass.h;
$(KERNEL_NATIVE_DIR)\halclass.inc;
"
Outputs="$(KPRIDIR)\%(NativeSource.filename).obj"
DependsOnTargets="CompileKernelObj;CreateNativeItems;MakeDirs">
<MakeDir Directories="$(KERNEL_NATIVE_DIR)"/>
<!-- Compile C++ sources -->
<Exec Condition="'%(NativeSource.extension)'=='.c' or '%(NativeSource.extension)'=='.cpp'"
Command="$(CC) $(CFLAGS) $(ACFLAGS) $(GC_ML_DEFS) /I$(KERNEL_NATIVE_DIR) /I$(NativeSrcDir) /FAsc /Fa$(KPRIDIR)\%(NativeSource.filename).lst /Fd$(KERNEL_NATIVE_DIR)\native.pdb /Fo$(KPRIDIR)\%(NativeSource.filename).obj /c %(NativeSource.identity)"/>
<!-- Compile assembly sources -->
<Exec Condition="'%(NativeSource.extension)'=='.asm'"
Command="$(AS) $(AFLAGS) $(ACFLAGS) $(GC_ML_DEFS) /I$(KERNEL_NATIVE_DIR) /I$(NativeSrcDir) /Fl$(KPRIDIR)\%(NativeSource.filename).lst /Fo$(KPRIDIR)\%(NativeSource.filename).obj /c %(NativeSource.identity)"/>
</Target>
<Target Name="BuildNativeLib"
DependsOnTargets="CompileNativeSources"
Outputs="$(KERNEL_NATIVE_DIR)\native.lib"
Inputs="@(__native_objs)">
<Message Text="Linking native lib - $(KERNEL_NATIVE_DIR)\native.lib"/>
<Delete Files="$(KERNEL_NATIVE_DIR)\native.lib"/>
<Exec Command="$(LIB) /nologo /nod /out:$(KERNEL_NATIVE_DIR)\native.lib @(__native_objs,' ')"/>
</Target>
<!-- This target is useful for debugging build problems. -->
<Target Name="PreprocessNativeSources"
Inputs="%(NativeSource.identity)"
Outputs="$(KPRIDIR)\%(NativeSource.filename).i"
DependsOnTargets="CompileKernelObj;CreateNativeItems;MakeDirs">
<!-- Compile C++ sources -->
<Exec Condition="'%(NativeSource.extension)'=='.c' or '%(NativeSource.extension)'=='.cpp'"
Command="$(CC) /EP &gt;$(KPRIDIR)\%(NativeSource.filename).i $(CFLAGS) $(ACFLAGS) $(GC_ML_DEFS) /I$(KERNEL_NATIVE_DIR) /INative /FAsc /Fa$(KPRIDIR)\%(NativeSource.filename).lst /Fd$(KERNEL_NATIVE_DIR)\native.pdb /Fo$(KPRIDIR)\%(NativeSource.filename).obj /c %(NativeSource.identity)"/>
<!-- Compile assembly sources -->
<Exec Condition="'%(NativeSource.extension)'=='.asm'"
Command="$(AS) /EP &gt;$(KPRIDIR)\%(NativeSource.filename).i $(AFLAGS) $(ACFLAGS) $(GC_ML_DEFS) /I$(KERNEL_NATIVE_DIR) /INative /Fl$(KPRIDIR)\%(NativeSource.filename).lst /Fo$(KPRIDIR)\%(NativeSource.filename).obj /c %(NativeSource.identity)"/>
</Target>
<Target Name="ShowDebugInfo">
<Message Text="KERNEL_NATIVE_DIR: $(KERNEL_NATIVE_DIR)"/>
<Message Text="KERNEL_IL_DIR: $(KERNEL_IL_DIR)"/>
</Target>
<Target Name="CompileKernelObj"
Inputs="@(Reference)"
Outputs="$(KernelObjPath);$(KERNEL_NATIVE_DIR)\kernel_superObj.obj;$(KERNEL_NATIVE_DIR)\halclass.h;$(KERNEL_NATIVE_DIR)\halclass.inc"
DependsOnTargets="BuildDependentProjects;MakeDirs"
>
<Message Text="Compiling Kernel.obj native image"/>
<Message Text="IL assemblies:"/>
<Message Text=" %(Reference.identity)"/>
<Exec WorkingDirectory="$(SINGULARITY_ROOT)\build"
Command="PATH $(SINGULARITY_PATH)
$(BARTOK) $(BARTOK_COLLECTOR) $(BartokFlags) /out: $(KernelObjPath) @(Reference->'%(identity)',' ') $(KERNEL_BARTOK_LOG)"/>
</Target>
</Project>