[En-Nut-Discussion] Selective Optimization Possible?

Henrik Maier hmnews at proconx.com
Wed Nov 6 00:15:38 CET 2013


On 6/11/2013 9:02 AM, Bob Wirka wrote:
> Any way I could selectively change the optimization level for a particular file? Make one -O0 and the rest -Os?

Yes you can add selective macros definitions to a GNU makefile by 
prefixing the definition with the target name. For example:

avr/dev/ostimer.o: CPFLAGS = $(MCFLAGS) -O0 $(DEFS)

would apply different CPFLAGS settings only when compiling ostimer.o.

Regards,

Henrik




More information about the En-Nut-Discussion mailing list