kapike
kapike

Reputation: 321

why not use command 'CFLAGS += -fno-stack-protector' directly?

CFLAGS  := -fno-builtin -Wall -g -m32 -mno-sse -nostdinc $(DEFS)
CFLAGS  += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)

In the second line,i confuse why not use command CFLAGS += -fno-stack-protector directly?

Upvotes: 1

Views: 199

Answers (1)

Some programmer dude
Some programmer dude

Reputation: 409422

It's a way to do a build-time check that the C compiler supports the -fno-stack-protector flag.

If the compiler doesn't support the flag then $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 will fail and nothing will be added to CFLAGS.

These kinds of checks are usually done by a build configuration script.

Upvotes: 2

Related Questions