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
|
2009-01-16 16:15:37 +00:00
|
|
|
C_INCLUDES := -Iinclude/core -Iinclude/effects -Iinclude/images -Iinclude/utils
|
2009-03-20 04:59:37 +00:00
|
|
|
CFLAGS := -Wall # -O2
|
2009-01-21 03:15:13 +00:00
|
|
|
LINKER_OPTS := -lpthread
|
|
|
|
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)
|
|
|
|
DEFINES += -DSK_DEBUG -DSK_SUPPORT_UNIT
|
|
|
|
else
|
|
|
|
DEFINES += -DSK_RELEASE
|
|
|
|
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))
|
|
|
|
|
|
|
|
# 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))
|
|
|
|
|
|
|
|
# conditional files based on our platform
|
2009-01-21 15:07:03 +00:00
|
|
|
ifeq ($(SKIA_BUILD_FOR),mac)
|
2009-01-21 03:15:13 +00:00
|
|
|
LINKER_OPTS += -framework Carbon
|
|
|
|
DEFINES += -DSK_BUILD_FOR_MAC
|
|
|
|
|
|
|
|
C_INCLUDES += -Iinclude/utils/mac
|
|
|
|
SRC_LIST += src/ports/SkImageDecoder_CG.cpp
|
|
|
|
SRC_LIST += src/utils/mac/SkCreateCGImageRef.cpp
|
2009-01-28 00:56:29 +00:00
|
|
|
SRC_LIST += src/ports/SkFontHost_mac.cpp
|
2009-01-21 03:15:13 +00:00
|
|
|
else
|
2009-01-23 21:24:39 +00:00
|
|
|
LINKER_OPTS += -lpng
|
2009-01-21 03:15:13 +00:00
|
|
|
DEFINES += -DSK_BUILD_FOR_UNIX
|
|
|
|
|
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
|
|
|
|
# support files
|
|
|
|
SRC_LIST += src/images/SkScaledBitmapSampler.cpp
|
2009-01-21 03:15:13 +00:00
|
|
|
endif
|
|
|
|
|
2009-01-16 16:15:37 +00:00
|
|
|
out/%.o : %.cpp
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(HIDE)$(CC) $(C_INCLUDES) $(CFLAGS) $(DEFINES) -c $< -o $@
|
|
|
|
@echo "compiling $@"
|
|
|
|
|
|
|
|
# now build out objects
|
|
|
|
OBJ_LIST := $(SRC_LIST:.cpp=.o)
|
|
|
|
OBJ_LIST := $(addprefix out/, $(OBJ_LIST))
|
|
|
|
|
|
|
|
out/libskia.a: Makefile $(OBJ_LIST)
|
|
|
|
$(HIDE)$(AR) ru $@ $(OBJ_LIST)
|
|
|
|
$(HIDE)ranlib $@
|
|
|
|
|
2009-02-28 18:26:14 +00:00
|
|
|
##############################################################################
|
|
|
|
|
2009-04-01 18:38:43 +00:00
|
|
|
BENCH_SRCS := RectBench.cpp SkBenchmark.cpp benchmain.cpp BitmapBench.cpp
|
2009-01-16 16:15:37 +00:00
|
|
|
BENCH_SRCS := $(addprefix bench/, $(BENCH_SRCS))
|
2009-01-23 21:51:56 +00:00
|
|
|
|
2009-03-31 03:48:49 +00:00
|
|
|
BENCH_SRCS += src/effects/SkNWayCanvas.cpp
|
|
|
|
|
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)
|
|
|
|
# BENCH_SRCS += bench/TextBench.cpp
|
|
|
|
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..."
|
|
|
|
$(HIDE)g++ $(BENCH_OBJS) out/libskia.a -o out/bench/bench $(LINKER_OPTS)
|
2009-01-16 16:15:37 +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-02-28 18:26:14 +00:00
|
|
|
TESTS_SRCS := GeometryTest.cpp MathTest.cpp MatrixTest.cpp PackBitsTest.cpp \
|
2009-03-02 05:36:20 +00:00
|
|
|
Sk64Test.cpp StringTest.cpp Test.cpp UtilsTest.cpp PathTest.cpp \
|
2009-03-07 03:39:23 +00:00
|
|
|
ClipCubicTest.cpp SrcOverTest.cpp StreamTest.cpp SortTest.cpp \
|
2009-04-01 20:26:42 +00:00
|
|
|
PathMeasureTest.cpp TriangulationTest.cpp \
|
|
|
|
testmain.cpp
|
2009-03-03 18:35:18 +00:00
|
|
|
|
2009-02-28 18:26:14 +00:00
|
|
|
TESTS_SRCS := $(addprefix tests/, $(TESTS_SRCS))
|
|
|
|
|
|
|
|
TESTS_OBJS := $(TESTS_SRCS:.cpp=.o)
|
|
|
|
TESTS_OBJS := $(addprefix out/, $(TESTS_OBJS))
|
|
|
|
|
|
|
|
tests: $(TESTS_OBJS) out/libskia.a
|
|
|
|
@echo "linking tests..."
|
|
|
|
$(HIDE)g++ $(TESTS_OBJS) out/libskia.a -o out/tests/tests $(LINKER_OPTS)
|
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
|
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-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)"
|
2009-01-21 03:15:13 +00:00
|
|
|
@echo ""
|