cJSON

mirror of Dave's cJSON
git clone git://git.thc420.xyz/cJSON
Log | Files | Refs | README | LICENSE

commit eb6dd6ef6b5594baf44687ff5835a2bc6bb9d8f6
parent 1217ca9e9f0134fe4666b3c81771af545c4c1b9d
Author: Max Bruckner <max@maxbruckner.de>
Date:   Wed,  3 May 2017 23:08:24 +0200

Merge pull request #164 from juvasquezg/master

Makefile: GCC version guard for -fstack-protector-strong
Diffstat:
MMakefile | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile @@ -21,7 +21,17 @@ INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH) INSTALL ?= cp -a -R_CFLAGS = -fPIC -std=c89 -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion -fstack-protector-strong $(CFLAGS) +# validate gcc version for use fstack-protector-strong +MIN_GCC_VERSION = "4.9" +GCC_VERSION := "`gcc -dumpversion`" +IS_GCC_ABOVE_MIN_VERSION := $(shell expr "$(GCC_VERSION)" ">=" "$(MIN_GCC_VERSION)") +ifeq "$(IS_GCC_ABOVE_MIN_VERSION)" "1" + CFLAGS += -fstack-protector-strong +else + CFLAGS += -fstack-protector +endif + +R_CFLAGS = -fPIC -std=c89 -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion $(CFLAGS) uname := $(shell sh -c 'uname -s 2>/dev/null || echo false')