OLD | NEW |
1 # Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows) | 1 # Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows) |
2 # Uses "make" to build on Unix, and "xcodebuild" to build on Mac. | 2 # Uses "ninja" to build the code. |
3 # | 3 # |
4 # Some usage examples (tested on both Linux and Mac): | 4 # Some usage examples (tested on both Linux and Mac): |
5 # | 5 # |
6 # # Clean everything | 6 # # Clean everything |
7 # make clean | 7 # make clean |
8 # | 8 # |
9 # # Build and run tests (in Debug mode) | 9 # # Build and run tests (in Debug mode) |
10 # make tests | 10 # make tests |
11 # out/Debug/tests | 11 # out/Debug/tests |
12 # | 12 # |
(...skipping 16 matching lines...) Expand all Loading... |
29 | 29 |
30 SKIA_OUT ?= out | 30 SKIA_OUT ?= out |
31 BUILDTYPE ?= Debug | 31 BUILDTYPE ?= Debug |
32 CWD := $(shell pwd) | 32 CWD := $(shell pwd) |
33 | 33 |
34 # Soon we should be able to get rid of VALID_TARGETS, and just pass control | 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. | 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. | 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 | 37 # Tracked as https://code.google.com/p/skia/issues/detail?id=947 ('eliminate |
38 # need for VALID_TARGETS in toplevel Makefile') | 38 # need for VALID_TARGETS in toplevel Makefile') |
| 39 # |
| 40 # TODO(epoger): I'm not sure if the above comment is still valid in a ninja |
| 41 # world. |
39 VALID_TARGETS := \ | 42 VALID_TARGETS := \ |
40 bench \ | 43 bench \ |
41 debugger \ | 44 debugger \ |
42 everything \ | 45 everything \ |
43 gm \ | 46 gm \ |
44 most \ | 47 most \ |
45 pathops_unittest \ | 48 pathops_unittest \ |
46 pdfviewer \ | 49 pdfviewer \ |
47 SampleApp \ | 50 SampleApp \ |
48 SampleApp_APK \ | 51 SampleApp_APK \ |
49 skhello \ | 52 skhello \ |
50 skia_lib \ | 53 skia_lib \ |
51 skpskgr_test \ | 54 skpskgr_test \ |
52 tests \ | 55 tests \ |
53 tools \ | 56 tools \ |
54 skpdiff | 57 skpdiff |
55 | 58 |
56 # Default target. This must be listed before all other targets. | 59 # Default target. This must be listed before all other targets. |
57 .PHONY: default | 60 .PHONY: default |
58 default: most | 61 default: most |
59 | 62 |
60 # As noted in http://code.google.com/p/skia/issues/detail?id=330 , building | 63 # As noted in http://code.google.com/p/skia/issues/detail?id=330 , building |
61 # multiple targets in parallel was failing. The special .NOTPARALLEL target | 64 # multiple targets in parallel was failing. The special .NOTPARALLEL target |
62 # tells gnu make not to run targets within _this_ Makefile in parallel, but the | 65 # tells gnu make not to run targets within this Makefile in parallel. |
63 # recursively invoked Makefile within out/ _is_ allowed to run in parallel | 66 # Targets that ninja builds at this Makefile's behest should not be affected. |
64 # (so you can still get some speedup that way). | |
65 .NOTPARALLEL: | 67 .NOTPARALLEL: |
66 | 68 |
67 uname := $(shell uname) | 69 uname := $(shell uname) |
68 ifneq (,$(findstring CYGWIN, $(uname))) | 70 ifneq (,$(findstring CYGWIN, $(uname))) |
69 $(error Cannot build using Make on Windows. See https://sites.google.com/site/
skiadocs/user-documentation/quick-start-guides/windows) | 71 $(error Cannot build using Make on Windows. See https://sites.google.com/site/
skiadocs/user-documentation/quick-start-guides/windows) |
70 endif | 72 endif |
71 | 73 |
72 # If user requests "make all", chain to our explicitly-declared "everything" | 74 # If user requests "make all", chain to our explicitly-declared "everything" |
73 # target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp | 75 # target. See https://code.google.com/p/skia/issues/detail?id=932 ("gyp |
74 # automatically creates "all" target on some build flavors but not others") | 76 # automatically creates "all" target on some build flavors but not others") |
75 .PHONY: all | 77 .PHONY: all |
76 all: everything | 78 all: everything |
77 | 79 |
78 .PHONY: clean | 80 .PHONY: clean |
79 clean: | 81 clean: |
80 rm -rf out xcodebuild | 82 rm -rf out xcodebuild |
81 ifneq (out, $(SKIA_OUT)) | 83 ifneq (out, $(SKIA_OUT)) |
82 rm -rf $(SKIA_OUT) | 84 rm -rf $(SKIA_OUT) |
83 endif | 85 endif |
84 | 86 |
85 # Run gyp no matter what. | 87 # Run gyp no matter what. |
86 .PHONY: gyp | 88 .PHONY: gyp |
87 gyp: | 89 gyp: |
88 $(CWD)/gyp_skia | 90 $(CWD)/gyp_skia |
89 | 91 |
90 # Run gyp if necessary. | |
91 # | |
92 # On Linux, only run gyp if we haven't already generated the platform-specific | |
93 # Makefiles. If the underlying gyp configuration has changed since these | |
94 # Makefiles were generated, they will rerun gyp on their own. | |
95 # | |
96 # This does not work for Mac, though... so for now, we ALWAYS rerun gyp on Mac. | |
97 # TODO(epoger): Figure out a better solution for Mac... maybe compare the | |
98 # gypfile timestamps to the xcodebuild project timestamps? | |
99 .PHONY: gyp_if_needed | |
100 gyp_if_needed: | |
101 ifneq (,$(findstring Linux, $(uname))) | |
102 $(MAKE) $(SKIA_OUT)/Makefile | |
103 endif | |
104 ifneq (,$(findstring Darwin, $(uname))) | |
105 $(CWD)/gyp_skia | |
106 endif | |
107 | |
108 $(SKIA_OUT)/Makefile: | |
109 $(CWD)/gyp_skia | |
110 | |
111 # For all specific targets: run gyp if necessary, and then pass control to | 92 # For all specific targets: run gyp if necessary, and then pass control to |
112 # the gyp-generated buildfiles. | 93 # the gyp-generated buildfiles. |
113 # | |
114 # For the Mac, we create a convenience symlink to the generated binary. | |
115 .PHONY: $(VALID_TARGETS) | 94 .PHONY: $(VALID_TARGETS) |
116 $(VALID_TARGETS):: gyp_if_needed | 95 $(VALID_TARGETS):: gyp |
117 ifneq (,$(findstring skia_os=android, $(GYP_DEFINES))) | 96 » ninja -C $(SKIA_OUT)/$(BUILDTYPE) $@ |
118 » $(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE) | |
119 else ifneq (,$(findstring Linux, $(uname))) | |
120 » $(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE) | |
121 else ifneq (,$(findstring make, $(GYP_GENERATORS))) | |
122 » $(MAKE) -C $(SKIA_OUT) $@ BUILDTYPE=$(BUILDTYPE) | |
123 else ifneq (,$(findstring Darwin, $(uname))) | |
124 » rm -f out/$(BUILDTYPE) || if test -d out/$(BUILDTYPE); then echo "run 'm
ake clean' or otherwise delete out/$(BUILDTYPE)"; exit 1; fi | |
125 » xcodebuild -project out/gyp/$@.xcodeproj -configuration $(BUILDTYPE) | |
126 » ln -s $(CWD)/xcodebuild/$(BUILDTYPE) out/$(BUILDTYPE) | |
127 else | |
128 » echo "unknown platform $(uname)" | |
129 » exit 1 | |
130 endif | |
OLD | NEW |