epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 1 | # Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows) |
epoger@google.com | 58d69d8 | 2014-04-01 07:02:41 +0000 | [diff] [blame] | 2 | # Uses "ninja" to build the code. |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 3 | # |
| 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) |
mtklein | e7ce26d | 2014-08-04 09:36:16 -0700 | [diff] [blame] | 10 | # make dm |
| 11 | # out/Debug/dm |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 12 | # |
| 13 | # # Build and run tests (in Release mode) |
mtklein | e7ce26d | 2014-08-04 09:36:16 -0700 | [diff] [blame] | 14 | # make dm BUILDTYPE=Release |
| 15 | # out/Release/dm |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 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 | # |
Thiago Farina | 4c93a12 | 2015-02-03 13:12:54 -0200 | [diff] [blame] | 28 | # See https://skia.org for complete documentation. |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 29 | |
djsollen@google.com | ab5e911 | 2012-11-28 14:11:41 +0000 | [diff] [blame] | 30 | SKIA_OUT ?= out |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 31 | BUILDTYPE ?= Debug |
| 32 | CWD := $(shell pwd) |
epoger@google.com | c9493a4 | 2011-07-27 14:06:25 +0000 | [diff] [blame] | 33 | |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 34 | # 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.com | 58d69d8 | 2014-04-01 07:02:41 +0000 | [diff] [blame] | 39 | # |
| 40 | # TODO(epoger): I'm not sure if the above comment is still valid in a ninja |
| 41 | # world. |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 42 | VALID_TARGETS := \ |
mtklein | 970e106 | 2014-08-29 07:55:34 -0700 | [diff] [blame] | 43 | nanobench \ |
joshualitt | 31d46df | 2015-12-18 08:05:06 -0800 | [diff] [blame] | 44 | visualbench \ |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 45 | debugger \ |
commit-bot@chromium.org | 7eb529f | 2014-04-24 18:16:13 +0000 | [diff] [blame] | 46 | dm \ |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 47 | everything \ |
borenet | 93558dc | 2015-06-25 07:47:40 -0700 | [diff] [blame] | 48 | lua_app \ |
| 49 | lua_pictures \ |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 50 | most \ |
caryclark@google.com | 3e475dc | 2013-04-11 14:09:50 +0000 | [diff] [blame] | 51 | pathops_unittest \ |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 52 | SampleApp \ |
djsollen@google.com | cc95b1a | 2013-08-12 12:30:04 +0000 | [diff] [blame] | 53 | SampleApp_APK \ |
borenet@google.com | bb52288 | 2013-06-17 15:39:43 +0000 | [diff] [blame] | 54 | skhello \ |
djsollen@google.com | 52f0297 | 2013-06-03 12:10:19 +0000 | [diff] [blame] | 55 | skia_lib \ |
caryclark@google.com | a2bbc6e | 2013-11-01 17:36:03 +0000 | [diff] [blame] | 56 | skpskgr_test \ |
commit-bot@chromium.org | be19b9e | 2013-06-14 17:26:54 +0000 | [diff] [blame] | 57 | tools \ |
| 58 | skpdiff |
borenet@google.com | dd3d08e | 2012-06-27 19:04:39 +0000 | [diff] [blame] | 59 | |
epoger@google.com | c9493a4 | 2011-07-27 14:06:25 +0000 | [diff] [blame] | 60 | # Default target. This must be listed before all other targets. |
| 61 | .PHONY: default |
epoger@google.com | 9c875d3 | 2012-10-18 16:10:56 +0000 | [diff] [blame] | 62 | default: most |
epoger@google.com | c9493a4 | 2011-07-27 14:06:25 +0000 | [diff] [blame] | 63 | |
| 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.com | 58d69d8 | 2014-04-01 07:02:41 +0000 | [diff] [blame] | 66 | # 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.com | c9493a4 | 2011-07-27 14:06:25 +0000 | [diff] [blame] | 68 | .NOTPARALLEL: |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 69 | |
| 70 | uname := $(shell uname) |
| 71 | ifneq (,$(findstring CYGWIN, $(uname))) |
Thiago Farina | 4c93a12 | 2015-02-03 13:12:54 -0200 | [diff] [blame] | 72 | $(error Cannot build using Make on Windows. See https://skia.org/user/quick/windows) |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 73 | endif |
| 74 | |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 75 | # 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.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 78 | .PHONY: all |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 79 | all: everything |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 80 | |
| 81 | .PHONY: clean |
| 82 | clean: |
| 83 | rm -rf out xcodebuild |
djsollen@google.com | ab5e911 | 2012-11-28 14:11:41 +0000 | [diff] [blame] | 84 | ifneq (out, $(SKIA_OUT)) |
| 85 | rm -rf $(SKIA_OUT) |
| 86 | endif |
epoger@google.com | 5d2e4cc | 2011-06-22 19:17:28 +0000 | [diff] [blame] | 87 | |
epoger@google.com | c9493a4 | 2011-07-27 14:06:25 +0000 | [diff] [blame] | 88 | # Run gyp no matter what. |
| 89 | .PHONY: gyp |
| 90 | gyp: |
borenet | 3ebb16d | 2015-03-03 06:05:56 -0800 | [diff] [blame] | 91 | $(CWD)/gyp_skia --no-parallel -G config=$(BUILDTYPE) |
epoger@google.com | c9493a4 | 2011-07-27 14:06:25 +0000 | [diff] [blame] | 92 | |
epoger@google.com | c9493a4 | 2011-07-27 14:06:25 +0000 | [diff] [blame] | 93 | # For all specific targets: run gyp if necessary, and then pass control to |
| 94 | # the gyp-generated buildfiles. |
epoger@google.com | 6714ea4 | 2012-10-25 16:32:07 +0000 | [diff] [blame] | 95 | .PHONY: $(VALID_TARGETS) |
epoger@google.com | 58d69d8 | 2014-04-01 07:02:41 +0000 | [diff] [blame] | 96 | $(VALID_TARGETS):: gyp |
| 97 | ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@ |