From 5d2e4cc165ede8cc5e08bf493839c0c4ab2974e7 Mon Sep 17 00:00:00 2001 From: "epoger@google.com" Date: Wed, 22 Jun 2011 19:17:28 +0000 Subject: add toplevel Makefile that works for Mac and Unix http://codereview.appspot.com/4633063 git-svn-id: http://skia.googlecode.com/svn/trunk@1675 2bbb7eff-a529-9590-31e7-b0007b416f81 --- Makefile | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3