summaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-05-31 16:10:52 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-06-06 14:51:54 +0200
commit238ade12c1c7689d65ee9899eb00f895fcbd9a6f (patch)
treeeb201a40f9928a2685febc5ea2021a0530a13d78 /Makerules
parent45d59d1c520f78fae0db12615e755b67c1acd5ce (diff)
downloadmupdf-238ade12c1c7689d65ee9899eb00f895fcbd9a6f.tar.xz
Add build=small target, optimizing for size.
Compile with -Os, -ffunction-sections, -fdata-sections and link with --gc-sections and -s (strip) to include only the functions and data tables actually required.
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makerules b/Makerules
index c9ac8046..b68bfb90 100644
--- a/Makerules
+++ b/Makerules
@@ -7,13 +7,17 @@ OS := $(OS:Darwin=MACOS)
HAVE_LIBDL ?= yes
-CFLAGS += -Wall
+CFLAGS += -Wall -ffunction-sections -fdata-sections
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
+else ifeq "$(build)" "small"
+CFLAGS += -pipe -Os -DNDEBUG -fomit-frame-pointer
+LDFLAGS += -Wl,--gc-sections -Wl,-s
else ifeq "$(build)" "sanitize"
CFLAGS += -pipe -g -DDEBUG -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
@@ -25,6 +29,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
else ifeq "$(build)" "memento"
CFLAGS += -pipe -g -DMEMENTO -DDEBUG
LDFLAGS += -g -d -rdynamic