From: Markus Mayer Date: Wed, 27 Sep 2017 23:02:35 +0000 (-0700) Subject: tools/thermal: tmon: use "-fstack-protector" only if supported X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ec04aa3ae87b895dbc674a7e0b78b670f73a2c22;p=openwrt%2Fstaging%2Fblogic.git tools/thermal: tmon: use "-fstack-protector" only if supported Most, but not all, toolchains support the "-fstack-protector" flag. We check if the compiler supports the flag before using it. This allows tmon to be compiled for more environments. Signed-off-by: Markus Mayer Signed-off-by: Zhang Rui --- diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index 3a961e998281..5777bc78173f 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile @@ -1,8 +1,13 @@ +# We need this for the "cc-option" macro. +include ../../../scripts/Kbuild.include + VERSION = 1.0 BINDIR=usr/bin WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -CFLAGS+= -O1 ${WARNFLAGS} -fstack-protector +CFLAGS+= -O1 ${WARNFLAGS} +# Add "-fstack-protector" only if toolchain supports it. +CFLAGS+= $(call cc-option,-fstack-protector) CC=$(CROSS_COMPILE)gcc CFLAGS+=-D VERSION=\"$(VERSION)\"