pico_headers
pico_headers copied to clipboard
Tests: compiler cannot be overwritten
Description
The Makefiles present in each test folders do not allow the user to use a different compiler.
Steps to reproduce
Linux:
CC=$(which clang) make
macOS (gcc installed through homebrew):
CC=$(which gcc-11) make
Possible Solution
After testing around in Docker containers, I have noticed that simply removing the definition of CC
inside the Makefiles works, because:
- If any compiler is installed, a
cc
binary will be added to your path which is a copy of the compiler.make
will automatically use it. For example, on Ubuntu, if the user installsclang
but notgcc
they'd be able to compile it the tests. - If the user defines
CC
themselves such as:CC=/path/to/cross/compiler make
, make will use the cross compiler instead of the default.
Additionally, defining the CFLAGS
with ?=
instead of =
allows the user to overwrite the default CFLAGS
with their own. In case their compiler does not support one of the options.
Why
Although this may seem like nitpicking, this change would allow a user to cross-compile the tests without editing the Makefile and letting them ensure the headers behave as expected.
Thanks, I'll look into this when I have time. I'm pretty focused on other things right now