PowerShell7/Makefile

111 lines
2.8 KiB
Makefile
Raw Normal View History

2015-10-26 03:46:31 +00:00
# the monad-linux superproject and lib directory
export MONAD=$(realpath $(CURDIR))
2015-10-26 03:46:31 +00:00
export PSLIB=$(MONAD)/lib
all: powershell-native powershell-managed
# managed code
powershell-managed:
$(MAKE) -j -C src/monad-build all test
# native code
powershell-native: src/monad-native/Makefile
2015-10-26 19:09:35 +00:00
$(MAKE) -j -C src/monad-native all test
src/monad-native/Makefile:
cd src/monad-native && cmake .
# one-time setup
tools/nuget.exe:
2015-10-26 19:01:01 +00:00
cd tools && 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'
bootstrap: tools/nuget.exe
mono $< restore -PackagesDirectory tools
# run targets
2015-10-26 03:51:16 +00:00
2015-10-26 03:46:31 +00:00
export POWERSHELL=env LD_LIBRARY_PATH=$(PSLIB) CORE_ROOT=$(MONAD)/src/monad-ext/coreclr/Runtime PWRSH_ROOT=$(PSLIB) PSMODULEPATH=$(PSLIB)/Modules $(MONAD)/bin/powershell
export POWERSHELL_SIMPLE=$(POWERSHELL) $(PSLIB)/powershell-simple.exe
demo:
2015-10-26 03:46:31 +00:00
$(POWERSHELL_SIMPLE) '"a","b","c","a","a" | Select-Object -Unique'
shell:
$(POWERSHELL) lib/powershell-run.exe
2015-10-26 04:01:15 +00:00
# tests
test: test-pester
2015-10-26 03:51:16 +00:00
## TODO: fix this after refactoring bin/powershell
test-hashbang:
PATH=$(PATH):$(PSLIB) src/3rdparty/hashbang/script.ps1
2015-10-26 04:01:15 +00:00
## Pester tests for PowerShell - results in pester-tests.xml
## - see https://github.com/pester/Pester
## - requires $TEMP to be set
## - we cd because some tests rely on the current working directory
PESTER=$(MONAD)/src/pester-tests
test-pester:
$(POWERSHELL_SIMPLE) 'cd $(PESTER); $$env:TEMP="/tmp"; invoke-pester -OutputFile $(MONAD)/pester-tests.xml -OutputFormat NUnitXml'
## Pester self-tests
## - results in pester-self-tests.xml
test-pester-self:
$(POWERSHELL_SIMPLE) 'cd $(PSLIB)/Modules/Pester/Functions; $$env:TEMP="/tmp"; invoke-pester -OutputFile $(MONAD)/pester-self-tests.xml -OutputFormat NUnitXml'
2015-10-26 05:19:35 +00:00
## tracing
## - use PAL_DBG_CHANNELS="+LOADER.TRACE" to enable CoreCLR tracing
## - use Set-PSDebug -Trace 2 to enable PowerShell tracing
# OMI
OMI=src/omi/Unix
OMI_FLAGS=--dev --enable-debug
$(OMI)/GNUmakefile:
cd $(OMI) && ./configure $(OMI_FLAGS)
OMISERVER=$(OMI)/output/bin/omiserver
$(OMISERVER): $(OMI)/GNUmakefile
$(MAKE) -j -C $(OMI)
## copy libpshost because OMI isn't configurable
MONAD_PROVIDER=src/monad-omi-provider
PSRP_OMI_PROVIDER=$(OMI)/output/lib/libTestShell.so
$(PSRP_OMI_PROVIDER): $(OMISERVER)
cp lib/libpshost.a $(OMI)/output/lib
$(MAKE) -j -C $(MONAD_PROVIDER)
psrp: $(PSRP_OMI_PROVIDER)
## phony targets so that the recursive make is always invoked
.PHONY: $(OMISERVER) $(PSRP_OMI_PROVIDER)
2015-10-26 03:51:16 +00:00
# clean targets
2015-10-26 05:31:31 +00:00
clean: clean-monad
2015-10-26 19:09:47 +00:00
-rm *-tests.xml
2015-10-26 05:19:23 +00:00
distclean: distclean-omi distclean-monad clean
2015-10-26 19:09:47 +00:00
-rm -rf tools/*
2015-10-26 05:19:23 +00:00
clean-monad:
$(MAKE) -C src/monad-build clean
2015-10-26 05:19:23 +00:00
distclean-monad:
$(MAKE) -C src/monad-build distclean
clean-native:
2015-10-26 05:19:23 +00:00
-$(MAKE) -C src/monad-native clean
clean-omi:
-$(MAKE) -C $(OMI) clean
distclean-omi:
-$(MAKE) -C $(OMI) distclean
2015-10-26 05:19:23 +00:00
clean-psrp:
-$(MAKE) -C $(MONAD_PROVIDER) clean