tags:

views:

38

answers:

1

In a Makefile of a library I am trying to build, there are a few lines specify the options to gcc:

CFLAGS          += -I$(CURDIR) -pedantic -std=c89 -O3  
CFLAGS          += -Wall -Wno-unused-function -Wno-long-long  
CFLAGS          += $(if $(DEBUG), -O0 -g)

If DEBUG exists, there will be both -O3 and -O0 -g in CFLAGS. But -O0 and -O3 cannot be used at the same time. Will the one specified later supersede the one earlier?

Thanks and regards!

+6  A: 

From the manpage:

If you use multiple -O options, with or without level numbers, the last such option is the one that is effective.

dmckee