Skip to content

Commit f6a16d7

Browse files
author
Scott Arbeit
committed
Simplified Makefile.win
1 parent 5d3b4ab commit f6a16d7

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

Makefile.win

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,39 @@ endif
1919
# Find all Go source files
2020
GO_SRC_FILES := $(shell powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-ChildItem -Path . -Filter *.go -Recurse | Select-Object -ExpandProperty FullName")
2121

22+
# Define common PowerShell command
23+
PWSH := @powershell -NoProfile -ExecutionPolicy Bypass -Command
24+
2225
# Default target
2326
all: bin/git-sizer.exe
2427

2528
# Main binary target - depend on all Go source files
2629
bin/git-sizer.exe: $(GO_SRC_FILES)
27-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "if (-not (Test-Path bin)) { New-Item -ItemType Directory -Path bin | Out-Null }"
28-
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -a -o .\bin\git-sizer.exe .
30+
$(PWSH) "if (-not (Test-Path bin)) { New-Item -ItemType Directory -Path bin | Out-Null }"
31+
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -a -o .\bin\git-sizer.exe .
2932

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

3538
# Run go tests
3639
gotest:
37-
$(GO) test -timeout 60s $(GOFLAGS) -ldflags "$(LDFLAGS)" ./...
40+
$(GO) test -timeout 60s $(GOFLAGS) -ldflags "$(LDFLAGS)" ./...
3841

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

4346
# Help target
4447
help:
45-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Windows Makefile for git-sizer' -ForegroundColor Cyan"
46-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ''"
47-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Targets:' -ForegroundColor Green"
48-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' all - Build git-sizer (default)'"
49-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' test - Run tests'"
50-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' clean - Clean build artifacts'"
51-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ''"
52-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Example usage:' -ForegroundColor Green"
53-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' nmake -f Makefile.win'"
54-
@powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' nmake -f Makefile.win test'"
48+
$(PWSH) "Write-Host 'Windows Makefile for git-sizer' -ForegroundColor Cyan"
49+
$(PWSH) "Write-Host ''"
50+
$(PWSH) "Write-Host 'Targets:' -ForegroundColor Green"
51+
$(PWSH) "Write-Host ' all - Build git-sizer (default)'"
52+
$(PWSH) "Write-Host ' test - Run tests'"
53+
$(PWSH) "Write-Host ' clean - Clean build artifacts'"
54+
$(PWSH) "Write-Host ''"
55+
$(PWSH) "Write-Host 'Example usage:' -ForegroundColor Green"
56+
$(PWSH) "Write-Host ' nmake -f Makefile.win'"
57+
$(PWSH) "Write-Host ' nmake -f Makefile.win test'"

0 commit comments

Comments
 (0)