Skip to content
Open
Prev Previous commit
Next Next commit
Repaired tabs in makefile 🙄; added variable set in script.
  • Loading branch information
Scott Arbeit committed Apr 7, 2025
commit 5b5042832001ba8a03d17f03d43e5ae40196869d
32 changes: 16 additions & 16 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ all: bin/git-sizer.exe

# Main binary target - depend on all Go source files
bin/git-sizer.exe: $(GO_SRC_FILES)
$(PWSH) "if (-not (Test-Path bin)) { New-Item -ItemType Directory -Path bin | Out-Null }"
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -a -o .\bin\git-sizer.exe .
$(PWSH) "if (-not (Test-Path bin)) { New-Item -ItemType Directory -Path bin | Out-Null }"
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -a -o .\bin\git-sizer.exe .

# Test target - explicitly run the build first to ensure binary is up to date
test:
@$(MAKE) -f Makefile.win bin/git-sizer.exe
@$(MAKE) -f Makefile.win gotest
@$(MAKE) -f Makefile.win bin/git-sizer.exe
@$(MAKE) -f Makefile.win gotest

# Run go tests
gotest:
$(GO) test -timeout 60s $(GOFLAGS) -ldflags "$(LDFLAGS)" ./...
$(GO) test -timeout 60s $(GOFLAGS) -ldflags "$(LDFLAGS)" ./...

# Clean up builds
clean:
$(PWSH) "if (Test-Path bin) { Remove-Item -Recurse -Force bin }"
$(PWSH) "if (Test-Path bin) { Remove-Item -Recurse -Force bin }"

# Help target
help:
$(PWSH) "Write-Host 'Windows Makefile for git-sizer' -ForegroundColor Cyan"
$(PWSH) "Write-Host ''"
$(PWSH) "Write-Host 'Targets:' -ForegroundColor Green"
$(PWSH) "Write-Host ' all - Build git-sizer (default)'"
$(PWSH) "Write-Host ' test - Run tests'"
$(PWSH) "Write-Host ' clean - Clean build artifacts'"
$(PWSH) "Write-Host ''"
$(PWSH) "Write-Host 'Example usage:' -ForegroundColor Green"
$(PWSH) "Write-Host ' nmake -f Makefile.win'"
$(PWSH) "Write-Host ' nmake -f Makefile.win test'"
$(PWSH) "Write-Host 'Windows Makefile for git-sizer' -ForegroundColor Cyan"
$(PWSH) "Write-Host ''"
$(PWSH) "Write-Host 'Targets:' -ForegroundColor Green"
$(PWSH) "Write-Host ' all - Build git-sizer (default)'"
$(PWSH) "Write-Host ' test - Run tests'"
$(PWSH) "Write-Host ' clean - Clean build artifacts'"
$(PWSH) "Write-Host ''"
$(PWSH) "Write-Host 'Example usage:' -ForegroundColor Green"
$(PWSH) "Write-Host ' make -f Makefile.win'"
$(PWSH) "Write-Host ' make -f Makefile.win test'"
2 changes: 1 addition & 1 deletion script/ensure-go-installed.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This script is meant to be sourced with ROOTDIR set.

if (-not $env:ROOTDIR) {
Write-Error 'ensure-go-installed.ps1 invoked without ROOTDIR set!'
$env:ROOTDIR = (Resolve-Path (Join-Path $scriptDir "..")).Path
}

# Function to check if Go is installed and at least version 1.21
Expand Down