LIBJSON_LICENSE = BSD-2c
LIBJSON_LICENSE_FILES = License.txt
-LIBJSON_MAKE_OPT = BUILD_TYPE= SHARED=$(if $(BR2_PREFER_STATIC_LIB),0,1) \
- CXXFLAGS="$(TARGET_CXXFLAGS) -DNDEBUG"
+LIBJSON_CXXFLAGS = $(TARGET_CFLAGS) -DNDEBUG
+
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+LIBJSON_MAKE_OPT += SHARED=0
+else
+LIBJSON_MAKE_OPT += SHARED=1
+LIBJSON_CXXFLAGS += -fPIC
+endif
+
+LIBJSON_MAKE_OPT += BUILD_TYPE= CXXFLAGS="$(LIBJSON_CXXFLAGS)"
define LIBJSON_EXTRACT_CMDS
unzip -d $(@D) $(DL_DIR)/$(LIBJSON_SOURCE)