diff --git a/lib_acl/CMakeLists.txt b/lib_acl/CMakeLists.txt index 9ed767b99..9e7d10a42 100644 --- a/lib_acl/CMakeLists.txt +++ b/lib_acl/CMakeLists.txt @@ -26,6 +26,11 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Linux") elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") add_definitions("-O3") add_definitions("-Wno-invalid-source-encoding") + add_definitions("-fvisibility=hidden") + add_definitions("-fvisibility-inlines-hidden") + add_definitions("-fdata-sections -ffunction-sections") + add_definitions("-flto") + add_definitions("-Os") set(UNIX_OS true) elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") add_definitions("-O2") diff --git a/lib_acl/Makefile b/lib_acl/Makefile index 9b3e9427b..c700b6cdf 100644 --- a/lib_acl/Makefile +++ b/lib_acl/Makefile @@ -16,7 +16,6 @@ LIB_NAME = libacl.a #CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align CFLAGS = -c -g -W \ --O3 \ -fPIC \ -Wall \ -Werror \ @@ -101,7 +100,13 @@ endif # For Darwin ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin) CFLAGS += -Wno-invalid-source-encoding \ - -Wno-invalid-offsetof + -Wno-invalid-offsetof \ + -fvisibility=hidden \ + -fvisibility-inlines-hidden \ + -fdata-sections \ + -ffunction-sections \ + -flto \ + -Os UNIXTYPE = MACOSX RPATH = macos endif @@ -117,6 +122,7 @@ ifeq ($(findstring Linux, $(UNIXNAME)), Linux) # CFLAGS += -m64 RPATH = linux64 endif + CFLAGS += -O3 endif ifeq ($(findstring HAS_TRACE, $(FLAGS)), HAS_TRACE) diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt index 3114d80c6..593edba3a 100644 --- a/lib_acl_cpp/CMakeLists.txt +++ b/lib_acl_cpp/CMakeLists.txt @@ -26,6 +26,10 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") set(UNIX_OS true) elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") add_definitions("-Wno-invalid-source-encoding") + add_definitions("-fvisibility=hidden") + add_definitions("-fvisibility-inlines-hidden") + add_definitions("-fdata-sections -ffunction-sections") + add_definitions("-flto") add_definitions("-Os") set(UNIX_OS true) elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") diff --git a/lib_acl_cpp/Makefile b/lib_acl_cpp/Makefile index f3553a539..ed2187ad9 100644 --- a/lib_acl_cpp/Makefile +++ b/lib_acl_cpp/Makefile @@ -9,7 +9,6 @@ RANLIB = ${ENV_RANLIB} FLAGS = ${ENV_FLAGS} CFLAGS = -c -g -W \ --O3 \ -fPIC \ -Wall \ -Werror \ @@ -94,7 +93,13 @@ endif ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin) CFLAGS += -Wno-invalid-source-encoding \ -Wno-invalid-offsetof \ - -Wno-unused-private-field + -Wno-unused-private-field \ + -fvisibility=hidden \ + -fvisibility-inlines-hidden \ + -fdata-sections \ + -ffunction-sections \ + -flto \ + -Os CFLAGS += -Wshadow UNIXTYPE = MACOSX shared_ldflags = -lprotocol -lacl -L/usr/lib -liconv -lz -lpthread @@ -104,6 +109,7 @@ endif ifeq ($(findstring Linux, $(UNIXNAME)), Linux) UNIXTYPE = LINUX CFLAGS += -Wshadow + CFLAGS += -O3 shared_ldflags = -lprotocol -lacl -lrt -lpthread -lz -ldl endif diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt index 9b6df1d39..17a21546e 100644 --- a/lib_protocol/CMakeLists.txt +++ b/lib_protocol/CMakeLists.txt @@ -25,6 +25,10 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") set(UNIX_OS true) elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin") add_definitions("-Wno-invalid-source-encoding") + add_definitions("-fvisibility=hidden") + add_definitions("-fvisibility-inlines-hidden") + add_definitions("-fdata-sections -ffunction-sections") + add_definitions("-flto") add_definitions("-Os") set(UNIX_OS true) elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") diff --git a/lib_protocol/Makefile b/lib_protocol/Makefile index fc9891112..1306108e8 100644 --- a/lib_protocol/Makefile +++ b/lib_protocol/Makefile @@ -8,7 +8,6 @@ ARFL = rv RANLIB = ${ENV_RANLIB} CFLAGS = -c -g -W \ --O3 \ -fPIC \ -Wall \ -Werror \ @@ -71,13 +70,20 @@ endif # For Darwin ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin) CFLAGS += -Wno-invalid-source-encoding \ - -Wno-invalid-offsetof + -Wno-invalid-offsetof \ + -fvisibility=hidden \ + -fvisibility-inlines-hidden \ + -fdata-sections \ + -ffunction-sections \ + -flto \ + -Os UNIXTYPE = MACOSX endif # For Linux ifeq ($(findstring Linux, $(UNIXNAME)), Linux) UNIXTYPE = LINUX + CFLAGS += -O3 endif # For MINGW