Skip to content

make: Predefining CFLAGS are parsed weirdly #5776

@miri64

Description

@miri64

When I define some CFLAGS in my application's Makefile before I include the Makefile.include, they get scrambled up somehow. At least in this instance:

$ make clean all
make: Nothing to be done for 'clean'.
Building application "lwip_time_rx" for "iotlab-m3" with MCU "stm32f1".

"make" -C /home/mlenders/Repositories/RIOT-OS/RIOT/pkg/lwip
git -C /home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/pkg/iotlab-m3/lwip checkout -f fd4a109ffa6513b28a0c780a952cef1110423717
Warning: you are leaving 2 commits behind, not connected to
any of your branches:

  133c6c3 Add RIOT Makefiles
  e0ad5e0 Fix warnings

If you want to keep them by creating a new branch, this may be a good time
to do so with:

 git branch <new-branch-name> 133c6c3

HEAD is now at fd4a109... lowpan6.c: Implement SNMP counters
git -C /home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/pkg/iotlab-m3/lwip am --ignore-whitespace "/home/mlenders/Repositories/RIOT-OS/RIOT/pkg/lwip"/patches/*.patch
Applying: Fix warnings
Applying: Add RIOT Makefiles
touch /home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/pkg/iotlab-m3/lwip/.git-patched
make -C /home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/pkg/iotlab-m3/lwip
"make" -C /home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/pkg/iotlab-m3/lwip/src/api
/bin/sh: 4: Syntax error: ")" unexpected
/home/mlenders/Repositories/RIOT-OS/RIOT/Makefile.base:60: recipe for target '/home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/iotlab-m3/lwip_api/pppapi.o' failed
make[3]: *** [/home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/iotlab-m3/lwip_api/pppapi.o] Error 2
/home/mlenders/Repositories/RIOT-OS/RIOT/Makefile.base:20: recipe for target 'ALL--/home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/pkg/iotlab-m3/lwip/src/api' failed
make[2]: *** [ALL--/home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/pkg/iotlab-m3/lwip/src/api] Error 2
Makefile:9: recipe for target 'all' failed
make[1]: *** [all] Error 2
/home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/../../../../RIOT/Makefile.include:301: recipe for target '/home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/iotlab-m3/lwip.a' failed
make: *** [/home/mlenders/Repositories/RIOT-OS/RIOT_playground/stack_comparison/time_rx/lwip/bin/iotlab-m3/lwip.a] Error 2

Bisecting it I saw that before #5097 this problem did not exist, but with its introduction I get the message above (baring other changes to RIOT that miri64/RIOT_playground@45b988a provides a fix for). I think the fact that this particular one is a string containing parenthesis is the problem.

A workaround is to put the CFLAGS after the Makefile.include (or adding more escapes which I find equally counter-intuitive), but I don't know, what this could mean for CFLAGS defined as environment variables (I haven't tested it either).

Metadata

Metadata

Assignees

Labels

Area: build systemArea: Build systemType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions