# Copyright (c) 2012 The Native Client 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 # # # Project Settings # __PROJECT_SETTINGS__ # # Project Targets # __PROJECT_TARGETS__ # # 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))) NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) CHROME_PATH?=Undefined # # 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 # # 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/$(OSNAME)_x86_$(TOOLCHAIN)) # # Compute path to requested NaCl Toolchain # OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_$(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 # # NaCl Tools # NACL_CC?=$(TC_PATH)/bin/i686-nacl-gcc -c NACL_CXX?=$(TC_PATH)/bin/i686-nacl-g++ -c NACL_LINK?=$(TC_PATH)/bin/i686-nacl-g++ # # NaCl Flags # WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -Werror -pedantic NACL_CCFLAGS:= -O0 -g -pthread $(WARNINGS) NACL_CXXFLAGS:= -O0 -g -pthread -std=gnu++98 $(WARNINGS) NACL_LDFLAGS:=-g -pthread -lppapi # # Verify we can find the Chrome executable if we need to launch it. # .PHONY: CHECK_FOR_CHROME 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__ RUN: all python ../httpd.py LAUNCH_NEXE: CHECK_FOR_CHROME all $(CHROME_PATH) $(NEXE_ARGS) "localhost:5103/$(PROJECT).html"