News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

How to pass parameter to makefile ?

Started by comsytec, September 03, 2013, 11:40:23 AM

Previous topic - Next topic

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


-------------- 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)


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


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:

-------------- 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)


The variable is: ""USE_OPTS="-gdwarf-2 -falign-function=16""" .

A little hacky, but it still works in actual nightly.