Skip to content

[bug] Makefile uses PWD for Zoekt output; breaks on Windows (should use CURDIR) #1095

@h30s

Description

@h30s

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

  1. Clone the repository with submodules:
    git clone --recurse-submodules

  2. Install:

    • Go
    • GNU Make (via Chocolatey, MSYS2, or similar)
  3. Run:
    make zoekt

  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions