-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
168 lines (133 loc) · 4.25 KB
/
Makefile
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# GNU Make based build file. For details on GNU Make see:
# http://www.gnu.org/software/make/manual/make.html
#
#
# Get pepper directory for toolchain and includes.
#
# If NACL_SDK_ROOT is not set, then assume it can be found three directories up.
#
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
NACL_SDK_ROOT ?= $(abspath $(dir $(THIS_MAKEFILE))../..)
# Project Build flags
WARNINGS := -Wno-long-long -Wall -Wswitch -Werror
#
# Compute tool paths
#
GETOS := python $(NACL_SDK_ROOT)/tools/getos.py
OSHELPERS = python $(NACL_SDK_ROOT)/tools/oshelpers.py
OSNAME := $(shell $(GETOS))
ifdef NATIVE
TC_PATH=/usr
PREFIX=
EXTRA_CXX_FLAGS=
EXTRA_LD_FLAGS=
CXX_PKGCONFIG=$(shell pkg-config --cflags cairo protobuf) -I$(shell readlink -f $$HOME)/Code/poppler-0.24.5/cpp
LD_PKGCONFIG=-L$(shell readlink -f $$HOME)/Code/poppler-0.24.5/cpp/.libs -lpoppler-cpp $(shell pkg-config --libs cairo fontconfig pixman-1 freetype2 protobuf png)
PROTOC=protoc
CXX_SUFFIX=g++
CXXFLAGS := -pthread -std=gnu++0x $(WARNINGS)
LDTAR=
else
TC_PATH=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
PREFIX=pnacl-
EXTRA_CXX_FLAGS= -I$(NACL_SDK_ROOT)/include
EXTRA_LD_FLAGS=-L$(NACL_SDK_ROOT)/lib/pnacl/Release -lnacl_io -lppapi -lppapi_cpp
CXX_PKGCONFIG=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags cairo protobuf poppler poppler-cpp)
LD_PKGCONFIG=$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs poppler-cpp poppler cairo fontconfig pixman-1 freetype2 protobuf libpng)
CXX_SUFFIX=clang++
CXXFLAGS := -pthread -std=gnu++11 -stdlib=libc++ $(WARNINGS)
LDTAR=-ltar
endif
CXX := $(TC_PATH)/bin/$(PREFIX)$(CXX_SUFFIX)
PKG_CONFIG_PATH=${TC_PATH}/usr/lib/pkgconfig
FINALIZE := $(TC_PATH)/bin/$(PREFIX)finalize
CXXFLAGS += $(EXTRA_CXX_FLAGS) $(CXX_PKGCONFIG)
LDFLAGS := $(EXTRA_LD_FLAGS) $(LD_PKGCONFIG) -lz -lexpat $(LDTAR) -lpodofo -lcrypto -ljpeg
BCOBJECTS=\
pdfsketch.bc
PEXE=pdfsketch.pexe
NEXE=pdfsketch_x86_64.nexe
NEXES=\
pdfsketch_x86_32.nexe \
pdfsketch_x86_64.nexe \
pdfsketch_arm_32.nexe
TEST_EXE=test
OBJECTS=\
view.o \
page_view.o \
scroll_bar_view.o \
scroll_view.o \
document_view.o \
rectangle.o \
graphic.o \
text_area.o \
toolbox.o \
undo_manager.o \
checkmark.o \
document.pb.o \
file_io.o \
graphic_factory.o \
circle.o \
squiggle.o \
image.o
NACL_OBJECTS=\
pdfsketch.o \
root_view.o
TEST_OBJECTS=\
test_main.o
DISTFILES=\
$(NEXES) \
system.tar \
manifest.json \
index.html \
index.js \
main.js \
style.css \
logo16.png \
logo128.png \
pdfsketch_nexe.nmf \
colors.js \
color_picker.js \
color_chip_background.svg
CROSFONTSTARBALL=croscorefonts-1.23.0.tar.gz
# Declare the ALL target first, to make the 'all' target the default build
all: $(PEXE)
clean:
rm -f $(PEXE) $(OBJECTS) $(NACL_OBJECTS) $(TEST_OBJECTS) $(BCOBJECTS) *.pb.*
$(OBJECTS): document.pb.cc
%.pb.cc: %.proto
protoc --cpp_out=. document.proto
%.o: %.cc
$(CXX) -c -o $@ $< -O2 $(CXXFLAGS)
pdfsketch.bc: $(OBJECTS) $(NACL_OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(NACL_OBJECTS) -O2 $(CXXFLAGS) $(LDFLAGS)
$(TEST_EXE): $(OBJECTS) $(TEST_OBJECTS)
$(CXX) -o $@ $(OBJECTS) $(TEST_OBJECTS) -O2 $(CXXFLAGS) $(LDFLAGS)
$(PEXE): $(BCOBJECTS)
$(FINALIZE) -o $@ $(BCOBJECTS)
$(NEXE): $(PEXE)
$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-translate --allow-llvm-bitcode-input $< -arch x86-64 -o $@
pdfsketch_x86_32.nexe: $(PEXE)
$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-translate --allow-llvm-bitcode-input $< -arch x86-32 -o $@
pdfsketch_arm_32.nexe: $(PEXE)
$(NACL_SDK_ROOT)/toolchain/linux_pnacl/bin/pnacl-translate --allow-llvm-bitcode-input $< -arch arm -o $@
$(CROSFONTSTARBALL):
wget http://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/croscorefonts-1.23.0.tar.gz
system: $(CROSFONTSTARBALL)
mkdir -p system/usr/share/fonts
mkdir -p system/etc
cp -R $(NACL_SDK_ROOT)/toolchain/linux_pnacl/usr/etc/fonts system/etc/
tar xzvf $< -C system
mv system/croscorefonts-* system/usr/share/fonts/croscore
system.tar: system
cp local.conf system/etc/fonts/
tar cvhf system.tar -C system .
dist.zip: $(DISTFILES)
rm -rf dist
mkdir dist
cp $(DISTFILES) dist
cd dist && zip ../$@ * && cd ..