blob: f8ec87579f30226b8539fcc7c17d8d5f6bc10e22 [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)
mtkleine7ce26d2014-08-04 09:36:16 -070010# make dm
11# out/Debug/dm
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000012#
13# # Build and run tests (in Release mode)
mtkleine7ce26d2014-08-04 09:36:16 -070014# make dm BUILDTYPE=Release
15# out/Release/dm
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000016#
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 \
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) $@