aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-22 19:17:28 +0000
committerGravatar epoger@google.com <epoger@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-22 19:17:28 +0000
commit5d2e4cc165ede8cc5e08bf493839c0c4ab2974e7 (patch)
tree20755a1dad1f7dffe0836453930ba3d1a70992b1 /Makefile
parent6e8d335b458ac2416bc5d09bab40e503384d102d (diff)
add toplevel Makefile that works for Mac and Unix
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile83
1 files changed, 82 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index cb6d017cf1..f298df87c4 100644
--- a/Makefile
+++ b/Makefile
@@ -1 +1,82 @@
-$(error Skia now uses the "Gyp" build system. Please see http://code.google.com/p/skia/wiki/DocRoot )
+# Makefile that wraps the Gyp and build steps for Unix and Mac (but not Windows)
+# Uses "make" to build on Unix, and "xcodebuild" to build on Mac.
+#
+# Some usage examples (tested on both Linux and Mac):
+#
+# # Clean everything
+# make clean
+#
+# # Build and run tests (in Debug mode)
+# make tests
+# out/Debug/tests
+#
+# # Build and run tests (in Release mode)
+# make tests BUILDTYPE=Release
+# out/Release/tests
+#
+# # 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 http://code.google.com/p/skia/wiki/DocRoot for complete documentation.
+
+BUILDTYPE ?= Debug
+CWD := $(shell pwd)
+
+uname := $(shell uname)
+ifneq (,$(findstring CYGWIN, $(uname)))
+ $(error Cannot build using Make on Windows. See http://code.google.com/p/skia/wiki/GettingStartedOnWindows)
+endif
+
+# Default target. This must be listed before all other targets.
+.PHONY: default
+default: all
+
+.PHONY: all
+all: SampleApp bench gm tests
+
+.PHONY: clean
+clean:
+ rm -rf out xcodebuild
+
+# Any targets not defined above...
+# Ask gyp to generate the buildfiles as appropriate for this platform,
+# and then pass control to those buildfiles.
+#
+# For the Mac, we create a convenience symlink to the generated binary.
+%:
+ ./gyp_skia
+ifneq (,$(findstring Linux, $(uname)))
+ make -C out $@ BUILDTYPE=$(BUILDTYPE)
+endif
+ifneq (,$(findstring Darwin, $(uname)))
+ xcodebuild -project out/gyp/$@.xcodeproj -configuration $(BUILDTYPE)
+ mkdir -p out/$(BUILDTYPE)
+ rm -f out/$(BUILDTYPE)/$@
+ ln -s $(CWD)/xcodebuild/$(BUILDTYPE)/$@.app/Contents/MacOS/$@ out/$(BUILDTYPE)/$@
+endif
+
+# This repetition is ugly, but necessary.
+# If there are any files/directories within the same directory as this Makefile
+# which share the same name as a target ("tests", for example), then make
+# will refuse to rebuild those targets because the file already exists.
+local_filenames := $(shell ls)
+.PHONY: $(local_filenames)
+$(local_filenames)::
+ ./gyp_skia
+ifneq (,$(findstring Linux, $(uname)))
+ make -C out $@ BUILDTYPE=$(BUILDTYPE)
+endif
+ifneq (,$(findstring Darwin, $(uname)))
+ xcodebuild -project out/gyp/$@.xcodeproj -configuration $(BUILDTYPE)
+ mkdir -p out/$(BUILDTYPE)
+ rm -f out/$(BUILDTYPE)/$@
+ ln -s $(CWD)/xcodebuild/$(BUILDTYPE)/$@.app/Contents/MacOS/$@ out/$(BUILDTYPE)/$@
+endif