Skip to content

Enforce GNU make 4+ at Makefile parse time#1

Merged
andrewferrier merged 3 commits into
mainfrom
copilot/add-check-for-gnu-make
Jun 10, 2026
Merged

Enforce GNU make 4+ at Makefile parse time#1
andrewferrier merged 3 commits into
mainfrom
copilot/add-check-for-gnu-make

Conversation

Copilot AI commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

The root Makefile previously only guarded for GNU make presence. This update tightens the preflight check to require GNU make major version 4 or newer and fail before target evaluation.

  • Preflight guard hardening

    • Kept the GNU-make detection via MAKE_VERSION origin.
    • Updated the missing-GNU-make error to explicitly call out undefined MAKE_VERSION.
  • Minimum version enforcement

    • Added parse-time extraction of MAKE_MAJOR from MAKE_VERSION.
    • Added an early failure path for major versions 0..3 using GNU make-native functions (no shell arithmetic dependency).
  • Failure messaging

    • Error messages now distinguish:
      • GNU make not detected (MAKE_VERSION undefined)
      • GNU make detected but version too old (shows detected version)
ifeq ($(origin MAKE_VERSION),undefined)
  $(error GNU make >= 4 is required. MAKE_VERSION is undefined, so GNU make may not be installed or in use. Run 'make --version' to verify.)
endif

MAKE_MAJOR := $(firstword $(subst ., ,$(MAKE_VERSION)))
ifneq ($(filter 0 1 2 3,$(MAKE_MAJOR)),)
  $(error GNU make >= 4 is required. Found version $(MAKE_VERSION). Run 'make --version' to check your current version.)
endif

@andrewferrier
andrewferrier marked this pull request as ready for review June 10, 2026 16:27
Copilot AI review requested due to automatic review settings June 10, 2026 16:27
@andrewferrier
andrewferrier merged commit 2717ca1 into main Jun 10, 2026
@andrewferrier
andrewferrier deleted the copilot/add-check-for-gnu-make branch June 10, 2026 16:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens the repository’s root Makefile preflight checks so that GNU make is not only detected, but also required to be major version 4+, and that failure occurs during Makefile parsing (before any targets are evaluated).

Changes:

  • Adds an early parse-time error when MAKE_VERSION is not defined (intended to indicate GNU make is not in use).
  • Extracts MAKE_MAJOR from MAKE_VERSION at parse time and errors out for major versions 0..3.
  • Updates error messaging to distinguish “GNU make not detected” vs “GNU make too old”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Makefile
Comment on lines +1 to +3
ifeq ($(origin MAKE_VERSION),undefined)
$(error GNU make >= 4 is required. MAKE_VERSION is undefined, so GNU make may not be installed or in use. Run 'make --version' to verify.)
endif
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.

3 participants