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 build uses 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.
Describe the bug
The root Makefile’s
zoekttarget 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 togo buildfailing even when Go and dependencies are correctly installed.Expected behavior:
The binaries should be built into
./binreliably across all platforms.Actual behavior:
The build fails due to an invalid output path when
PWDis not defined.To reproduce
Clone the repository with submodules:
git clone --recurse-submodules
Install:
Run:
make zoekt
Observe:
go builduses an incorrect output path (e.g.,/bin)Sourcebot deployment information
Sourcebot version: latest (main branch)
Environment:
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)"
CURDIRis 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.