blob: 2a24155962f56b4dd7dd7c424967528c8f00ec48 [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 \
joshualitt31d46df2015-12-18 08:05:06 -080044 visualbench \
epoger@google.com6714ea42012-10-25 16:32:07 +000045 debugger \
commit-bot@chromium.org7eb529f2014-04-24 18:16:13 +000046 dm \
epoger@google.com6714ea42012-10-25 16:32:07 +000047 everything \
borenet93558dc2015-06-25 07:47:40 -070048 lua_app \
49 lua_pictures \
epoger@google.com6714ea42012-10-25 16:32:07 +000050 most \
caryclark@google.com3e475dc2013-04-11 14:09:50 +000051 pathops_unittest \
epoger@google.com6714ea42012-10-25 16:32:07 +000052 SampleApp \
djsollen@google.comcc95b1a2013-08-12 12:30:04 +000053 SampleApp_APK \
borenet@google.combb522882013-06-17 15:39:43 +000054 skhello \
djsollen@google.com52f02972013-06-03 12:10:19 +000055 skia_lib \
caryclark@google.coma2bbc6e2013-11-01 17:36:03 +000056 skpskgr_test \
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)))
Thiago Farina4c93a122015-02-03 13:12:54 -020072 $(error Cannot build using Make on Windows. See https://skia.org/user/quick/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:
borenet3ebb16d2015-03-03 06:05:56 -080091 $(CWD)/gyp_skia --no-parallel -G config=$(BUILDTYPE)
epoger@google.comc9493a42011-07-27 14:06:25 +000092
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) $@