2 Star 6 Fork 0

bruisebd/mupdf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makerules 8.05 KB
一键复制 编辑 原始数据 按行查看 历史
# Configuration for the Makefile
OS ?= $(shell uname)
OS := $(OS:MINGW%=MINGW)
OS := $(OS:Windows_NT=MINGW)
OS := $(OS:Darwin=MACOS)
ifeq "$(HAVE_OPENSSL)" "yes"
HAVE_LIBCRYPTO := yes
HAVE_OPENSSL_SSL := yes
LIBCRYPTO_CFLAGS = -DHAVE_LIBCRYPTO
sub := $(OS:MINGW=mingw)
sub := $(OS:Windows_NT=windows)
sub := $(OS:MACOS=macos)
sub := $(OS:IOS=ios)
sub := $(OS:LINUX=linux)
openssl_dir := ./thirdparty/openssl/$(sub)
openssl_libs := -L$(openssl_dir) -lcrypto -lssl
LIBCRYPTO_LIBS := $(openssl_libs)
SSL_LIBS := $(openssl_libs)
endif
HAVE_LIBDL ?= yes
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 += $(LDREMOVEUNREACH) -Wl,-s
else ifeq "$(build)" "small"
CFLAGS += -pipe -Os -DNDEBUG -fomit-frame-pointer
LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
else ifeq "$(build)" "sanitize"
CFLAGS += -pipe -g -DDEBUG -fsanitize=address -fno-omit-frame-pointer
LDFLAGS += -fsanitize=address
else ifeq "$(build)" "profile"
CFLAGS += -pipe -O2 -DNDEBUG -pg
LDFLAGS += -pg
else ifeq "$(build)" "coverage"
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 += $(LDREMOVEUNREACH) -Wl,-s
else ifeq "$(build)" "memento"
CFLAGS += -pipe -g -DMEMENTO -DDEBUG
LDFLAGS += -g -d -rdynamic
ifeq "$(HAVE_LIBDL)" "yes"
CFLAGS += -DHAVE_LIBDL
LIBS += -ldl
endif
else ifeq "$(build)" "gperf"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer -DGPERF
LIBS += -lprofiler
else
$(error unknown build setting: '$(build)')
endif
ifeq "$(largefile)" "yes"
CFLAGS += -DFZ_LARGEFILE
endif
# Windows (MINGW) build doesn't use system libraries.
ifeq "$(OS)" "MINGW"
WINDRES = windres
HAVE_X11 ?= no
HAVE_WIN32 = yes
CC=gcc
# Add flags required for Harfbuzz because of missing strdup
CFLAGS+= -U__STRICT_ANSI__
# Mac OS X doesn't have pkg-config so we hard code paths.
else ifeq "$(OS)" "MACOS"
HAVE_X11 ?= yes
HAVE_PTHREADS ?= yes
# Mac OS X deprecated libcrypto, so the default is to not include it.
HAVE_LIBCRYPTO ?= no
SYS_LIBCRYPTO_CFLAGS =
SYS_LIBCRYPTO_LIBS =
SYS_CURL_DEPS = -lpthread
SYS_X11_CFLAGS = -I/usr/X11R6/include
SYS_X11_LIBS = -L/usr/X11R6/lib -lX11 -lXext
SYS_FREETYPE_CFLAGS = $(shell freetype-config --cflags)
SYS_FREETYPE_LIBS = $(shell freetype-config --libs)
SYS_OPENJPEG_LIBS = -lopenjpeg
SYS_JBIG2DEC_LIBS = -ljbig2dec
SYS_JPEG_LIBS = -ljpeg
SYS_ZLIB_LIBS = -lz
CC = xcrun cc
AR = xcrun ar
LD = xcrun ld
RANLIB_CMD = xcrun ranlib $@
# Linux uses pkg-config for system libraries.
else ifeq "$(OS)" "Linux"
HAVE_PTHREADS ?= yes
ifeq "$(shell pkg-config --exists libcrypto && echo yes)" "yes"
HAVE_LIBCRYPTO ?= yes
SYS_LIBCRYPTO_CFLAGS = -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto)
SYS_LIBCRYPTO_LIBS = $(shell pkg-config --libs libcrypto)
endif
ifeq "$(shell pkg-config --exists libcurl && echo yes)" "yes"
HAVE_CURL = yes
SYS_CURL_CFLAGS = $(shell pkg-config --cflags libcurl)
SYS_CURL_LIBS = $(shell pkg-config --libs libcurl)
ifeq "$(shell pkg-config --exists openssl && echo yes)" "yes"
HAVE_OPENSSL_SSL = yes
SYS_CURL_CFLAGS += $(shell pkg-config --cflags openssl)
SYS_CURL_DEPS += $(shell pkg-config --libs openssl)
endif
endif
SYS_CURL_DEPS += -lpthread -lrt
ifeq "$(shell pkg-config --exists x11 xext && echo yes)" "yes"
HAVE_X11 = yes
SYS_X11_CFLAGS = $(shell pkg-config --cflags x11 xext)
SYS_X11_LIBS = $(shell pkg-config --libs x11 xext)
endif
ifeq "$(shell pkg-config --exists harfbuzz && echo yes)" "yes"
SYS_HARFBUZZ_CFLAGS = $(shell pkg-config --cflags harfbuzz)
SYS_HARFBUZZ_LIBS = $(shell pkg-config --libs harfbuzz)
endif
ifeq "$(shell pkg-config --exists freetype2 && echo yes)" "yes"
SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2)
SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2)
endif
ifeq "$(shell pkg-config --exists libopenjp2 && echo yes)" "yes"
SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2)
SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjp2)
endif
SYS_JBIG2DEC_LIBS = -ljbig2dec
SYS_JPEG_LIBS = -ljpeg
SYS_ZLIB_LIBS = -lz
endif
# The following section is an example of how to simply do cross-compilation
# using these Makefiles. It builds for a beagleboard running ARM linux,
# compiling on windows with the CodeSourcery G++ compilers.
# Invoke this as:
# make OS=beagle-cross build=release
# This does rely on the generated directory being populated with the cmap
# files etc first. Either:
# 1) do 'make generate' first (this relies on you having an appropriate host
# base C compiler set up - such as you would have on unix or in windows
# cygwin)
# 2) do a non cross compile build (e.g. windows in MSVC) first.
# 3) download the generated files from mupdf.com.
ifeq "$(OS)" "beagle-cross"
CC = arm-none-linux-gnueabi-gcc
LD = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
CFLAGS += -O3 -mfpu=neon -mcpu=cortex-a8 -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
CROSSCOMPILE=yes
HAVE_PTHREADS ?= yes
endif
ifeq "$(OS)" "webos-pre-cross"
CC = arm-none-linux-gnueabi-gcc
LD = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
CFLAGS += -O3 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -fsingle-precision-constant
CROSSCOMPILE=yes
endif
ifeq "$(OS)" "webos-pixi-cross"
CC = arm-none-linux-gnueabi-gcc
LD = arm-none-linux-gnueabi-gcc
AR = arm-none-linux-gnueabi-ar
CFLAGS += -O3 -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -ffast-math -fsingle-precision-constant
CROSSCOMPILE=yes
endif
ifeq "$(OS)" "w64_x86-cross-mingw32"
CC = i686-w64-mingw32-gcc
LD = i686-w64-mingw32-gcc
AR = i686-w64-mingw32-ar
WINDRES = i686-w64-mingw32-windres
CROSSCOMPILE=yes
HAVE_WIN32=yes
endif
ifeq "$(OS)" "w64_amd64-cross-mingw32"
CC = x86_64-w64-mingw32-gcc
LD = x86_64-w64-mingw32-gcc
AR = x86_64-w64-mingw32-ar
WINDRES = x86-64-mingw32-windres
CROSSCOMPILE=yes
HAVE_WIN32=yes
endif
ifeq "$(OS)" "pnacl-cross"
VALID_TOOLCHAINS := pnacl
TARGET = mupdf
include $(NACL_SDK_ROOT)/tools/common.mk
CC = $(PNACL_CC)
CXX = $(PNACL_CXX)
LD = $(PNACL_LD)
AR = $(PNACL_LIB)
CFLAGS += -D__NACL__
CROSSCOMPILE=yes
# Don't install libjpeg, libz, or libfreetype, since these are already
# provided by naclports and the versions compiled here cause problems
# with nacl.
install-nacl-libs: $(OUT)/libmupdf.a $(OUT)/libmujs.a $(OUT)/libjbig2dec.a $(OUT)/libopenjpeg.a
install -d $(LIBDIR)/$(TOOLCHAIN)/$(CONFIG)/
install $(OUT)/libmupdf.a $(OUT)/libmujs.a $(OUT)/libjbig2dec.a $(OUT)/libopenjpeg.a $(LIBDIR)/$(TOOLCHAIN)/$(CONFIG)/
endif
# Most variables when building for iOS are set up in ios/build_libs.sh,
# which is called from the Xcode project as a "Run Script" build step.
# The following section works for both device and simulator builds.
ifeq "$(OS)" "ios"
CC = xcrun cc
AR = xcrun ar
LD = xcrun ld
RANLIB_CMD = xcrun ranlib $@
CROSSCOMPILE=yes
endif
ifeq "$(OS)" "tizen-arm"
TIZEN_TOOLS=$(TIZEN_SDK)/tools/arm-linux-gnueabi-gcc-4.6/bin/arm-linux-gnueabi-
TIZEN_FLAGS=--sysroot=$(TIZEN_SDK)/platforms/mobile-2.3/rootstraps/mobile-2.3-device.core
CC = $(TIZEN_TOOLS)gcc $(TIZEN_FLAGS)
AR = $(TIZEN_TOOLS)ar
LD = $(TIZEN_TOOLS)ld $(TIZEN_FLAGS)
CROSSCOMPILE=yes
endif
ifeq "$(OS)" "tizen-x86"
TIZEN_TOOLS=$(TIZEN_SDK)/tools/i386-linux-gnueabi-gcc-4.6/bin/i386-linux-gnueabi-
TIZEN_FLAGS=--sysroot=$(TIZEN_SDK)/platforms/mobile-2.3/rootstraps/mobile-2.3-emulator.core
CC = $(TIZEN_TOOLS)gcc $(TIZEN_FLAGS)
AR = $(TIZEN_TOOLS)ar $(TIZEN_FLAGS)
LD = $(TIZEN_TOOLS)ld $(TIZEN_FLAGS)
CROSSCOMPILE=yes
endif
ifeq "$(HAVE_WIN32)" "yes"
WIN32_LIBS=-lcomdlg32 -lgdi32
LDFLAGS += -Wl,-subsystem,windows
endif
# TODO: If crosscompiling, why not just call "make libs" instead of this exception?
ifeq "$(CROSSCOMPILE)" "yes"
HAVE_X11 ?= no
HAVE_GLFW ?= no
endif
ifeq "$(HAVE_PTHREADS)" "yes"
CFLAGS += -DHAVE_PTHREADS
LIBS += -lpthread
endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bruisebd/mupdf.git
git@gitee.com:bruisebd/mupdf.git
bruisebd
mupdf
mupdf
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385