Skip to content

fix: use CURDIR for Zoekt build output in Makefile#1096

Merged
brendan-kellam merged 1 commit intosourcebot-dev:mainfrom
h30s:fix/makefile-zoekt-curdir-windows
Apr 7, 2026
Merged

fix: use CURDIR for Zoekt build output in Makefile#1096
brendan-kellam merged 1 commit intosourcebot-dev:mainfrom
h30s:fix/makefile-zoekt-curdir-windows

Conversation

@h30s
Copy link
Copy Markdown
Contributor

@h30s h30s commented Apr 6, 2026

fixed cross-platform build issue

replaced PWD with CURDIR in Makefile so Zoekt builds correctly on Windows too. fixes #1095

Summary by CodeRabbit

  • Chores
    • Updated build system configuration for improved working directory path handling during the compilation process.

The shell variable PWD is not set by GNU Make and is often empty on Windows, which broke go build -o paths. Use Make built-in CURDIR instead.

Fixes sourcebot-dev#1095
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

Walkthrough

The Makefile's zoekt target is updated to replace $(PWD) with $(CURDIR) in the output binary path and PATH environment variable. This change improves cross-platform compatibility, particularly for Windows environments where PWD is unreliable.

Changes

Cohort / File(s) Summary
Makefile zoekt target
Makefile
Replaced $(PWD) with $(CURDIR) in the go build -o output path and export PATH statement. CURDIR is a GNU Make built-in variable available consistently across all platforms, addressing Windows compatibility issues.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: replacing PWD with CURDIR in the Zoekt build output within the Makefile.
Linked Issues check ✅ Passed The PR successfully addresses issue #1095 by replacing $(PWD) with $(CURDIR) in both the go build output path and PATH export, exactly as specified in the linked issue requirements.
Out of Scope Changes check ✅ Passed The changes are limited to the Makefile's zoekt target and directly address the cross-platform build issue described in issue #1095, with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Makefile (1)

13-14: Pre-existing issue: Export statements have no effect.

The export statements on lines 13-14 run in separate shells (each recipe line spawns a new shell by default), so they don't affect subsequent commands or Make targets. If the intent is to make Zoekt binaries available on PATH for other targets or to set CTAGS_COMMANDS for Zoekt's use, consider one of these approaches:

  1. If variables are only needed within this target: combine commands on one line:

    zoekt:
    	mkdir -p bin
    	go build -C vendor/zoekt -o $(CURDIR)/bin ./cmd/...
    	export PATH="$(CURDIR)/bin:$$PATH" CTAGS_COMMANDS=ctags && some_command_using_them
  2. If variables should persist for all targets: use Make's export directive:

    export PATH := $(CURDIR)/bin:$(PATH)
    export CTAGS_COMMANDS := ctags
    
    zoekt:
    	mkdir -p bin
    	go build -C vendor/zoekt -o $(CURDIR)/bin ./cmd/...
  3. If all recipe lines should share one shell: add .ONESHELL: to the Makefile.

Based on learnings, Zoekt binaries in ./bin/ must be available before yarn dev, so option 2 (Make-level export) may be the most appropriate.

Do you want me to open a new issue to track fixing the ineffective export statements?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Makefile` around lines 13 - 14, The Makefile currently uses shell export
lines that don't persist between recipe lines, so PATH and CTAGS_COMMANDS
changes have no effect; update the Makefile to export these at Makefile scope
(e.g., use Make's export for PATH and CTAGS_COMMANDS) or add .ONESHELL: so
recipe lines share a shell, and ensure the zoekt target (the rule that builds
vendor/zoekt into ./bin) runs before yarn dev so ./bin is on PATH for subsequent
targets; refer to the PATH and CTAGS_COMMANDS variables, the zoekt target, and
.ONESHELL as the points to change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@Makefile`:
- Around line 13-14: The Makefile currently uses shell export lines that don't
persist between recipe lines, so PATH and CTAGS_COMMANDS changes have no effect;
update the Makefile to export these at Makefile scope (e.g., use Make's export
for PATH and CTAGS_COMMANDS) or add .ONESHELL: so recipe lines share a shell,
and ensure the zoekt target (the rule that builds vendor/zoekt into ./bin) runs
before yarn dev so ./bin is on PATH for subsequent targets; refer to the PATH
and CTAGS_COMMANDS variables, the zoekt target, and .ONESHELL as the points to
change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dd12c859-bd48-4bf3-b87d-794d62de9dd8

📥 Commits

Reviewing files that changed from the base of the PR and between 355509b and 93e21a7.

📒 Files selected for processing (1)
  • Makefile

@h30s
Copy link
Copy Markdown
Contributor Author

h30s commented Apr 6, 2026

@brendan-kellam PTAL

Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks!

@brendan-kellam brendan-kellam merged commit 937d04b into sourcebot-dev:main Apr 7, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants