2009-01-21 03:15:13 +00:00
|
|
|
# Simple makefile for skia library and test apps
|
2009-01-16 16:15:37 +00:00
|
|
|
|
2009-01-21 15:07:03 +00:00
|
|
|
# setup our defaults
|
2009-01-21 03:15:13 +00:00
|
|
|
CC := gcc
|
2010-05-12 17:25:30 +00:00
|
|
|
GPP := g++
|
2011-03-22 14:07:59 +00:00
|
|
|
C_INCLUDES := -Iinclude/config -Iinclude/core -Iinclude/effects -Iinclude/images -Iinclude/ports
|
|
|
|
C_INCLUDES += -Iinclude/gpu -Iinclude/utils -Igpu/include
|
2010-12-23 15:00:45 +00:00
|
|
|
|
2011-01-10 14:54:30 +00:00
|
|
|
CFLAGS := -Wall -fstrict-aliasing
|
2011-01-25 19:05:12 +00:00
|
|
|
#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
|
2009-11-16 21:09:00 +00:00
|
|
|
CFLAGS_SSE2 = $(CFLAGS) -msse2
|
2010-12-20 19:46:07 +00:00
|
|
|
LINKER_OPTS := -lpthread -lz
|
2009-01-21 03:15:13 +00:00
|
|
|
DEFINES := -DSK_CAN_USE_FLOAT
|
2009-01-16 16:15:37 +00:00
|
|
|
HIDE = @
|
|
|
|
|
2009-01-21 15:07:03 +00:00
|
|
|
ifeq ($(SKIA_SCALAR),fixed)
|
2009-01-21 03:15:13 +00:00
|
|
|
DEFINES += -DSK_SCALAR_IS_FIXED
|
|
|
|
else
|
|
|
|
DEFINES += -DSK_SCALAR_IS_FLOAT
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(SKIA_DEBUG),true)
|
2010-12-23 15:12:59 +00:00
|
|
|
DEFINES += -DSK_DEBUG -DSK_SUPPORT_UNIT -DGR_DEBUG=1
|
2011-01-25 19:05:12 +00:00
|
|
|
CFLAGS += -g
|
2009-01-21 03:15:13 +00:00
|
|
|
else
|
2011-01-25 19:05:12 +00:00
|
|
|
CFLAGS += -O2
|
2010-12-23 15:12:59 +00:00
|
|
|
DEFINES += -DSK_RELEASE -DGR_DEBUG=0
|
2009-01-21 03:15:13 +00:00
|
|
|
endif
|
2009-01-16 16:15:37 +00:00
|
|
|
|
2011-03-21 19:51:57 +00:00
|
|
|
DEFINES += -DGR_IMPLEMENTATION=1
|
|
|
|
|
2009-07-22 19:21:01 +00:00
|
|
|
DEFINES += -DSK_SUPPORT_LCDTEXT
|
|
|
|
|
2011-03-08 18:33:31 +00:00
|
|
|
ifneq ($(SKIA_PDF_SUPPORT),false)
|
2010-12-20 19:46:07 +00:00
|
|
|
DEFINES += -DSK_SUPPORT_PDF
|
2010-12-20 20:53:13 +00:00
|
|
|
DEFINES += -DSK_ZLIB_INCLUDE="<zlib.h>"
|
2010-12-20 19:46:07 +00:00
|
|
|
endif
|
|
|
|
|
2009-01-16 16:15:37 +00:00
|
|
|
# start with the core (required)
|
|
|
|
include src/core/core_files.mk
|
|
|
|
SRC_LIST := $(addprefix src/core/, $(SOURCE))
|
|
|
|
|
2009-07-30 02:25:54 +00:00
|
|
|
# add the opts (optimizations)
|
2011-01-17 18:41:23 +00:00
|
|
|
include src/opts/opts_sse2_files.mk
|
|
|
|
#include src/opts/opts_files.mk
|
2009-07-30 02:25:54 +00:00
|
|
|
SRC_LIST += $(addprefix src/opts/, $(SOURCE))
|
|
|
|
|
2009-01-16 16:15:37 +00:00
|
|
|
# we usually need ports
|
|
|
|
include src/ports/ports_files.mk
|
|
|
|
SRC_LIST += $(addprefix src/ports/, $(SOURCE))
|
|
|
|
|
|
|
|
# do we want effects?
|
|
|
|
include src/effects/effects_files.mk
|
|
|
|
SRC_LIST += $(addprefix src/effects/, $(SOURCE))
|
|
|
|
|
2009-01-21 03:15:13 +00:00
|
|
|
# core image files
|
|
|
|
include src/images/images_files.mk
|
|
|
|
SRC_LIST += $(addprefix src/images/, $(SOURCE))
|
|
|
|
|
2009-04-14 14:28:22 +00:00
|
|
|
# core util files
|
|
|
|
include src/utils/utils_files.mk
|
|
|
|
SRC_LIST += $(addprefix src/utils/, $(SOURCE))
|
|
|
|
|
2010-12-23 15:00:45 +00:00
|
|
|
# GPU files
|
|
|
|
include gpu/src/gr_files.mk
|
|
|
|
SRC_LIST += $(addprefix gpu/src/, $(SOURCE))
|
|
|
|
|
|
|
|
# GPU support files
|
|
|
|
include src/gpu/skgr_files.mk
|
|
|
|
SRC_LIST += $(addprefix src/gpu/, $(SOURCE))
|
|
|
|
|
2010-09-24 22:25:30 +00:00
|
|
|
# pdf backend files
|
2011-03-08 18:33:31 +00:00
|
|
|
ifneq ($(SKIA_PDF_SUPPORT),false)
|
2010-09-24 22:25:30 +00:00
|
|
|
C_INCLUDES += -Iinclude/pdf
|
|
|
|
include src/pdf/pdf_files.mk
|
|
|
|
SRC_LIST += $(addprefix src/pdf/, $(SOURCE))
|
|
|
|
endif
|
|
|
|
|
2009-04-14 14:28:22 +00:00
|
|
|
# extra files we want to build to prevent bit-rot, but not link
|
|
|
|
JUST_COMPILE_LIST := src/ports/SkFontHost_tables.cpp
|
|
|
|
|
2009-01-21 03:15:13 +00:00
|
|
|
# conditional files based on our platform
|
2009-01-21 15:07:03 +00:00
|
|
|
ifeq ($(SKIA_BUILD_FOR),mac)
|
2010-05-12 17:25:30 +00:00
|
|
|
# make it work with 10.4 for our font port
|
2010-12-20 18:32:39 +00:00
|
|
|
# GPP := g++-4.0
|
|
|
|
# SDK := /Developer/SDKs/MacOSX10.4u.sdk
|
|
|
|
# SDK_OPTS := -isysroot $(SDK) -mmacosx-version-min=10.4
|
|
|
|
# CC := gcc-4.0 $(SDK_OPTS)
|
2010-05-12 17:25:30 +00:00
|
|
|
|
2010-12-23 16:34:58 +00:00
|
|
|
C_INCLUDES += -I/opt/local/include
|
2011-03-21 17:45:15 +00:00
|
|
|
LINKER_OPTS += -L/opt/local/lib -framework Carbon -lpng -framework OpenGL -framework AGL
|
2010-12-23 16:34:58 +00:00
|
|
|
DEFINES += -DSK_BUILD_FOR_MAC -DSK_ENABLE_LIBPNG
|
2009-01-21 03:15:13 +00:00
|
|
|
|
|
|
|
C_INCLUDES += -Iinclude/utils/mac
|
2010-12-23 16:34:58 +00:00
|
|
|
# SRC_LIST += src/ports/SkImageDecoder_CG.cpp
|
2011-01-03 13:48:50 +00:00
|
|
|
SRC_LIST += src/utils/mac/SkCreateCGImageRef.cpp
|
2010-12-23 15:00:45 +00:00
|
|
|
SRC_LIST += src/utils/mac/SkEGLContext_mac.cpp
|
2010-12-20 18:32:39 +00:00
|
|
|
SRC_LIST += src/ports/SkFontHost_mac_coretext.cpp
|
2010-12-23 16:34:58 +00:00
|
|
|
|
|
|
|
# these are our registry-based factories
|
|
|
|
SRC_LIST += src/images/SkImageDecoder_Factory.cpp
|
|
|
|
SRC_LIST += src/images/SkImageEncoder_Factory.cpp
|
|
|
|
SRC_LIST += src/images/SkImageDecoder_libpng.cpp
|
|
|
|
# support files
|
|
|
|
SRC_LIST += src/images/SkScaledBitmapSampler.cpp
|
2011-04-04 17:13:52 +00:00
|
|
|
|
|
|
|
SRC_LIST += gpu/src/mac/GrGLDefaultInterface_mac.cpp
|
2009-01-21 03:15:13 +00:00
|
|
|
else
|
2010-12-23 20:20:51 +00:00
|
|
|
LINKER_OPTS += -lpng -lfreetype -lGL
|
|
|
|
DEFINES += -DSK_BUILD_FOR_UNIX -DSK_ENABLE_LIBPNG -DGR_LINUX_BUILD=1
|
2009-01-21 03:15:13 +00:00
|
|
|
|
2011-03-18 21:43:03 +00:00
|
|
|
ifeq ($(SKIA_SAMPLES_FOR_X),true)
|
|
|
|
DEFINES += -DSK_SAMPLES_FOR_X
|
|
|
|
endif
|
2009-09-28 16:12:48 +00:00
|
|
|
# needed for freetype support
|
|
|
|
C_INCLUDES += -I/usr/include/freetype2
|
|
|
|
SRC_LIST += src/ports/SkFontHost_linux.cpp
|
|
|
|
SRC_LIST += src/ports/SkFontHost_gamma_none.cpp
|
|
|
|
SRC_LIST += src/ports/SkFontHost_FreeType.cpp
|
|
|
|
SRC_LIST += src/ports/SkFontHost_FreeType_Subpixel.cpp
|
|
|
|
SRC_LIST += src/utils/SkOSFile.cpp
|
2010-12-23 20:20:51 +00:00
|
|
|
SRC_LIST += src/utils/SkEGLContext_none.cpp
|
2009-01-22 13:41:08 +00:00
|
|
|
# these are our registry-based factories
|
|
|
|
SRC_LIST += src/images/SkImageDecoder_Factory.cpp
|
|
|
|
SRC_LIST += src/images/SkImageEncoder_Factory.cpp
|
2010-04-15 14:28:24 +00:00
|
|
|
SRC_LIST += src/images/SkImageDecoder_libpng.cpp
|
2009-01-22 13:41:08 +00:00
|
|
|
# support files
|
|
|
|
SRC_LIST += src/images/SkScaledBitmapSampler.cpp
|
2011-04-04 17:13:52 +00:00
|
|
|
|
|
|
|
SRC_LIST += gpu/src/GrGLDefaultInterface_none.cpp
|
2009-01-21 03:15:13 +00:00
|
|
|
endif
|
|
|
|
|
2009-11-16 21:09:00 +00:00
|
|
|
# For these files, and these files only, compile with -msse2.
|
|
|
|
SSE2_OBJS := out/src/opts/SkBlitRow_opts_SSE2.o \
|
2010-12-16 19:07:45 +00:00
|
|
|
out/src/opts/SkBitmapProcState_opts_SSE2.o \
|
2009-11-16 21:09:00 +00:00
|
|
|
out/src/opts/SkUtils_opts_SSE2.o
|
|
|
|
$(SSE2_OBJS) : CFLAGS := $(CFLAGS_SSE2)
|
|
|
|
|
2009-01-16 16:15:37 +00:00
|
|
|
out/%.o : %.cpp
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(HIDE)$(CC) $(C_INCLUDES) $(CFLAGS) $(DEFINES) -c $< -o $@
|
|
|
|
@echo "compiling $@"
|
2011-01-05 15:50:27 +00:00
|
|
|
|
2009-10-30 18:50:23 +00:00
|
|
|
%.s : %.cpp
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(CC) $(C_INCLUDES) $(CFLAGS) $(DEFINES) -S -c $< -o $@
|
|
|
|
|
2009-01-16 16:15:37 +00:00
|
|
|
# now build out objects
|
|
|
|
OBJ_LIST := $(SRC_LIST:.cpp=.o)
|
|
|
|
OBJ_LIST := $(addprefix out/, $(OBJ_LIST))
|
|
|
|
|
2009-04-14 14:28:22 +00:00
|
|
|
# we want to compile these, but we don't actually link them
|
|
|
|
JUST_COMPILE_OBJS := $(JUST_COMPILE_LIST:.cpp=.o)
|
|
|
|
JUST_COMPILE_OBJS := $(addprefix out/, $(JUST_COMPILE_OBJS))
|
|
|
|
|
|
|
|
out/libskia.a: Makefile $(OBJ_LIST) $(JUST_COMPILE_OBJS)
|
2009-01-16 16:15:37 +00:00
|
|
|
$(HIDE)$(AR) ru $@ $(OBJ_LIST)
|
|
|
|
$(HIDE)ranlib $@
|
|
|
|
|
2009-02-28 18:26:14 +00:00
|
|
|
##############################################################################
|
|
|
|
|
2009-08-12 20:30:58 +00:00
|
|
|
BENCH_SRCS := RectBench.cpp SkBenchmark.cpp benchmain.cpp BitmapBench.cpp \
|
2010-04-15 16:34:54 +00:00
|
|
|
RepeatTileBench.cpp DecodeBench.cpp FPSBench.cpp
|
2010-12-20 18:32:39 +00:00
|
|
|
|
2009-01-16 16:15:37 +00:00
|
|
|
BENCH_SRCS := $(addprefix bench/, $(BENCH_SRCS))
|
2009-01-23 21:51:56 +00:00
|
|
|
|
2009-01-23 21:24:39 +00:00
|
|
|
# add any optional codecs for this app
|
2009-01-28 00:56:29 +00:00
|
|
|
ifeq ($(SKIA_BUILD_FOR),mac)
|
2009-04-08 05:03:52 +00:00
|
|
|
BENCH_SRCS += bench/TextBench.cpp
|
2009-01-28 00:56:29 +00:00
|
|
|
else
|
2009-01-27 18:25:02 +00:00
|
|
|
BENCH_SRCS += src/images/SkImageDecoder_libpng.cpp
|
2009-01-23 21:51:56 +00:00
|
|
|
endif
|
2009-01-23 21:24:39 +00:00
|
|
|
|
2009-01-16 16:15:37 +00:00
|
|
|
BENCH_OBJS := $(BENCH_SRCS:.cpp=.o)
|
|
|
|
BENCH_OBJS := $(addprefix out/, $(BENCH_OBJS))
|
|
|
|
|
|
|
|
bench: $(BENCH_OBJS) out/libskia.a
|
2009-01-21 03:15:13 +00:00
|
|
|
@echo "linking bench..."
|
2010-05-12 17:25:30 +00:00
|
|
|
$(HIDE)$(GPP) $(BENCH_OBJS) out/libskia.a -o out/bench/bench $(LINKER_OPTS)
|
2011-01-05 15:50:27 +00:00
|
|
|
|
2009-02-28 18:26:14 +00:00
|
|
|
##############################################################################
|
|
|
|
|
2009-03-04 14:02:44 +00:00
|
|
|
# we let tests cheat and see private headers, so we can unittest modules
|
|
|
|
C_INCLUDES += -Isrc/core
|
|
|
|
|
2009-06-05 16:21:03 +00:00
|
|
|
include tests/tests_files.mk
|
2011-03-08 18:33:31 +00:00
|
|
|
ifneq ($(SKIA_PDF_SUPPORT),false)
|
2010-09-24 22:25:30 +00:00
|
|
|
SOURCE += PDFPrimitivesTest.cpp
|
|
|
|
endif
|
2009-06-05 16:21:03 +00:00
|
|
|
TESTS_SRCS := $(addprefix tests/, $(SOURCE))
|
2009-02-28 18:26:14 +00:00
|
|
|
|
|
|
|
TESTS_OBJS := $(TESTS_SRCS:.cpp=.o)
|
|
|
|
TESTS_OBJS := $(addprefix out/, $(TESTS_OBJS))
|
|
|
|
|
|
|
|
tests: $(TESTS_OBJS) out/libskia.a
|
|
|
|
@echo "linking tests..."
|
2010-05-12 17:25:30 +00:00
|
|
|
$(HIDE)$(GPP) $(TESTS_OBJS) out/libskia.a -o out/tests/tests $(LINKER_OPTS)
|
2011-01-05 15:50:27 +00:00
|
|
|
|
2009-02-28 18:26:14 +00:00
|
|
|
##############################################################################
|
|
|
|
|
2009-04-24 19:52:53 +00:00
|
|
|
SKIMAGE_SRCS := skimage_main.cpp
|
|
|
|
|
|
|
|
SKIMAGE_SRCS := $(addprefix tools/, $(SKIMAGE_SRCS))
|
|
|
|
|
|
|
|
SKIMAGE_OBJS := $(SKIMAGE_SRCS:.cpp=.o)
|
|
|
|
SKIMAGE_OBJS := $(addprefix out/, $(SKIMAGE_OBJS))
|
|
|
|
|
|
|
|
skimage: $(SKIMAGE_OBJS) out/libskia.a
|
|
|
|
@echo "linking skimage..."
|
2010-05-12 17:25:30 +00:00
|
|
|
$(HIDE)$(GPP) $(SKIMAGE_OBJS) out/libskia.a -o out/tools/skimage $(LINKER_OPTS)
|
2009-04-24 19:52:53 +00:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
2010-04-12 14:27:37 +00:00
|
|
|
SKHELLO_SRCS := skhello.cpp
|
|
|
|
|
|
|
|
SKHELLO_SRCS := $(addprefix tools/, $(SKHELLO_SRCS))
|
|
|
|
|
|
|
|
SKHELLO_OBJS := $(SKHELLO_SRCS:.cpp=.o)
|
|
|
|
SKHELLO_OBJS := $(addprefix out/, $(SKHELLO_OBJS))
|
|
|
|
|
|
|
|
skhello: $(SKHELLO_OBJS) out/libskia.a
|
|
|
|
@echo "linking shkello..."
|
2010-05-12 17:25:30 +00:00
|
|
|
$(HIDE)$(GPP) $(SKHELLO_OBJS) out/libskia.a -o out/tools/skhello $(LINKER_OPTS)
|
2010-04-12 14:27:37 +00:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
2009-06-23 12:19:41 +00:00
|
|
|
include gm/gm_files.mk
|
|
|
|
GM_SRCS := $(addprefix gm/, $(SOURCE))
|
2009-06-20 02:38:16 +00:00
|
|
|
|
2009-10-30 18:50:23 +00:00
|
|
|
ifneq ($(SKIA_BUILD_FOR),mac)
|
|
|
|
GM_SRCS += src/images/SkImageDecoder_libpng.cpp
|
|
|
|
endif
|
|
|
|
|
2009-06-20 02:38:16 +00:00
|
|
|
GM_OBJS := $(GM_SRCS:.cpp=.o)
|
|
|
|
GM_OBJS := $(addprefix out/, $(GM_OBJS))
|
|
|
|
|
|
|
|
gm: $(GM_OBJS) out/libskia.a
|
|
|
|
@echo "linking gm..."
|
2010-12-23 20:20:51 +00:00
|
|
|
$(HIDE)$(GPP) $(GM_OBJS) out/libskia.a -o out/gm/gm $(LINKER_OPTS)
|
2009-06-20 02:38:16 +00:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
2009-06-23 17:13:30 +00:00
|
|
|
.PHONY: all
|
2010-04-12 14:27:37 +00:00
|
|
|
all: $ bench gm skimage tests skhello
|
2009-06-23 17:13:30 +00:00
|
|
|
|
2009-01-21 15:07:03 +00:00
|
|
|
.PHONY: clean
|
2009-01-16 16:15:37 +00:00
|
|
|
clean:
|
|
|
|
$(HIDE)rm -rf out
|
2009-01-21 15:07:03 +00:00
|
|
|
|
|
|
|
.PHONY: help
|
2009-01-21 03:15:13 +00:00
|
|
|
help:
|
|
|
|
@echo "Targets:"
|
|
|
|
@echo " <default>: out/libskia.a"
|
|
|
|
@echo " bench: out/bench/bench"
|
2009-06-20 02:38:16 +00:00
|
|
|
@echo " gm: out/gm/gm"
|
2009-04-24 19:52:53 +00:00
|
|
|
@echo " skimage: out/tools/skimage"
|
2010-04-12 14:27:37 +00:00
|
|
|
@echo " skhello: out/tools/skhello"
|
2009-02-28 18:26:14 +00:00
|
|
|
@echo " tests: out/tests/tests"
|
2009-01-21 03:15:13 +00:00
|
|
|
@echo " clean: removes entire out/ directory"
|
|
|
|
@echo " help: this text"
|
2009-01-21 15:07:03 +00:00
|
|
|
@echo "Options: (after make, or in bash shell)"
|
2009-01-21 03:15:13 +00:00
|
|
|
@echo " SKIA_DEBUG=true for debug build"
|
2009-01-21 15:07:03 +00:00
|
|
|
@echo " SKIA_SCALAR=fixed for fixed-point build"
|
|
|
|
@echo " SKIA_BUILD_FOR=mac for mac build (e.g. CG for image decoding)"
|
2011-03-08 18:33:31 +00:00
|
|
|
@echo " SKIA_PDF_SUPPORT=false to disable the pdf generation backend"
|
2009-01-21 03:15:13 +00:00
|
|
|
@echo ""
|