summaryrefslogtreecommitdiff
path: root/Makerules
blob: 2fe704e92ec93c89f7758c9686504979d2d7da17 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Configuration for the Makefile

OS ?= $(shell uname)
OS := $(OS:MINGW%=MINGW)

CFLAGS += -Wall

ifeq "$(build)" "debug"
CFLAGS += -pipe -g
else ifeq "$(build)" "profile"
CFLAGS += -pipe -O2 -DNDEBUG -pg
LDFLAGS += -pg
else ifeq "$(build)" "release"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer
else ifeq "$(build)" "native"
CFLAGS += -pipe -O2 -DNDEBUG -fomit-frame-pointer -march=native -mfpmath=sse
else
$(error unknown build setting: '$(build)')
endif

ifeq "$(OS)" "Linux"
SYS_FREETYPE_INC := `pkg-config --cflags freetype2`
X11_LIBS := -lX11 -lXext
endif

ifeq "$(OS)" "FreeBSD"
SYS_FREETYPE_INC := `pkg-config --cflags freetype2`
LDFLAGS += -L/usr/local/lib
X11_LIBS := -lX11 -lXext
endif

# Mac OS X build depends on some thirdparty libs
ifeq "$(OS)" "Darwin"
SYS_FREETYPE_INC := -I/usr/X11R6/include/freetype2
CFLAGS += -I/usr/X11R6/include
LDFLAGS += -L/usr/X11R6/lib
RANLIB_CMD = ranlib $@
X11_LIBS := -lX11 -lXext
ifeq "$(arch)" "amd64"
CFLAGS += -m64
LDFLAGS += -m64
else
CFLAGS += -m32
LDFLAGS += -m32
endif
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
NOX11=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
NOX11=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
NOX11=yes
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 = $(PLATFORM_DEVELOPER_BIN_DIR)/clang
AR = $(PLATFORM_DEVELOPER_BIN_DIR)/ar
RANLIB_CMD = $(PLATFORM_DEVELOPER_BIN_DIR)/ranlib $@
CROSSCOMPILE=yes
NOX11=yes
endif