diff --git a/Makefile b/Makefile index 3d58079..db4e8c1 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,12 @@ CONFIG_CXX_ALLOCATOR := true CONFIG_UBSAN := false CONFIG_SEAL_METADATA := false +define safe_flag +$(shell $(CC) -E $1 - /dev/null && echo $1) +endef + CPPFLAGS := -D_GNU_SOURCE -SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra -Wcast-align=strict -Wcast-qual -Wwrite-strings +SHARED_FLAGS := -O2 -flto -fPIC -fvisibility=hidden -fno-plt -pipe -Wall -Wextra $(call safe_flag,-Wcast-align=strict) -Wcast-qual -Wwrite-strings CFLAGS := -std=c11 $(SHARED_FLAGS) -Wmissing-prototypes CXXFLAGS := -std=c++14 $(SHARED_FLAGS) LDFLAGS := -Wl,-z,defs,-z,relro,-z,now,-z,nodlopen,-z,text