[yocto] [PATCH v2 2/5] Makefile: add debug target

Jianxun Zhang jianxun.zhang at linux.intel.com
Fri Feb 10 10:58:47 PST 2017


> On Feb 9, 2017, at 11:17 AM, Todor Minchev <todor.minchev at linux.intel.com> wrote:
> 
> A debug version of the rmc binary can be built by using the debug
> Makefile target. This will include debug symbols and will disable
> compiler optimizations.
> 
> Example:
> 
> make debug
> 
> Signed-off-by: Todor Minchev <todor.minchev at linux.intel.com>
> ---
> Makefile | 2 ++
> 1 file changed, 2 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index c58047a..fdd936f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -23,6 +23,8 @@ ALL_OBJS := $(RMC_TOOL_OBJ) $(RMC_LIB_OBJ)
> RMC_CFLAGS := -Wall -I$(TOPDIR)/inc
> 
> all: rmc
> +debug: RMC_CFLAGS += -DDEBUG -g -O0
> +debug: rmc
> 
I missed your feedback of V1, just recap it here also with my comment:

- "Yup, the above will have the same effect as 'make debug'.
I thought that 'make debug' might be a convenient way to build a debug
binary? Do you think it makes sense to keep this extra target for
convenience since it doesn't affect the other usages of make?"

You could have to come back to CFLAGS when the a hard coded debug flags is not enough.

And, why pass -DDEBUG in RMC_CFLAGS when invoking gcc to compile rmc? I don’t see this macro DEBUG in the current rmc code.

Thanks
> $(ALL_OBJS): %.o: %.c
> 	$(CC) -c $(CFLAGS) $(RMC_CFLAGS) $< -o $@
> -- 
> 2.11.1
> 




More information about the yocto mailing list