summaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
authorJoseph Heenan <joseph@emobix.co.uk>2016-06-08 10:06:32 +0100
committerJoseph Heenan <joseph@emobix.co.uk>2016-06-13 10:47:05 +0100
commit2777fb92d7f4a6617ba5d83868d8597b7bac3465 (patch)
tree2ad26a9c3c029bf55c2628ac2efadb767cca920e /Makerules
parenta3ab5aa8e840ba10f9c259a3e3f07d76f4562428 (diff)
downloadmupdf-2777fb92d7f4a6617ba5d83868d8597b7bac3465.tar.xz
Bug 696831: iOS/OS X support for size optimizations
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules20
1 files changed, 16 insertions, 4 deletions
diff --git a/Makerules b/Makerules
index b68bfb90..37f633e1 100644
--- a/Makerules
+++ b/Makerules
@@ -7,17 +7,29 @@ OS := $(OS:Darwin=MACOS)
HAVE_LIBDL ?= yes
-CFLAGS += -Wall -ffunction-sections -fdata-sections
+
+CFLAGS += -Wall
+
+ifeq (,$(findstring -fembed-bitcode,$(XCFLAGS)))
+# clang does not support these in combination with -fembed-bitcode
+CFLAGS += -ffunction-sections -fdata-sections
+endif
+
+ifeq "$(OS)" "MACOS"
+LDREMOVEUNREACH = -Wl,-dead_strip
+else
+LDREMOVEUNREACH = -Wl,--gc-sections
+endif
ifeq "$(build)" "debug"
CFLAGS += -pipe -g -DDEBUG
LDFLAGS += -g
else ifeq "$(build)" "release"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
-LDFLAGS += -Wl,--gc-sections -Wl,-s
+LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
else ifeq "$(build)" "small"
CFLAGS += -pipe -Os -DNDEBUG -fomit-frame-pointer
-LDFLAGS += -Wl,--gc-sections -Wl,-s
+LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
else ifeq "$(build)" "sanitize"
CFLAGS += -pipe -g -DDEBUG -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
@@ -29,7 +41,7 @@ CFLAGS += -pipe -g -DDEBUG -pg -fprofile-arcs -ftest-coverage
LIBS += -lgcov
else ifeq "$(build)" "native"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer -march=native -mfpmath=sse
-LDFLAGS += -Wl,--gc-sections -Wl,-s
+LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
else ifeq "$(build)" "memento"
CFLAGS += -pipe -g -DMEMENTO -DDEBUG
LDFLAGS += -g -d -rdynamic