0

/redis/deps/hiredis/Makefile

    CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) ||      echo gcc')
    OPTIMIZATION?=-O3
    WARNINGS=-Wall -W -Wstrict-prototypes -Wwrite-strings
    DEBUG?= -g -ggdb

what do the complier options mean? and '?'followed by '=-03'?

Cœur
  • 37,241
  • 25
  • 195
  • 267

2 Answers2

2

for OPTIMIZATION?=-O3

  1. If the variable OPTIMIZATION has NOT been defined, OPTIMIZATION is valued as -O3;

  2. On the other side, if the variable OPTIMIZATION has been defined, this statement will be skipped, and OPTIMIZATION will keep its previous value

kaitian521
  • 548
  • 2
  • 10
  • 25
0

The GNU make manual has this text for the ?= operator

There is another assignment operator for variables, ‘?=’. This is called a conditional variable assignment operator, because it only has an effect if the variable is not yet defined.

So, this statement

OPTIMIZATION?=-O3

says that if OPTIMIZATION has been defined, ignore it and if not, define it and assign a value -03.

The -03 as compiler flags means compile at optimization level 3.

dlmeetei
  • 9,905
  • 3
  • 31
  • 38