aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 29831bb9efd420e1214d39f0cae87270c51dc5ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows)
# Uses "ninja" to build the code.
#
# Some usage examples (tested on both Linux and Mac):
#
#   # Clean everything
#   make clean
#
#   # Build and run tests (in Debug mode)
#   make dm
#   out/Debug/dm
#
#   # Build and run tests (in Release mode)
#   make dm BUILDTYPE=Release
#   out/Release/dm
#
#   # Build bench and SampleApp (both in Release mode), and then run them
#   make SampleApp bench BUILDTYPE=Release
#   out/Release/bench -repeat 2
#   out/Release/SampleApp
#
#   # Build all targets (in Debug mode)
#   make
#
# If you want more fine-grained control, you can run gyp and then build the
# gyp-generated projects yourself.
#
# See https://sites.google.com/site/skiadocs/ for complete documentation.

SKIA_OUT ?= out
BUILDTYPE ?= Debug
CWD := $(shell pwd)

# Soon we should be able to get rid of VALID_TARGETS, and just pass control
# to the gyp-generated Makefile for *any* target name.
# But that will be a bit complicated, so let's keep it for a future CL.
# Tracked as https://code.google.com/p/skia/issues/detail?id=947 ('eliminate
# need for VALID_TARGETS in toplevel Makefile')
#
# TODO(epoger): I'm not sure if the above comment is still valid in a ninja
# world.
VALID_TARGETS := \
                 nanobench \
                 debugger \
                 dm \
                 everything \
                 gm \
                 most \
                 pathops_unittest \
                 pdfviewer \
                 SampleApp \
                 SampleApp_APK \
                 skhello \
                 skia_lib \
                 skpskgr_test \
                 tools \
                 skpdiff

# Default target.  This must be listed before all other targets.
.PHONY: default
default: most

# As noted in http://code.google.com/p/skia/issues/detail?id=330 , building
# multiple targets in parallel was failing.  The special .NOTPARALLEL target
# tells gnu make not to run targets within this Makefile in parallel.
# Targets that ninja builds at this Makefile's behest should not be affected.
.NOTPARALLEL:

uname := $(shell uname)
ifneq (,$(findstring CYGWIN, $(uname)))
  $(error Cannot build using Make on Windows. See https://sites.google.com/site/skiadocs/user-documentation/quick-start-guides/windows)
endif

# If user requests "make all", chain to our explicitly-declared "everything"
# target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp
# automatically creates "all" target on some build flavors but not others")
.PHONY: all
all: everything

.PHONY: clean
clean:
	rm -rf out xcodebuild
ifneq (out, $(SKIA_OUT))
	rm -rf $(SKIA_OUT)
endif

# Run gyp no matter what.
.PHONY: gyp
gyp:
	$(CWD)/gyp_skia

# For all specific targets: run gyp if necessary, and then pass control to
# the gyp-generated buildfiles.
.PHONY: $(VALID_TARGETS)
$(VALID_TARGETS):: gyp
	ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@