Skip to content

Add --cflags-file so CFLAGS tokens are never re-lexed #21

Description

@MarkAtwood

Split out of #12.

--cflags takes a single string, so a token list that Make and CMake already hold gets flattened and then re-split. No splitter gets every case right:

input                              .split()            shlex
-DMSG="hello world"                BROKEN (2 tokens)   correct
-DPICO_SDK_PATH=C:\Users\ci\sdk    correct             BROKEN -> C:Userscisdk
-I\\server\share\inc               correct             BROKEN -> \servershareinc

shlex.split(posix=False) is not a middle ground: it only groups when a quote starts the token, so it behaves identically to .split() here.

Fix at the layer above: add --cflags-file, one token per line, written directly by the build fragment, mirroring the existing --srcs-file. No quoting, no lexing, no host-shell or host-OS dependence. Keep --cflags on .split() semantics for compatibility and deprecate it.

Downstream: wolfBoot#830's sbom.mk:174 splices CFLAGS into one double-quoted word and should use this once it exists.

Not urgent. The only spaced define in wolfBoot today is -D"__WOLFBOOT", an even quote count with no internal space.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions