# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # GNU Make based build file. For details on GNU Make see: # http://www.gnu.org/software/make/manual/make.html # # # Get pepper directory for toolchain and includes. # # If NACL_SDK_ROOT is not set, then assume it can be found a two directories up, # from the default example directory location. # THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST))) THIS_DIR:=$(abspath $(dir $(THIS_MAKEFILE))) NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) CHROME_PATH?=Undefined # # Defaults # NACL_WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -Werror -pedantic # # Project Settings # __PROJECT_SETTINGS__ # # Default target # __PROJECT_TARGETS__ # # Alias for standard commands # CP:=python $(NACL_SDK_ROOT)/tools/oshelpers.py cp MKDIR:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mkdir MV:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mv RM:=python $(NACL_SDK_ROOT)/tools/oshelpers.py rm # # Verify we selected a valid toolchain for this example # ifeq (,$(findstring $(TOOLCHAIN),$(VALID_TOOLCHAINS))) $(warning Availbile choices are: $(VALID_TOOLCHAINS)) $(error Can not use TOOLCHAIN=$(TOOLCHAIN) on this example.) endif # # Compute path to requested NaCl Toolchain # OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain) # # Verify we have a valid NACL_SDK_ROOT by looking for the toolchain directory # ifeq (,$(wildcard $(TC_PATH))) $(warning No valid NACL_SDK_ROOT at $(NACL_SDK_ROOT)) ifeq ($(origin NACL_SDK_ROOT), 'file') $(error Override the default value via enviornment variable, or command-line.) else $(error Fix the NACL_SDK_ROOT specified in the environment or command-line.) endif endif # # Disable DOS PATH warning when using Cygwin based NaCl tools on Windows # CYGWIN ?= nodosfilewarning export CYGWIN # # Defaults for TOOLS # __PROJECT_TOOLS__ # # NMF Manifiest generation # # Use the python script create_nmf to scan the binaries for dependencies using # objdump. Pass in the (-L) paths to the default library toolchains so that we # can find those libraries and have it automatically copy the files (-s) to # the target directory for us. NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py # # Verify we can find the Chrome executable if we need to launch it. # .PHONY: CHECK_FOR_CHROME RUN LAUNCH CHECK_FOR_CHROME: ifeq (,$(wildcard $(CHROME_PATH))) $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH)) $(error Set CHROME_PATH via an environment variable, or command-line.) else $(warning Using chrome at: $(CHROME_PATH)) endif __PROJECT_RULES__ __PROJECT_PRERUN__ # # Variables for running examples with Chrome. # RUN_PY:=python $(NACL_SDK_ROOT)/tools/run.py # Add this to launch Chrome with additional environment variables defined. # Each element should be specified as KEY=VALUE, with whitespace separating # key-value pairs. e.g. # CHROME_ENV=FOO=1 BAR=2 BAZ=3 CHROME_ENV?= # Additional arguments to pass to Chrome. CHROME_ARGS+=--enable-nacl --incognito CONFIG?=Debug PAGE?=index_$(TOOLCHAIN)_$(CONFIG).html RUN: LAUNCH LAUNCH: CHECK_FOR_CHROME all ifeq (,$(wildcard $(PAGE))) $(warning No valid HTML page found at $(PAGE)) $(error Make sure TOOLCHAIN and CONFIG are properly set) endif $(RUN_PY) -C $(THIS_DIR) -P $(PAGE) $(addprefix -E ,$(CHROME_ENV)) -- \ $(CHROME_PATH) $(CHROME_ARGS) \ --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" __PROJECT_POSTLAUNCH__