blob: baaabfa70b6fe08a8469acccea4c8b4c45810960 [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#
Thiago Farina4c93a122015-02-03 13:12:54 -020028# See https://skia.org 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 := \
mtklein970e1062014-08-29 07:55:34 -070043 nanobench \
epoger@google.com6714ea42012-10-25 16:32:07 +000044 debugger \
commit-bot@chromium.org7eb529f2014-04-24 18:16:13 +000045 dm \
epoger@google.com6714ea42012-10-25 16:32:07 +000046 everything \
epoger@google.com6714ea42012-10-25 16:32:07 +000047 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 \
commit-bot@chromium.orgbe19b9e2013-06-14 17:26:54 +000055 tools \
56 skpdiff
borenet@google.comdd3d08e2012-06-27 19:04:39 +000057
epoger@google.comc9493a42011-07-27 14:06:25 +000058# Default target. This must be listed before all other targets.
59.PHONY: default
epoger@google.com9c875d32012-10-18 16:10:56 +000060default: most
epoger@google.comc9493a42011-07-27 14:06:25 +000061
62# As noted in http://code.google.com/p/skia/issues/detail?id=330 , building
63# multiple targets in parallel was failing. The special .NOTPARALLEL target
epoger@google.com58d69d82014-04-01 07:02:41 +000064# tells gnu make not to run targets within this Makefile in parallel.
65# Targets that ninja builds at this Makefile's behest should not be affected.
epoger@google.comc9493a42011-07-27 14:06:25 +000066.NOTPARALLEL:
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000067
68uname := $(shell uname)
69ifneq (,$(findstring CYGWIN, $(uname)))
Thiago Farina4c93a122015-02-03 13:12:54 -020070 $(error Cannot build using Make on Windows. See https://skia.org/user/quick/windows)
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000071endif
72
epoger@google.com6714ea42012-10-25 16:32:07 +000073# If user requests "make all", chain to our explicitly-declared "everything"
74# target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp
75# automatically creates "all" target on some build flavors but not others")
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000076.PHONY: all
epoger@google.com6714ea42012-10-25 16:32:07 +000077all: everything
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000078
79.PHONY: clean
80clean:
81 rm -rf out xcodebuild
djsollen@google.comab5e9112012-11-28 14:11:41 +000082ifneq (out, $(SKIA_OUT))
83 rm -rf $(SKIA_OUT)
84endif
epoger@google.com5d2e4cc2011-06-22 19:17:28 +000085
epoger@google.comc9493a42011-07-27 14:06:25 +000086# Run gyp no matter what.
87.PHONY: gyp
88gyp:
89 $(CWD)/gyp_skia
90
epoger@google.comc9493a42011-07-27 14:06:25 +000091# For all specific targets: run gyp if necessary, and then pass control to
92# the gyp-generated buildfiles.
epoger@google.com6714ea42012-10-25 16:32:07 +000093.PHONY: $(VALID_TARGETS)
epoger@google.com58d69d82014-04-01 07:02:41 +000094$(VALID_TARGETS):: gyp
95 ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@