Skip to content

Makefiles: allow the user to add to CFLAGS and Co. #355

@GitMensch

Description

@GitMensch

Um. I don't know if there's a "standard" method for doing this? I'd think there would be, but can't say I've ever encountered it...

I just tried adding the line

CFLAGS += $(ADDED_CFLAGS)

and running make (usual flags) ADDED_CFLAGS=-DGARBAGE, and GARBAGE was suitably defined. Such a technique could be used for all makefiles, I think. It works, but I'd like to verify that we're not re-inventing a wheel here before committing changes.

(As a side issue, it'd still be nice to make the "correct" distinction between CPPFLAGS, used for the C preprocessor, and "regular" CFLAGS, in a variety of our Makefiles. Not a big deal, but it was mentioned recently, and it's hard for me to un-see it now.)

Originally posted by @Bill-Gray in #345

The documentation for autotools effectively says:
CFLAGS, LIBS, LDFLAGS, CPPFLAGS, ... all "belong to the user":

  • one should not override them
  • all "project owned" vars have a prefix (like PDC_)
  • the "normal" ones are used in the makefiles (either side-by side with the "project owned" ones or by or adding them to those)

I think that's a good rule.

Originally posted by @GitMensch in #345

Not sure, but that may be an easy change to do before the next release, whatever it may be...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions