Skip to content

Make dist-pdf target in Doc/Makefile macOS compatible#28

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/make-dist-pdf-macos-compatible
Draft

Make dist-pdf target in Doc/Makefile macOS compatible#28
Copilot wants to merge 2 commits intomasterfrom
copilot/make-dist-pdf-macos-compatible

Conversation

Copy link
Copy Markdown

Copilot AI commented Oct 9, 2025

Problem

The dist target in Doc/Makefile uses sed -i to modify the generated build/latex/Makefile file. However, sed -i has different syntax requirements across platforms:

  • GNU sed (Linux): sed -i 's/pattern/replacement/' file works without an extension argument
  • BSD sed (macOS): sed -i requires an extension argument, e.g., sed -i '' 's/pattern/replacement/' file

This caused the dist target (which generates PDF documentation) to fail on macOS with an error like:

sed: 1: "build/latex/Makefile": invalid command code b

Solution

Replace the non-portable sed -i command with a portable alternative that works across all Unix-like systems:

# Before (not portable)
-sed -i 's/makeindex/makeindex -q/' build/latex/Makefile

# After (portable)
-sed 's/makeindex/makeindex -q/' build/latex/Makefile > build/latex/Makefile.tmp && mv build/latex/Makefile.tmp build/latex/Makefile

This approach:

  1. Uses standard sed output redirection to write to a temporary file
  2. Moves the temporary file back to replace the original
  3. Works identically on Linux, macOS, and all BSD variants
  4. Maintains the - prefix to keep the command non-fatal

Changes

  • Updated line 188: A4 PDF generation section
  • Updated line 196: Letter-size PDF generation section

The fix ensures that building documentation archives with make dist works correctly on both Linux and macOS systems.

Original prompt

Make dist-pdf in Doc/Makefile MacOS l-compatible


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: m-aciek <9288014+m-aciek@users.noreply.github.com>
Copilot AI changed the title [WIP] Make dist-pdf in Doc/Makefile compatible with MacOS Make dist-pdf target in Doc/Makefile macOS compatible Oct 9, 2025
Copilot AI requested a review from m-aciek October 9, 2025 06:52
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.

2 participants