blob: 1b15a74c2a4a0e38945416fefe0a5a9c239f480d [file] [log] [blame]
epoger@google.com5d2e4cc2011-06-22 19:17:28 +00001# Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows)
epoger@google.com58d69d82014-04-01 07:02:41 +00002# Uses "ninja" to build the code.
epoger@google.com5d2e4cc2011-06-22 19:17:28 +00003#
4# Some usage examples (tested on both Linux and Mac):
5#
6# # Clean everything
7# make clean
8#
9# # Build and run tests (in Debug mode)
10# make tests
11# out/Debug/tests
12#
13# # Build and run tests (in Release mode)
14# make tests BUILDTYPE=Release
15# out/Release/tests
16#
17# # Build bench and SampleApp (both in Release mode), and then run them
18# make SampleApp bench BUILDTYPE=Release
19# out/Release/bench -repeat 2
20# out/Release/SampleApp
21#
22# # Build all targets (in Debug mode)
23# make
24#
25# If you want more fine-grained control, you can run gyp and then build the
26# gyp-generated projects yourself.
27#
epoger@google.com6714ea42012-10-25 16:32:07 +000028# See https://sites.google.com/site/skiadocs/ for complete documentation.
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000029
djsollen@google.comab5e9112012-11-28 14:11:41 +000030SKIA_OUT ?= out
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000031BUILDTYPE ?= Debug
32CWD := $(shell pwd)
epoger@google.comc9493a42011-07-27 14:06:25 +000033
epoger@google.com6714ea42012-10-25 16:32:07 +000034# Soon we should be able to get rid of VALID_TARGETS, and just pass control
35# to the gyp-generated Makefile for *any* target name.
36# But that will be a bit complicated, so let's keep it for a future CL.
37# Tracked as https://code.google.com/p/skia/issues/detail?id=947 ('eliminate
38# need for VALID_TARGETS in toplevel Makefile')
epoger@google.com58d69d82014-04-01 07:02:41 +000039#
40# TODO(epoger): I'm not sure if the above comment is still valid in a ninja
41# world.
epoger@google.com6714ea42012-10-25 16:32:07 +000042VALID_TARGETS := \
43 bench \
44 debugger \
commit-bot@chromium.org7eb529f2014-04-24 18:16:13 +000045 dm \
epoger@google.com6714ea42012-10-25 16:32:07 +000046 everything \
47 gm \
48 most \
caryclark@google.com3e475dc2013-04-11 14:09:50 +000049 pathops_unittest \
edisonn@google.com01cd4d52013-06-10 20:44:45 +000050 pdfviewer \
epoger@google.com6714ea42012-10-25 16:32:07 +000051 SampleApp \
djsollen@google.comcc95b1a2013-08-12 12:30:04 +000052 SampleApp_APK \
borenet@google.combb522882013-06-17 15:39:43 +000053 skhello \
djsollen@google.com52f02972013-06-03 12:10:19 +000054 skia_lib \
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +000055 skpskgr_test \
epoger@google.com6714ea42012-10-25 16:32:07 +000056 tests \
commit-bot@chromium.orgbe19b9e2013-06-14 17:26:54 +000057 tools \
58 skpdiff
borenet@google.comdd3d08e2012-06-27 19:04:39 +000059
epoger@google.comc9493a42011-07-27 14:06:25 +000060# Default target. This must be listed before all other targets.
61.PHONY: default
epoger@google.com9c875d32012-10-18 16:10:56 +000062default: most
epoger@google.comc9493a42011-07-27 14:06:25 +000063
64# As noted in http://code.google.com/p/skia/issues/detail?id=330 , building
65# multiple targets in parallel was failing. The special .NOTPARALLEL target
epoger@google.com58d69d82014-04-01 07:02:41 +000066# tells gnu make not to run targets within this Makefile in parallel.
67# Targets that ninja builds at this Makefile's behest should not be affected.
epoger@google.comc9493a42011-07-27 14:06:25 +000068.NOTPARALLEL:
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000069
70uname := $(shell uname)
71ifneq (,$(findstring CYGWIN, $(uname)))
epoger@google.com6714ea42012-10-25 16:32:07 +000072 $(error Cannot build using Make on Windows. See https://sites.google.com/site/skiadocs/user-documentation/quick-start-guides/windows)
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000073endif
74
epoger@google.com6714ea42012-10-25 16:32:07 +000075# If user requests "make all", chain to our explicitly-declared "everything"
76# target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp
77# automatically creates "all" target on some build flavors but not others")
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000078.PHONY: all
epoger@google.com6714ea42012-10-25 16:32:07 +000079all: everything
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000080
81.PHONY: clean
82clean:
83 rm -rf out xcodebuild
djsollen@google.comab5e9112012-11-28 14:11:41 +000084ifneq (out, $(SKIA_OUT))
85 rm -rf $(SKIA_OUT)
86endif
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000087
epoger@google.comc9493a42011-07-27 14:06:25 +000088# Run gyp no matter what.
89.PHONY: gyp
90gyp:
91 $(CWD)/gyp_skia
92
epoger@google.comc9493a42011-07-27 14:06:25 +000093# For all specific targets: run gyp if necessary, and then pass control to
94# the gyp-generated buildfiles.
epoger@google.com6714ea42012-10-25 16:32:07 +000095.PHONY: $(VALID_TARGETS)
epoger@google.com58d69d82014-04-01 07:02:41 +000096$(VALID_TARGETS):: gyp
97 ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@