-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (55 loc) · 2.29 KB
/
Copy pathMakefile
File metadata and controls
64 lines (55 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Makefile for librenderbench.so
#
# Prerequisites:
#
# MuPDF development files:
# Fedora: sudo dnf install mupdf-devel
# Ubuntu/Debian: sudo apt install libmupdf-dev
# macOS: brew install mupdf
#
# PDFium shared library + headers:
# Pre-built binaries: https://github.com/nicehash/pdfium-binaries/releases
# - Download for your platform
# - Extract somewhere (e.g. /opt/pdfium)
# - Set PDFIUM_DIR below or pass it: make PDFIUM_DIR=/opt/pdfium
#
# Usage:
# make # build with defaults
# make PDFIUM_DIR=/opt/pdfium # specify PDFium location
# make clean
CC := gcc
CFLAGS := -fPIC -O3 -Wall
LDFLAGS := -shared -Wl,--no-undefined
TARGET := librenderbench.so
# ── PDFium ──────────────────────────────────────────────────────────────
PDFIUM_DIR ?= /usr/local
PDFIUM_CFLAGS := -I$(PDFIUM_DIR)/include
PDFIUM_LIBS := -L$(PDFIUM_DIR)/lib -lpdfium
# ── MuPDF ───────────────────────────────────────────────────────────────
# Fedora's mupdf-devel bundles third-party code (jbig2dec, gumbo, etc.)
# directly into libmupdf.a — there is no separate libmupdf-third.a.
#
# Override MUPDF_LIBS if your distro differs, e.g.:
# make MUPDF_LIBS="-lmupdf -lmupdf-third -lfreetype -lharfbuzz -ljpeg -lz -lm -lpthread"
MUPDF_CFLAGS := $(shell pkg-config --cflags mupdf 2>/dev/null || echo "")
MUPDF_LIBS ?= \
-lmupdf \
-lfreetype \
-lharfbuzz \
-ljpeg \
-lopenjp2 \
-lz \
-lm \
-lpthread
# ── Build ───────────────────────────────────────────────────────────────
$(TARGET): render_bench.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< \
$(PDFIUM_CFLAGS) $(MUPDF_CFLAGS) \
$(PDFIUM_LIBS) $(MUPDF_LIBS)
@echo ""
@echo "Built $(TARGET) successfully."
@echo "Make sure the PDFium shared library is on your LD_LIBRARY_PATH:"
@echo " export LD_LIBRARY_PATH=$(PDFIUM_DIR)/lib:$$LD_LIBRARY_PATH"
clean:
rm -f $(TARGET)
.PHONY: clean