OLD | NEW |
| (Empty) |
1 # Simple makefile for skia library and test apps | |
2 # | |
3 # This is the handmade Makefile that we *used* to use before changing over | |
4 # to gyp. Keeping it around for now in case some folks need to use it... | |
5 # but please contact epoger@google.com about anything you're still using in | |
6 # here, so we can provide equivalent functionality in the gyp build. | |
7 | |
8 # setup our defaults | |
9 CC := gcc | |
10 GPP := g++ | |
11 C_INCLUDES := -Iinclude/config -Iinclude/core -Iinclude/effects -Iinclude/images
-Iinclude/ports | |
12 C_INCLUDES += -Iinclude/gpu -Iinclude/utils -Igpu/include | |
13 C_INCLUDES += -Ithird_party/glu | |
14 | |
15 CFLAGS := -Wall -fstrict-aliasing | |
16 #CFLAGS += -W -Wextra -Wcast-align -Wchar-subscripts -Wformat -Wformat-security
-Wno-format-y2k -Wno-parentheses -Wno-unused-parameter -Wpointer-arith -Wreturn
-type -Wundef -Wwrite-strings | |
17 CFLAGS_SSE2 = $(CFLAGS) -msse2 | |
18 LINKER_OPTS := -lpthread -lz | |
19 DEFINES := -DSK_CAN_USE_FLOAT | |
20 HIDE = @ | |
21 | |
22 ifeq ($(SKIA_SCALAR),fixed) | |
23 DEFINES += -DSK_SCALAR_IS_FIXED | |
24 else | |
25 DEFINES += -DSK_SCALAR_IS_FLOAT | |
26 endif | |
27 | |
28 ifeq ($(SKIA_DEBUG),true) | |
29 DEFINES += -DSK_DEBUG -DSK_SUPPORT_UNIT -DGR_DEBUG=1 | |
30 CFLAGS += -g | |
31 else | |
32 CFLAGS += -O3 | |
33 DEFINES += -DSK_RELEASE -DGR_DEBUG=0 | |
34 endif | |
35 | |
36 ifneq ($(SKIA_PDF_SUPPORT),false) | |
37 DEFINES += -DSK_SUPPORT_PDF | |
38 DEFINES += -DSK_ZLIB_INCLUDE="<zlib.h>" | |
39 endif | |
40 | |
41 ifeq ($(SKIA_SHARED),true) | |
42 CFLAGS += -fPIC | |
43 LIBSKIA = out/libskia.so | |
44 else | |
45 LIBSKIA = out/libskia.a | |
46 endif | |
47 | |
48 # start with the core (required) | |
49 include src/core/core_files.mk | |
50 SRC_LIST := $(addprefix src/core/, $(SOURCE)) | |
51 | |
52 # add the opts (optimizations) | |
53 include src/opts/opts_sse2_files.mk | |
54 #include src/opts/opts_files.mk | |
55 SRC_LIST += $(addprefix src/opts/, $(SOURCE)) | |
56 | |
57 # we usually need ports | |
58 include src/ports/ports_files.mk | |
59 SRC_LIST += $(addprefix src/ports/, $(SOURCE)) | |
60 | |
61 # do we want effects? | |
62 include src/effects/effects_files.mk | |
63 SRC_LIST += $(addprefix src/effects/, $(SOURCE)) | |
64 | |
65 # core image files | |
66 include src/images/images_files.mk | |
67 SRC_LIST += $(addprefix src/images/, $(SOURCE)) | |
68 | |
69 # core util files | |
70 include src/utils/utils_files.mk | |
71 SRC_LIST += $(addprefix src/utils/, $(SOURCE)) | |
72 | |
73 # GPU files | |
74 include gpu/src/gr_files.mk | |
75 SRC_LIST += $(addprefix gpu/src/, $(SOURCE)) | |
76 | |
77 # GPU support files | |
78 include src/gpu/skgr_files.mk | |
79 SRC_LIST += $(addprefix src/gpu/, $(SOURCE)) | |
80 | |
81 # pdf backend files | |
82 ifneq ($(SKIA_PDF_SUPPORT),false) | |
83 C_INCLUDES += -Iinclude/pdf | |
84 include src/pdf/pdf_files.mk | |
85 SRC_LIST += $(addprefix src/pdf/, $(SOURCE)) | |
86 endif | |
87 | |
88 # extra files we want to build to prevent bit-rot, but not link | |
89 JUST_COMPILE_LIST := src/ports/SkFontHost_tables.cpp | |
90 | |
91 # conditional files based on our platform | |
92 ifeq ($(SKIA_BUILD_FOR),mac) | |
93 # make it work with 10.4 for our font port | |
94 # GPP := g++-4.0 | |
95 # SDK := /Developer/SDKs/MacOSX10.4u.sdk | |
96 # SDK_OPTS := -isysroot $(SDK) -mmacosx-version-min=10.4 | |
97 # CC := gcc-4.0 $(SDK_OPTS) | |
98 | |
99 C_INCLUDES += -I/opt/local/include | |
100 LINKER_OPTS += -L/opt/local/lib -framework Carbon -lpng | |
101 DEFINES += -DSK_BUILD_FOR_MAC -DSK_ENABLE_LIBPNG | |
102 ifeq ($(SKIA_MESA),true) | |
103 C_INCLUDES += -I/usr/X11/include | |
104 LINKER_OPTS += -L/usr/X11/lib -lOSMesa -lGLU | |
105 DEFINES += -DSK_MESA | |
106 else | |
107 LINKER_OPTS += -framework OpenGL -framework AGL | |
108 endif | |
109 C_INCLUDES += -Iinclude/utils/mac | |
110 # SRC_LIST += src/ports/SkImageDecoder_CG.cpp | |
111 SRC_LIST += src/utils/mac/SkCreateCGImageRef.cpp | |
112 ifeq ($(SKIA_MESA),true) | |
113 SRC_LIST += src/utils/mesa/SkEGLContext_Mesa.cpp | |
114 else | |
115 SRC_LIST += src/utils/mac/SkEGLContext_mac.cpp | |
116 endif | |
117 SRC_LIST += src/core/SkTypefaceCache.cpp | |
118 SRC_LIST += src/ports/SkFontHost_mac_coretext.cpp | |
119 | |
120 # these are our registry-based factories | |
121 SRC_LIST += src/images/SkImageDecoder_Factory.cpp | |
122 SRC_LIST += src/images/SkImageEncoder_Factory.cpp | |
123 SRC_LIST += src/images/SkImageDecoder_libpng.cpp | |
124 # support files | |
125 SRC_LIST += src/images/SkScaledBitmapSampler.cpp | |
126 | |
127 ifeq ($(SKIA_MESA),true) | |
128 SRC_LIST += gpu/src/mesa/GrGLDefaultInterface_mesa.cpp | |
129 else | |
130 SRC_LIST += gpu/src/mac/GrGLDefaultInterface_mac.cpp | |
131 endif | |
132 | |
133 else | |
134 LINKER_OPTS += -lpng -lfreetype -lrt | |
135 DEFINES += -DSK_BUILD_FOR_UNIX -DSK_ENABLE_LIBPNG | |
136 ifeq ($(SKIA_MESA),true) | |
137 LINKER_OPTS += -lOSMesa -lGLU | |
138 DEFINES += -DSK_MESA | |
139 else | |
140 LINKER_OPTS += -lGL -lGLU -lX11 | |
141 endif | |
142 | |
143 #Assume the color order for now. | |
144 DEFINES += -DSK_SAMPLES_FOR_X | |
145 | |
146 # needed for freetype support | |
147 C_INCLUDES += -I/usr/include/freetype2 | |
148 SRC_LIST += src/ports/SkFontHost_linux.cpp | |
149 SRC_LIST += src/ports/SkFontHost_gamma_none.cpp | |
150 SRC_LIST += src/ports/SkFontHost_FreeType.cpp | |
151 SRC_LIST += src/ports/SkFontHost_FreeType_Subpixel.cpp | |
152 ifeq ($(SKIA_MESA),true) | |
153 SRC_LIST += src/utils/mesa/SkEGLContext_Mesa.cpp | |
154 else | |
155 SRC_LIST += src/utils/unix/SkEGLContext_Unix.cpp | |
156 endif | |
157 # these are our registry-based factories | |
158 SRC_LIST += src/images/SkImageDecoder_Factory.cpp | |
159 SRC_LIST += src/images/SkImageEncoder_Factory.cpp | |
160 SRC_LIST += src/images/SkImageDecoder_libpng.cpp | |
161 # support files | |
162 SRC_LIST += src/images/SkScaledBitmapSampler.cpp | |
163 | |
164 ifeq ($(SKIA_MESA),true) | |
165 SRC_LIST += gpu/src/mesa/GrGLDefaultInterface_mesa.cpp | |
166 else | |
167 SRC_LIST += gpu/src/unix/GrGLDefaultInterface_unix.cpp | |
168 endif | |
169 endif | |
170 | |
171 # For these files, and these files only, compile with -msse2. | |
172 SSE2_OBJS := out/src/opts/SkBlitRow_opts_SSE2.o \ | |
173 out/src/opts/SkBitmapProcState_opts_SSE2.o \ | |
174 out/src/opts/SkUtils_opts_SSE2.o | |
175 $(SSE2_OBJS) : CFLAGS := $(CFLAGS_SSE2) | |
176 | |
177 out/%.o : %.cpp | |
178 @mkdir -p $(dir $@) | |
179 $(HIDE)$(CC) $(C_INCLUDES) $(CFLAGS) $(DEFINES) -c $< -o $@ | |
180 @echo "compiling $@" | |
181 | |
182 %.s : %.cpp | |
183 @mkdir -p $(dir $@) | |
184 $(CC) $(C_INCLUDES) $(CFLAGS) $(DEFINES) -S -c $< -o $@ | |
185 | |
186 # now build out objects | |
187 OBJ_LIST := $(SRC_LIST:.cpp=.o) | |
188 OBJ_LIST := $(addprefix out/, $(OBJ_LIST)) | |
189 | |
190 # we want to compile these, but we don't actually link them | |
191 JUST_COMPILE_OBJS := $(JUST_COMPILE_LIST:.cpp=.o) | |
192 JUST_COMPILE_OBJS := $(addprefix out/, $(JUST_COMPILE_OBJS)) | |
193 | |
194 out/libskia.a: Makefile $(OBJ_LIST) $(JUST_COMPILE_OBJS) | |
195 $(HIDE)$(AR) ru $@ $(OBJ_LIST) | |
196 $(HIDE)ranlib $@ | |
197 | |
198 out/libskia.so: Makefile $(OBJ_LIST) $(JUST_COMPILE_OBJS) | |
199 $(HIDE)$(GPP) -shared -o $@ $(OBJ_LIST) $(JUST_COMPILE_OBJS) $(LINKER_OP
TS) | |
200 | |
201 ############################################################################## | |
202 | |
203 BENCH_SRCS := RectBench.cpp SkBenchmark.cpp benchmain.cpp BitmapBench.cpp \ | |
204 RepeatTileBench.cpp DecodeBench.cpp FPSBench.cpp PathBench.cpp \ | |
205 GradientBench.cpp MatrixBench.cpp ScalarBench.cpp \ | |
206 BenchTimer.cpp BenchGpuTimer_gl.cpp | |
207 | |
208 ifeq ($(SKIA_BUILD_FOR),mac) | |
209 BENCH_SRCS += BenchSysTimer_mach.cpp | |
210 else | |
211 BENCH_SRCS += BenchSysTimer_posix.cpp | |
212 endif | |
213 | |
214 BENCH_SRCS := $(addprefix bench/, $(BENCH_SRCS)) | |
215 | |
216 # add any optional codecs for this app | |
217 ifeq ($(SKIA_BUILD_FOR),mac) | |
218 BENCH_SRCS += bench/TextBench.cpp | |
219 else | |
220 BENCH_SRCS += src/images/SkImageDecoder_libpng.cpp | |
221 endif | |
222 | |
223 BENCH_OBJS := $(BENCH_SRCS:.cpp=.o) | |
224 BENCH_OBJS := $(addprefix out/, $(BENCH_OBJS)) | |
225 | |
226 bench: $(BENCH_OBJS) $(LIBSKIA) | |
227 @echo "linking bench..." | |
228 $(HIDE)$(GPP) $(BENCH_OBJS) $(LIBSKIA) -o out/bench/bench $(LINKER_OPTS) | |
229 | |
230 ############################################################################## | |
231 | |
232 # we let tests cheat and see private headers, so we can unittest modules | |
233 C_INCLUDES += -Isrc/core | |
234 | |
235 include tests/tests_files.mk | |
236 ifneq ($(SKIA_PDF_SUPPORT),false) | |
237 SOURCE += PDFPrimitivesTest.cpp | |
238 endif | |
239 TESTS_SRCS := $(addprefix tests/, $(SOURCE)) | |
240 | |
241 TESTS_OBJS := $(TESTS_SRCS:.cpp=.o) | |
242 TESTS_OBJS := $(addprefix out/, $(TESTS_OBJS)) | |
243 | |
244 tests: $(TESTS_OBJS) $(LIBSKIA) | |
245 @echo "linking tests..." | |
246 $(HIDE)$(GPP) $(TESTS_OBJS) $(LIBSKIA) -o out/tests/tests $(LINKER_OPTS) | |
247 | |
248 ############################################################################## | |
249 | |
250 SKIMAGE_SRCS := skimage_main.cpp | |
251 | |
252 SKIMAGE_SRCS := $(addprefix tools/, $(SKIMAGE_SRCS)) | |
253 | |
254 SKIMAGE_OBJS := $(SKIMAGE_SRCS:.cpp=.o) | |
255 SKIMAGE_OBJS := $(addprefix out/, $(SKIMAGE_OBJS)) | |
256 | |
257 skimage: $(SKIMAGE_OBJS) $(LIBSKIA) | |
258 @echo "linking skimage..." | |
259 $(HIDE)$(GPP) $(SKIMAGE_OBJS) $(LIBSKIA) -o out/tools/skimage $(LINKER_O
PTS) | |
260 | |
261 ############################################################################## | |
262 | |
263 SKDIFF_SRCS := skdiff_main.cpp | |
264 SKDIFF_SRCS := $(addprefix tools/, $(SKDIFF_SRCS)) | |
265 SKDIFF_OBJS := $(SKDIFF_SRCS:.cpp=.o) | |
266 SKDIFF_OBJS := $(addprefix out/, $(SKDIFF_OBJS)) | |
267 skdiff: $(SKDIFF_OBJS) out/libskia.a | |
268 @echo "linking skdiff..." | |
269 $(HIDE)$(GPP) $(SKDIFF_OBJS) out/libskia.a -o out/tools/skdiff $(LINKER_
OPTS) | |
270 | |
271 ############################################################################## | |
272 | |
273 SKHELLO_SRCS := skhello.cpp | |
274 | |
275 SKHELLO_SRCS := $(addprefix tools/, $(SKHELLO_SRCS)) | |
276 | |
277 SKHELLO_OBJS := $(SKHELLO_SRCS:.cpp=.o) | |
278 SKHELLO_OBJS := $(addprefix out/, $(SKHELLO_OBJS)) | |
279 | |
280 skhello: $(SKHELLO_OBJS) $(LIBSKIA) | |
281 @echo "linking shkello..." | |
282 $(HIDE)$(GPP) $(SKHELLO_OBJS) $(LIBSKIA) -o out/tools/skhello $(LINKER_O
PTS) | |
283 | |
284 ############################################################################## | |
285 | |
286 include gm/gm_files.mk | |
287 GM_SRCS := $(addprefix gm/, $(SOURCE)) | |
288 | |
289 ifneq ($(SKIA_BUILD_FOR),mac) | |
290 GM_SRCS += src/images/SkImageDecoder_libpng.cpp | |
291 endif | |
292 | |
293 GM_OBJS := $(GM_SRCS:.cpp=.o) | |
294 GM_OBJS := $(addprefix out/, $(GM_OBJS)) | |
295 | |
296 gm: $(GM_OBJS) $(LIBSKIA) | |
297 @echo "linking gm..." | |
298 $(HIDE)$(GPP) $(GM_OBJS) $(LIBSKIA) -o out/gm/gm $(LINKER_OPTS) | |
299 | |
300 ############################################################################## | |
301 | |
302 .PHONY: all | |
303 all: $ bench gm skimage tests skhello skdiff | |
304 | |
305 .PHONY: clean | |
306 clean: | |
307 $(HIDE)rm -rf out | |
308 | |
309 .PHONY: help | |
310 help: | |
311 @echo "Targets:" | |
312 @echo " <default>: out/libskia.a" | |
313 @echo " bench: out/bench/bench" | |
314 @echo " gm: out/gm/gm" | |
315 @echo " skimage: out/tools/skimage" | |
316 @echo " skhello: out/tools/skhello" | |
317 @echo " tests: out/tests/tests" | |
318 @echo " clean: removes entire out/ directory" | |
319 @echo " help: this text" | |
320 @echo "Options: (after make, or in bash shell)" | |
321 @echo " SKIA_DEBUG=true for debug build" | |
322 @echo " SKIA_SHARED=true for shared-object libskia build" | |
323 @echo " SKIA_SCALAR=fixed for fixed-point build" | |
324 @echo " SKIA_BUILD_FOR=mac for mac build (e.g. CG for image decoding)
" | |
325 @echo " SKIA_PDF_SUPPORT=false to disable the pdf generation backend" | |
326 @echo " SKIA_MESA=true to build with osmesa instead of native GL. | |
327 @echo "" | |
OLD | NEW |