better ps make script

This commit is contained in:
Antoni Sawicki 2019-07-29 23:59:32 -07:00
parent 749f8bea5d
commit 7a27cf7b62

View File

@ -2,19 +2,16 @@ param (
[switch]$clean = $false [switch]$clean = $false
) )
$env:GOARCH="amd64" $env:GOARCH="amd64"
foreach($os in ("linux", "freebsd", "openbsd", "darwin", "windows")) { foreach($sys in ("amd64-linux", "arm-linux", "amd64-freebsd", "amd64-openbsd", "amd64-darwin", "amd64-windows")) {
$cpu,$os = $sys.split('-')
$env:GOARCH=$cpu
$env:GOOS=$os $env:GOOS=$os
$o="wrp-$(if ($os -eq "windows") {$os="windows.exe"} elseif ($os -eq "darwin") { $os="macos" })$os" $o="wrp-$cpu-$(if ($os -eq "windows") {$os="windows.exe"} elseif ($os -eq "darwin") { $os="macos" })$os"
Remove-Item -ErrorAction Ignore $o Remove-Item -ErrorAction Ignore $o
if (!$clean) { if (!$clean) {
Invoke-Expression "& go build -a -o $o wrp.go" $cmd = "& go build -a -o $o wrp.go"
Write-Host $cmd
Invoke-Expression $cmd
} }
} }
$env:GOARCH="arm"
$env:GOOS="linux"
$o="wrp-linux-rpi"
Remove-Item -ErrorAction Ignore $o
if (!$clean) {
Invoke-Expression "& go build -a -o $o wrp.go"
}