2011-06-22 19:17:28 +00:00
|
|
|
# Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows)
|
|
|
|
# Uses "make" to build on Unix, and "xcodebuild" to build on Mac.
|
|
|
|
#
|
|
|
|
# Some usage examples (tested on both Linux and Mac):
|
|
|
|
#
|
|
|
|
# # Clean everything
|
|
|
|
# make clean
|
|
|
|
#
|
|
|
|
# # Build and run tests (in Debug mode)
|
|
|
|
# make tests
|
|
|
|
# out/Debug/tests
|
|
|
|
#
|
|
|
|
# # Build and run tests (in Release mode)
|
|
|
|
# make tests BUILDTYPE=Release
|
|
|
|
# out/Release/tests
|
|
|
|
#
|
|
|
|
# # Build bench and SampleApp (both in Release mode), and then run them
|
|
|
|
# make SampleApp bench BUILDTYPE=Release
|
|
|
|
# out/Release/bench -repeat 2
|
|
|
|
# out/Release/SampleApp
|
|
|
|
#
|
|
|
|
# # Build all targets (in Debug mode)
|
|
|
|
# make
|
|
|
|
#
|
|
|
|
# If you want more fine-grained control, you can run gyp and then build the
|
|
|
|
# gyp-generated projects yourself.
|
|
|
|
#
|
2012-10-25 16:32:07 +00:00
|
|
|
# See https://sites.google.com/site/skiadocs/ for complete documentation.
|
2011-06-22 19:17:28 +00:00
|
|
|
|
2012-11-28 14:11:41 +00:00
|
|
|
SKIA_OUT ?= out
|
2011-06-22 19:17:28 +00:00
|
|
|
BUILDTYPE ?= Debug
|
|
|
|
CWD := $(shell pwd)
|
2011-07-27 14:06:25 +00:00
|
|
|
|
2012-10-25 16:32:07 +00:00
|
|
|
# Soon we should be able to get rid of VALID_TARGETS, and just pass control
|
|
|
|
# to the gyp-generated Makefile for *any* target name.
|
|
|
|
# But that will be a bit complicated, so let's keep it for a future CL.
|
|
|
|
# Tracked as https://code.google.com/p/skia/issues/detail?id=947 ('eliminate
|
|
|
|
# need for VALID_TARGETS in toplevel Makefile')
|
|
|
|
VALID_TARGETS := \
|
|
|
|
bench \
|
|
|
|
debugger \
|
|
|
|
everything \
|
|
|
|
gm \
|
|
|
|
most \
|
2013-04-11 14:09:50 +00:00
|
|
|
pathops_unittest \
|
2012-10-25 16:32:07 +00:00
|
|
|
SampleApp \
|
|
|
|
SkiaAndroidApp \
|
2013-05-31 20:09:47 +00:00
|
|
|
skia_base_libs \
|
2012-10-25 16:32:07 +00:00
|
|
|
tests \
|
|
|
|
tools
|
2012-06-27 19:04:39 +00:00
|
|
|
|
2011-07-27 14:06:25 +00:00
|
|
|
# Default target. This must be listed before all other targets.
|
|
|
|
.PHONY: default
|
2012-10-18 16:10:56 +00:00
|
|
|
default: most
|
2011-07-27 14:06:25 +00:00
|
|
|
|
|
|
|
# As noted in http://code.google.com/p/skia/issues/detail?id=330 , building
|
|
|
|
# multiple targets in parallel was failing. The special .NOTPARALLEL target
|
|
|
|
# tells gnu make not to run targets within _this_ Makefile in parallel, but the
|
|
|
|
# recursively invoked Makefile within out/ _is_ allowed to run in parallel
|
|
|
|
# (so you can still get some speedup that way).
|
|
|
|
.NOTPARALLEL:
|
2011-06-22 19:17:28 +00:00
|
|
|
|
|
|
|
uname := $(shell uname)
|
|
|
|
ifneq (,$(findstring CYGWIN, $(uname)))
|
2012-10-25 16:32:07 +00:00
|
|
|
$(error Cannot build using Make on Windows. See https://sites.google.com/site/skiadocs/user-documentation/quick-start-guides/windows)
|
2011-06-22 19:17:28 +00:00
|
|
|
endif
|
|
|
|
|
2012-10-25 16:32:07 +00:00
|
|
|
# If user requests "make all", chain to our explicitly-declared "everything"
|
|
|
|
# target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp
|
|
|
|
# automatically creates "all" target on some build flavors but not others")
|
2011-06-22 19:17:28 +00:00
|
|
|
.PHONY: all
|
2012-10-25 16:32:07 +00:00
|
|
|
all: everything
|
2011-06-22 19:17:28 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf out xcodebuild
|
2012-11-28 14:11:41 +00:00
|
|
|
ifneq (out, $(SKIA_OUT))
|
|
|
|
rm -rf $(SKIA_OUT)
|
|
|
|
endif
|
2011-06-22 19:17:28 +00:00
|
|
|
|
2011-07-27 14:06:25 +00:00
|
|
|
# Run gyp no matter what.
|
|
|
|
.PHONY: gyp
|
|
|
|
gyp:
|
2011-07-14 17:31:33 +00:00
|
|
|
$(CWD)/gyp_skia
|
2011-07-27 14:06:25 +00:00
|
|
|
|
|
|
|
# Run gyp if necessary.
|
|
|
|
#
|
|
|
|
# On Linux, only run gyp if we haven't already generated the platform-specific
|
|
|
|
# Makefiles. If the underlying gyp configuration has changed since these
|
|
|
|
# Makefiles were generated, they will rerun gyp on their own.
|
|
|
|
#
|
|
|
|
# This does not work for Mac, though... so for now, we ALWAYS rerun gyp on Mac.
|
|
|
|
# TODO(epoger): Figure out a better solution for Mac... maybe compare the
|
|
|
|
# gypfile timestamps to the xcodebuild project timestamps?
|
|
|
|
.PHONY: gyp_if_needed
|
|
|
|
gyp_if_needed:
|
2011-06-22 19:17:28 +00:00
|
|
|
ifneq (,$(findstring Linux, $(uname)))
|
2012-11-28 14:11:41 +00:00
|
|
|
$(MAKE) $(SKIA_OUT)/Makefile
|
2011-06-22 19:17:28 +00:00
|
|
|
endif
|
|
|
|
ifneq (,$(findstring Darwin, $(uname)))
|
2011-07-27 14:06:25 +00:00
|
|
|
$(CWD)/gyp_skia
|
2011-06-22 19:17:28 +00:00
|
|
|
endif
|
|
|
|
|
2012-11-28 14:11:41 +00:00
|
|
|
$(SKIA_OUT)/Makefile:
|
2011-07-14 17:31:33 +00:00
|
|
|
$(CWD)/gyp_skia
|
2011-07-27 14:06:25 +00:00
|
|
|
|
|
|
|
# For all specific targets: run gyp if necessary, and then pass control to
|
|
|
|
# the gyp-generated buildfiles.
|
|
|
|
#
|
|
|
|
# For the Mac, we create a convenience symlink to the generated binary.
|
2012-10-25 16:32:07 +00:00
|
|
|
.PHONY: $(VALID_TARGETS)
|
|
|
|
$(VALID_TARGETS):: gyp_if_needed
|
2012-06-05 17:57:48 +00:00
|
|
|
ifneq (,$(findstring skia_os=android, $(GYP_DEFINES)))
|
2012-11-28 14:11:41 +00:00
|
|
|
$(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
|
2012-06-05 17:57:48 +00:00
|
|
|
else ifneq (,$(findstring Linux, $(uname)))
|
2012-11-28 14:11:41 +00:00
|
|
|
$(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
|
|
|
|
else ifneq (,$(findstring make, $(GYP_GENERATORS)))
|
|
|
|
$(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE)
|
2012-06-05 17:57:48 +00:00
|
|
|
else ifneq (,$(findstring Darwin, $(uname)))
|
2011-08-15 19:22:39 +00:00
|
|
|
rm -f out/$(BUILDTYPE) || if test -d out/$(BUILDTYPE); then echo "run 'make clean' or otherwise delete out/$(BUILDTYPE)"; exit 1; fi
|
2011-06-22 19:17:28 +00:00
|
|
|
xcodebuild -project out/gyp/$@.xcodeproj -configuration $(BUILDTYPE)
|
2011-08-15 19:22:39 +00:00
|
|
|
ln -s $(CWD)/xcodebuild/$(BUILDTYPE) out/$(BUILDTYPE)
|
2012-06-05 17:57:48 +00:00
|
|
|
else
|
|
|
|
echo "unknown platform $(uname)"
|
|
|
|
exit 1
|
2012-06-29 14:34:58 +00:00
|
|
|
endif
|