Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Repaired tabs in makefile 🙄; added variable set in script.
  • Loading branch information
Scott Arbeit committed Apr 7, 2025
commit 9adbee649840eb3f9f6dfaebda26e1f7a7335892
27 changes: 15 additions & 12 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ endif
# Find all Go source files
GO_SRC_FILES := $(shell powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-ChildItem -Path . -Filter *.go -Recurse | Select-Object -ExpandProperty FullName")

# Define common PowerShell command
PWSH := @powershell -NoProfile -ExecutionPolicy Bypass -Command

# Default target
all: bin/git-sizer.exe

# Main binary target - depend on all Go source files
bin/git-sizer.exe: $(GO_SRC_FILES)
@powershell -NoProfile -ExecutionPolicy Bypass -Command "if (-not (Test-Path bin)) { New-Item -ItemType Directory -Path bin | Out-Null }"
$(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
Expand All @@ -38,17 +41,17 @@ gotest:

# Clean up builds
clean:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "if (Test-Path bin) { Remove-Item -Recurse -Force bin }"
$(PWSH) "if (Test-Path bin) { Remove-Item -Recurse -Force bin }"

# Help target
help:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Windows Makefile for git-sizer' -ForegroundColor Cyan"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ''"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Targets:' -ForegroundColor Green"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' all - Build git-sizer (default)'"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' test - Run tests'"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' clean - Clean build artifacts'"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ''"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Example usage:' -ForegroundColor Green"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' nmake -f Makefile.win'"
@powershell -NoProfile -ExecutionPolicy Bypass -Command "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