User forums > General (but related to Code::Blocks)
How to pass parameter to makefile ?
(1/1)
comsytec:
I want use makefile for building of project but need to pass additional parameters. Of course I could change the makefile. This is the easiest way but pretty solution would be to set custom variable.
Makefile invocation
$make -f $makefile $target $USE_OPT
$USE_OPT is the custom variable
its value
USE_OPT="-gdwarf-2 -falign-function=16"
but when executed C::B adds some additional quotation which is not accepted by make tool
--- Code: ----------------- Build: all in chibios-f3d (compiler: STM32 GCC Compiler)---------------
Running command: make.exe -f Makefile all "USE_OPT="-gdwarf-2 -falign-function=16""
make: align-function=16: No such file or directory
make: *** No rule to make target `align-function=16'. Stop.
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)
--- End code ---
Second parameter is not recognized because of these quotes.
Some workaround to suppress these quotes ?
Jenna:
Which version of C::B do you use ?
I just tested it on windows (latest nightly) and it works as epxected.
When adding the custom variable, C::B asks me whether I want to quote it, because it contains strange characters, after clicking "Leave unquoted",the log shows the correct commandline (only the original quotes, that are parts of the variable).
comsytec:
release 12.11
Jenna:
I also tested it in 12.11 .
Here is a possible workaround:
It seems to work when I add double-doublequotes around the variable, so the build log with a dummy empty Makefile shows:
--- Code: ----------------- Build: Release in test (compiler: GNU GCC Compiler)---------------
Running command: mingw32-make.exe -f Makefile ""USE_OPTS="-gdwarf-2 -falign-function=16"""
mingw32-make.exe: *** No targets. Stop.
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)
--- End code ---
The variable is:
--- Code: ---""USE_OPTS="-gdwarf-2 -falign-function=16"""
--- End code ---
.
A little hacky, but it still works in actual nightly.
Navigation
[0] Message Index
Go to full version