Skip to content

fix(c): #696 - let user-set CC/AR/LD survive the build - #698

Merged
mpkorstanje merged 1 commit into
cucumber:mainfrom
PYesare:fix/makefile-respect-user-cc-ar
Aug 31, 2026
Merged

fix(c): #696 - let user-set CC/AR/LD survive the build#698
mpkorstanje merged 1 commit into
cucumber:mainfrom
PYesare:fix/makefile-respect-user-cc-ar

Conversation

@PYesare

@PYesare PYesare commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🤔 What's changed?

The c/src/Makefile unconditionally reassigned CC, LD and AR inside an ifeq/else chain. Anything that wasn't literally clang or i686-w64-mingw32-gcc fell into the else branch, which force-set CC=gcc, LD=gcc, AR=ar using plain = assignment. Plain = assignments silently override environment-set variables (only command-line-set ones are protected in GNU Make), so setting CC via the environment e.g. CC=musl-gcc make — was discarded and replaced with gcc without any warning.

This PR:

  • Switches CC and AR to ?= so they're only set if the user hasn't already provided a value, otherwise falling back to make's own sensible built-in defaults (cc, ar) for the current platform.
  • Renames the ad-hoc flag variables to the standard GNU Make names: CC_FLAGSCFLAGS, AR_FLAGSARFLAGS, LD_FLAGSLDFLAGS, LD_LIBSLDLIBS, and adds SOFLAGS for the shared-library flag.
  • Drops the redundant clang branch, since its flags were identical to the default.
  • Keeps the i686-w64-mingw32-gcc special-case, since mingw genuinely needs different flags (no -fPIC), a dedicated archiver, and an .exe extension.

⚡️ What's your motivation?

Fixes #696. The Makefile forced users into gcc/clang/mingw and silently discarded any other compiler set via the environment, even though make's own default CC/AR values are usually already correct for the current OS.

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

I dropped the clang branch entirely since its flags matched the default, want to confirm there wasn't a reason (beyond flags) it was kept separate from the default case. Also open to feedback on whether SOFLAGS is the right name, since it's not one of GNU Make's implicit variable names like CFLAGS/ARFLAGS/LDFLAGS.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
  • Users should know about my change
  • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@mpkorstanje

Copy link
Copy Markdown
Member

@rfon6ngy looks good to you?

@rfon6ngy

Copy link
Copy Markdown

@mpkorstanje yes, I confirm make cli CC=x86_64-linux-musl-gcc LDFLAGS=-static working perfectly now

thanks

@mpkorstanje
mpkorstanje merged commit e9e59fe into cucumber:main Aug 31, 2026
4 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.

[c] : Makefile is too restrictive

3 participants