-
Notifications
You must be signed in to change notification settings - Fork 253
[bug] Makefile uses PWD for Zoekt output; breaks on Windows (should use CURDIR) #1095
Description
Describe the bug
The root Makefile’s zoekt target uses $(PWD) to determine the output path:
zoekt:
mkdir -p bin
go build -C vendor/zoekt -o $(PWD)/bin ./cmd/...
export PATH="$(PWD)/bin:$(PATH)"
export CTAGS_COMMANDS=ctags
$(PWD) is not a GNU Make built-in variable. It only works when the shell provides it (common in Unix environments), but is often unset on Windows.
On Windows with GNU Make, this causes the output path to collapse (e.g., -o /bin), which leads to go build failing even when Go and dependencies are correctly installed.
Expected behavior:
The binaries should be built into ./bin reliably across all platforms.
Actual behavior:
The build fails due to an invalid output path when PWD is not defined.
To reproduce
-
Clone the repository with submodules:
git clone --recurse-submodules -
Install:
- Go
- GNU Make (via Chocolatey, MSYS2, or similar)
-
Run:
make zoekt -
Observe:
go builduses an incorrect output path (e.g.,/bin)- Build fails
Sourcebot deployment information
Sourcebot version: latest (main branch)
Environment:
- OS: Windows 10
- GNU Make installed (via MSYS2 / Chocolatey)
- Go installed and working
Additional information
Suggested fix:
Replace $(PWD) with GNU Make’s built-in $(CURDIR):
go build -C vendor/zoekt -o $(CURDIR)/bin ./cmd/...
export PATH="$(CURDIR)/bin:$(PATH)"
CURDIR is always defined by GNU Make and works consistently across platforms.
This is a small change but improves cross-platform compatibility and developer experience, especially for Windows contributors.
Happy to open a PR if this approach looks good.