blob: a51d6da14a30535b3ceb38cf851d133cbb8d3209 [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 \
45 everything \
46 gm \
47 most \
caryclark@google.com3e475dc2013-04-11 14:09:50 +000048 pathops_unittest \
edisonn@google.com01cd4d52013-06-10 20:44:45 +000049 pdfviewer \
epoger@google.com6714ea42012-10-25 16:32:07 +000050 SampleApp \
djsollen@google.comcc95b1a2013-08-12 12:30:04 +000051 SampleApp_APK \
borenet@google.combb522882013-06-17 15:39:43 +000052 skhello \
djsollen@google.com52f02972013-06-03 12:10:19 +000053 skia_lib \
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +000054 skpskgr_test \
epoger@google.com6714ea42012-10-25 16:32:07 +000055 tests \
commit-bot@chromium.orgbe19b9e2013-06-14 17:26:54 +000056 tools \
57 skpdiff
borenet@google.comdd3d08e2012-06-27 19:04:39 +000058
epoger@google.comc9493a42011-07-27 14:06:25 +000059# Default target. This must be listed before all other targets.
60.PHONY: default
epoger@google.com9c875d32012-10-18 16:10:56 +000061default: most
epoger@google.comc9493a42011-07-27 14:06:25 +000062
63# As noted in http://code.google.com/p/skia/issues/detail?id=330 , building
64# multiple targets in parallel was failing. The special .NOTPARALLEL target
epoger@google.com58d69d82014-04-01 07:02:41 +000065# tells gnu make not to run targets within this Makefile in parallel.
66# Targets that ninja builds at this Makefile's behest should not be affected.
epoger@google.comc9493a42011-07-27 14:06:25 +000067.NOTPARALLEL:
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000068
69uname := $(shell uname)
70ifneq (,$(findstring CYGWIN, $(uname)))
epoger@google.com6714ea42012-10-25 16:32:07 +000071 $(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 +000072endif
73
epoger@google.com6714ea42012-10-25 16:32:07 +000074# If user requests "make all", chain to our explicitly-declared "everything"
75# target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp
76# automatically creates "all" target on some build flavors but not others")
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000077.PHONY: all
epoger@google.com6714ea42012-10-25 16:32:07 +000078all: everything
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000079
80.PHONY: clean
81clean:
82 rm -rf out xcodebuild
djsollen@google.comab5e9112012-11-28 14:11:41 +000083ifneq (out, $(SKIA_OUT))
84 rm -rf $(SKIA_OUT)
85endif
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000086
epoger@google.comc9493a42011-07-27 14:06:25 +000087# Run gyp no matter what.
88.PHONY: gyp
89gyp:
90 $(CWD)/gyp_skia
91
epoger@google.comc9493a42011-07-27 14:06:25 +000092# For all specific targets: run gyp if necessary, and then pass control to
93# the gyp-generated buildfiles.
epoger@google.com6714ea42012-10-25 16:32:07 +000094.PHONY: $(VALID_TARGETS)
epoger@google.com58d69d82014-04-01 07:02:41 +000095$(VALID_TARGETS):: gyp
96 ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@