Merge pull request 168 from dev/clean-up-makefile into develop
This commit is contained in:
commit
4682b26c08
2 changed files with 25 additions and 33 deletions
|
@ -25,8 +25,6 @@ include commands-utility.mk
|
||||||
include management-infrastructure.mk
|
include management-infrastructure.mk
|
||||||
include security.mk
|
include security.mk
|
||||||
|
|
||||||
NUGETREF=-r:buildtemp/System.Reflection.Metadata.dll -r:buildtemp/System.Collections.Immutable.dll
|
|
||||||
|
|
||||||
MI_NATIVE_REF=-r:dotnetlibs/Microsoft.Management.Infrastructure.Native.dll
|
MI_NATIVE_REF=-r:dotnetlibs/Microsoft.Management.Infrastructure.Native.dll
|
||||||
MI_REF_ASSEMBLY=-r:$(MONAD_EXT)/PS/PS_refs_modil/microsoft.management.infrastructure.metadata_dll
|
MI_REF_ASSEMBLY=-r:$(MONAD_EXT)/PS/PS_refs_modil/microsoft.management.infrastructure.metadata_dll
|
||||||
MI_ASSEMBLY=dotnetlibs/Microsoft.Management.Infrastructure.dll
|
MI_ASSEMBLY=dotnetlibs/Microsoft.Management.Infrastructure.dll
|
||||||
|
@ -40,7 +38,7 @@ PRODUCT_COMMANDS_REFS=$(COREREF) -r:dotnetlibs/System.Management.Automation.dll
|
||||||
# compilers
|
# compilers
|
||||||
# - Roslyn's csc is used for all the PS code
|
# - Roslyn's csc is used for all the PS code
|
||||||
# - Mono's mcs is used for build helper tools
|
# - Mono's mcs is used for build helper tools
|
||||||
CSC=mono buildtemp/Microsoft.Net.Compilers.*/tools/csc.exe
|
CSC=mono buildtemp/Microsoft.Net.Compilers.1.0.0/tools/csc.exe
|
||||||
MCS=mcs
|
MCS=mcs
|
||||||
|
|
||||||
CSCOPTS_BASE=-noconfig -nostdlib
|
CSCOPTS_BASE=-noconfig -nostdlib
|
||||||
|
@ -52,45 +50,40 @@ RUN_TARGETS=$(POWERSHELL_RUN_TARGETS) $(addprefix dotnetlibs/, Microsoft.PowerSh
|
||||||
all: dotnetlibs/System.Management.Automation.dll $(RUN_TARGETS) dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET)
|
all: dotnetlibs/System.Management.Automation.dll $(RUN_TARGETS) dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET)
|
||||||
|
|
||||||
# this is the build rule for SMA.dll
|
# this is the build rule for SMA.dll
|
||||||
dotnetlibs/System.Management.Automation.dll: $(SYS_AUTO_SRCS) dotnetlibs/Microsoft.Management.Infrastructure.dll ../src/assembly-info/System.Management.Automation.assembly-info.cs dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) $(SYS_AUTO_RES_SRCS) $(SYS_AUTO_RES_CS_SRCS)
|
dotnetlibs/System.Management.Automation.dll: prepare $(SYS_AUTO_SRCS) dotnetlibs/Microsoft.Management.Infrastructure.dll ../src/assembly-info/System.Management.Automation.assembly-info.cs dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) $(SYS_AUTO_RES_SRCS) $(SYS_AUTO_RES_CS_SRCS)
|
||||||
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_PS_REFS) $(SYS_AUTO_SRCS) $(SYS_AUTO_RES_REF) $(SYS_AUTO_RES_CS_SRCS) ../src/assembly-info/System.Management.Automation.assembly-info.cs
|
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_PS_REFS) $(SYS_AUTO_SRCS) $(SYS_AUTO_RES_REF) $(SYS_AUTO_RES_CS_SRCS) ../src/assembly-info/System.Management.Automation.assembly-info.cs
|
||||||
|
|
||||||
# this is the build rule for MMI.dll
|
# this is the build rule for MMI.dll
|
||||||
dotnetlibs/Microsoft.Management.Infrastructure.dll: $(MAN_INFRA_SRCS) dotnetlibs/Microsoft.Management.Infrastructure.Native.dll ../src/assembly-info/Microsoft.Management.Infrastructure.assembly-info.cs $(MAN_INFRA_RES_SRCS) $(MAN_INFRA_RES_CS_SRCS)
|
dotnetlibs/Microsoft.Management.Infrastructure.dll: prepare $(MAN_INFRA_SRCS) dotnetlibs/Microsoft.Management.Infrastructure.Native.dll ../src/assembly-info/Microsoft.Management.Infrastructure.assembly-info.cs $(MAN_INFRA_RES_SRCS) $(MAN_INFRA_RES_CS_SRCS)
|
||||||
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_MI_REFS) $(MAN_INFRA_SRCS) $(MAN_INFRA_RES_REF) $(MAN_INFRA_RES_CS_SRCS) ../src/assembly-info/Microsoft.Management.Infrastructure.assembly-info.cs
|
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_MI_REFS) $(MAN_INFRA_SRCS) $(MAN_INFRA_RES_REF) $(MAN_INFRA_RES_CS_SRCS) ../src/assembly-info/Microsoft.Management.Infrastructure.assembly-info.cs
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
|
|
||||||
dotnetlibs/Microsoft.PowerShell.Commands.Management.dll: $(COMMANDS_MANAGEMENT_SRCS) dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Security.dll $(COMMANDS_MANAGEMENT_RES_SRCS) $(COMMANDS_MANAGEMENT_RES_CS_SRCS) $(MI_ASSEMBLY)
|
dotnetlibs/Microsoft.PowerShell.Commands.Management.dll: prepare $(COMMANDS_MANAGEMENT_SRCS) dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Security.dll $(COMMANDS_MANAGEMENT_RES_SRCS) $(COMMANDS_MANAGEMENT_RES_CS_SRCS) $(MI_ASSEMBLY)
|
||||||
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_COMMANDS_REFS) $(COMMANDS_MANAGEMENT_SRCS) $(COMMANDS_MANAGEMENT_RES_CS_SRCS) $(COMMANDS_MANAGEMENT_RES_REF) $(MI_REF) -r:dotnetlibs/Microsoft.PowerShell.Security.dll
|
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_COMMANDS_REFS) $(COMMANDS_MANAGEMENT_SRCS) $(COMMANDS_MANAGEMENT_RES_CS_SRCS) $(COMMANDS_MANAGEMENT_RES_REF) $(MI_REF) -r:dotnetlibs/Microsoft.PowerShell.Security.dll
|
||||||
|
|
||||||
dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll: $(COMMANDS_UTILITY_SRCS) dotnetlibs/System.Management.Automation.dll $(COMMANDS_UTILITY_RES_SRCS) $(COMMANDS_UTILITY_RES_CS_SRCS)
|
dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll: prepare $(COMMANDS_UTILITY_SRCS) dotnetlibs/System.Management.Automation.dll $(COMMANDS_UTILITY_RES_SRCS) $(COMMANDS_UTILITY_RES_CS_SRCS)
|
||||||
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_COMMANDS_REFS) $(COMMANDS_UTILITY_SRCS) $(COMMANDS_UTILITY_RES_CS_SRCS) $(COMMANDS_UTILITY_RES_REF)
|
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_COMMANDS_REFS) $(COMMANDS_UTILITY_SRCS) $(COMMANDS_UTILITY_RES_CS_SRCS) $(COMMANDS_UTILITY_RES_REF)
|
||||||
|
|
||||||
dotnetlibs/Microsoft.PowerShell.Security.dll: $(SECURITY_SRCS) $(SECURITY_RES_SRCS) $(SECURITY_RES_CS_SRCS)
|
dotnetlibs/Microsoft.PowerShell.Security.dll: prepare $(SECURITY_SRCS) $(SECURITY_RES_SRCS) $(SECURITY_RES_CS_SRCS)
|
||||||
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_COMMANDS_REFS) $(SECURITY_SRCS) $(SECURITY_RES_CS_SRCS) $(SECURITY_RES_REF)
|
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_COMMANDS_REFS) $(SECURITY_SRCS) $(SECURITY_RES_CS_SRCS) $(SECURITY_RES_REF)
|
||||||
|
|
||||||
# assembly load context
|
# assembly load context
|
||||||
|
|
||||||
dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET): $(ASSEMBLY_LOAD_CONTEXT_SRCS)
|
dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET): prepare $(ASSEMBLY_LOAD_CONTEXT_SRCS)
|
||||||
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_BASE_REFS) $(ASSEMBLY_LOAD_CONTEXT_SRCS)
|
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_BASE_REFS) $(ASSEMBLY_LOAD_CONTEXT_SRCS)
|
||||||
|
|
||||||
# this will copy whatever the first version of the dll in the globber is
|
|
||||||
buildtemp/System.Reflection.Metadata.dll: buildtemp/System.Reflection.Metadata.*/lib/*/System.Reflection.Metadata.dll prepare
|
|
||||||
cp -f $< $@
|
|
||||||
|
|
||||||
# this will copy whatever the first version of the dll in the globber is
|
|
||||||
buildtemp/System.Collections.Immutable.dll: buildtemp/System.Collections.Immutable.*/lib/*/System.Collections.Immutable.dll prepare
|
|
||||||
cp -f $< $@
|
|
||||||
|
|
||||||
# this one is built from stubs
|
# this one is built from stubs
|
||||||
dotnetlibs/Microsoft.Management.Infrastructure.Native.dll: ../src/stubs/Microsoft.Management.Infrastructure.Native-stub.cs ../src/stubs/Microsoft.Management.Infrastructure.Native-stub-assembly-info.cs
|
MI_STUBS=../src/stubs/Microsoft.Management.Infrastructure.Native-stub.cs ../src/stubs/Microsoft.Management.Infrastructure.Native-stub-assembly-info.cs
|
||||||
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_BASE_REFS) $^
|
dotnetlibs/Microsoft.Management.Infrastructure.Native.dll: prepare $(MI_STUBS)
|
||||||
|
$(CSC) -out:$@ $(CSCOPTS_LIB_PS) $(PRODUCT_BASE_REFS) $(MI_STUBS)
|
||||||
|
|
||||||
|
# this creates the type catalog generator
|
||||||
MPATH=/usr/lib/mono/4.5/Facades
|
MPATH=/usr/lib/mono/4.5/Facades
|
||||||
|
REFLECTION_METADATA=buildtemp/System.Reflection.Metadata.1.0.22/lib/dotnet/System.Reflection.Metadata.dll
|
||||||
buildtemp/TypeCatalogGen.exe: ../src/monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/TypeCatalogGen/TypeCatalogGen.cs buildtemp/System.Reflection.Metadata.dll buildtemp/System.Collections.Immutable.dll
|
COLLECTIONS_IMMUTABLE=buildtemp/System.Collections.Immutable.1.1.37/lib/dotnet/System.Collections.Immutable.dll
|
||||||
$(MCS) -out:$@ -target:exe $(NUGETREF) -pkg:dotnet -r:$(MPATH)/System.Runtime.dll -r:$(MPATH)/System.Reflection.Primitives.dll -r:$(MPATH)/System.IO.dll $<
|
buildtemp/TypeCatalogGen.exe: ../src/monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/TypeCatalogGen/TypeCatalogGen.cs $(REFLECTION_METADATA) $(COLLECTIONS_IMMUTABLE)
|
||||||
|
$(MCS) -out:$@ -target:exe -pkg:dotnet $(addprefix -r:, $(REFLECTION_METADATA) $(COLLECTIONS_IMMUTABLE) $(MPATH)/System.Runtime.dll $(MPATH)/System.Reflection.Primitives.dll $(MPATH)/System.IO.dll) $<
|
||||||
|
|
||||||
# this generates the necessary file of CoreCLR references that is an artifact of the Windows build process
|
# this generates the necessary file of CoreCLR references that is an artifact of the Windows build process
|
||||||
# since we don't have Make 4.1, we can't use $(file), and using @echo makes the escaping tricky
|
# since we don't have Make 4.1, we can't use $(file), and using @echo makes the escaping tricky
|
||||||
|
@ -105,8 +98,8 @@ powershell.inc:
|
||||||
|
|
||||||
# generate the Core PS type catalog
|
# generate the Core PS type catalog
|
||||||
# this comes from: ../src/monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/makefile.inc
|
# this comes from: ../src/monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/makefile.inc
|
||||||
CorePsTypeCatalog.cs: powershell.inc buildtemp/TypeCatalogGen.exe buildtemp/System.Reflection.Metadata.dll buildtemp/System.Collections.Immutable.dll
|
CorePsTypeCatalog.cs: powershell.inc buildtemp/TypeCatalogGen.exe
|
||||||
LD_LIBRARY_PATH=. mono buildtemp/TypeCatalogGen.exe $< $@ $(MONAD_EXT)/coreclr/TargetingPack
|
MONO_PATH=$(dir $(REFLECTION_METADATA)):$(dir $(COLLECTIONS_IMMUTABLE)) mono buildtemp/TypeCatalogGen.exe $< $@ $(MONAD_EXT)/coreclr/TargetingPack
|
||||||
|
|
||||||
# the pinvoke library libps.so
|
# the pinvoke library libps.so
|
||||||
|
|
||||||
|
@ -139,10 +132,10 @@ dotnetlibs/api-ms-win-core-registry-l1-1-0.dll: ../src/win-dll/lib-api-ms-win-co
|
||||||
nuget.exe:
|
nuget.exe:
|
||||||
wget 'https://nuget.org/nuget.exe'
|
wget 'https://nuget.org/nuget.exe'
|
||||||
|
|
||||||
NUGET_INSTALL=cd buildtemp && mono nuget.exe install
|
buildtemp:
|
||||||
|
|
||||||
prepare: nuget.exe
|
|
||||||
mkdir -p buildtemp
|
mkdir -p buildtemp
|
||||||
|
|
||||||
|
prepare: nuget.exe buildtemp
|
||||||
mono nuget.exe restore -PackagesDirectory buildtemp
|
mono nuget.exe restore -PackagesDirectory buildtemp
|
||||||
|
|
||||||
# this is the execution environment from which all managed code is run
|
# this is the execution environment from which all managed code is run
|
||||||
|
@ -203,7 +196,7 @@ TEST_SRCS=$(addprefix $(TEST_FOLDER)/, test_*.cs)
|
||||||
$(APP_BASE)/xunit%: $(MONAD_EXT)/xunit/xunit%
|
$(APP_BASE)/xunit%: $(MONAD_EXT)/xunit/xunit%
|
||||||
cp -f $^ $@
|
cp -f $^ $@
|
||||||
|
|
||||||
$(APP_BASE)/ps_test.dll: $(TEST_SRCS) $(addprefix $(APP_BASE)/, xunit.core.dll xunit.assert.dll) $(addprefix dotnetlibs/, System.Management.Automation.dll Microsoft.PowerShell.Commands.Management.dll $(ASSEMBLY_LOAD_CONTEXT_TARGET))
|
$(APP_BASE)/ps_test.dll: prepare $(TEST_SRCS) $(addprefix $(APP_BASE)/, xunit.core.dll xunit.assert.dll) $(addprefix dotnetlibs/, System.Management.Automation.dll Microsoft.PowerShell.Commands.Management.dll $(ASSEMBLY_LOAD_CONTEXT_TARGET))
|
||||||
$(CSC) $(CSCOPTS_LIB) -out:$@ $(addprefix -r:$(APP_BASE)/, xunit.core.dll xunit.assert.dll) $(addprefix -r:dotnetlibs/, System.Management.Automation.dll $(ASSEMBLY_LOAD_CONTEXT_TARGET)) $(COREREF) $(TEST_SRCS)
|
$(CSC) $(CSCOPTS_LIB) -out:$@ $(addprefix -r:$(APP_BASE)/, xunit.core.dll xunit.assert.dll) $(addprefix -r:dotnetlibs/, System.Management.Automation.dll $(ASSEMBLY_LOAD_CONTEXT_TARGET)) $(COREREF) $(TEST_SRCS)
|
||||||
|
|
||||||
xunit-tests: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr $(addprefix $(APP_BASE)/, ps_test.dll xunit.console.netcore.exe xunit.runner.utility.dll xunit.abstractions.dll xunit.execution.dll)
|
xunit-tests: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr $(addprefix $(APP_BASE)/, ps_test.dll xunit.console.netcore.exe xunit.runner.utility.dll xunit.abstractions.dll xunit.execution.dll)
|
||||||
|
@ -214,7 +207,7 @@ pester-tests: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
||||||
# execute the Pester tests, which needs a TEMP environment variable to be set
|
# execute the Pester tests, which needs a TEMP environment variable to be set
|
||||||
$(APP_BASE)/runps-simple.sh 'cd ../../../src/pester-tests; $$env:TEMP="/tmp"; invoke-pester'
|
$(APP_BASE)/runps-simple.sh 'cd ../../../src/pester-tests; $$env:TEMP="/tmp"; invoke-pester'
|
||||||
|
|
||||||
hashbang-tests:
|
hashbang-tests: all
|
||||||
# execute the 3rdparty/hashbang example
|
# execute the 3rdparty/hashbang example
|
||||||
PATH=$(PATH):$(shell pwd)/$(APP_BASE) $(shell pwd)/3rdparty/hashbang/script.ps1
|
PATH=$(PATH):$(shell pwd)/$(APP_BASE) $(shell pwd)/3rdparty/hashbang/script.ps1
|
||||||
|
|
||||||
|
@ -236,7 +229,7 @@ clean:
|
||||||
|
|
||||||
# clean built stuff + prepare step
|
# clean built stuff + prepare step
|
||||||
cleanall: clean clean-native
|
cleanall: clean clean-native
|
||||||
rm -rf buildtemp xunittests.xml
|
rm -rf nuget.exe buildtemp xunittests.xml
|
||||||
|
|
||||||
docker-build:
|
docker-build:
|
||||||
docker build --no-cache=false -t image_ps .
|
docker build --no-cache=false -t image_ps .
|
||||||
|
@ -257,4 +250,3 @@ docker-run: docker-build
|
||||||
docker-stop:
|
docker-stop:
|
||||||
docker stop test_ps
|
docker stop test_ps
|
||||||
docker rm test_ps
|
docker rm test_ps
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="System.Reflection.Metadata" version="1.0.21" />
|
<package id="System.Reflection.Metadata" version="1.0.22" />
|
||||||
<package id="System.Collections.Immutable" version="1.1.36" />
|
<package id="System.Collections.Immutable" version="1.1.37" />
|
||||||
<package id="Microsoft.Net.Compilers" version="1.0.0" />
|
<package id="Microsoft.Net.Compilers" version="1.0.0" />
|
||||||
</packages>
|
</packages>
|
||||||
|
|
Loading…
Reference in a new issue