Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: native_client_sdk/src/getting_started/part1/Makefile

Issue 23661005: [NaCl SDK] Add a very simple getting_started example at top-level. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
eliben 2013/09/09 16:48:31 2013? [and soon even that will be out of date, oh
binji 2013/09/09 18:43:46 Done.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 #
6 # GNU Make based build file.  For details on GNU Make see:
7 # http://www.gnu.org/software/make/manual/make.html
8 #
9
10 #
11 # Get pepper directory for toolchain and includes.
12 #
13 # If NACL_SDK_ROOT is not set, then assume it can be found three directories up.
14 #
15 THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
16 NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
17
18 # Project Build flags
19 WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -pedantic -Werror
20 CXXFLAGS:=-pthread -std=gnu++98 $(WARNINGS)
21
22 #
23 # Compute tool paths
24 #
eliben 2013/09/09 16:48:31 extra line
binji 2013/09/09 18:43:46 Done.
25 #
26 GETOS :=python $(NACL_SDK_ROOT)/tools/getos.py
eliben 2013/09/09 16:48:31 inconsistent whitespace (space or not after :=)
binji 2013/09/09 18:43:46 Done.
27 OSHELPERS = python $(NACL_SDK_ROOT)/tools/oshelpers.py
28 OSNAME :=$(shell $(GETOS))
29 RM := $(OSHELPERS) rm
30
31 PNACL_TC_PATH :=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl)
32 PNACL_CXX := $(PNACL_TC_PATH)/newlib/bin/pnacl-clang++
33 PNACL_FINALIZE := $(PNACL_TC_PATH)/newlib/bin/pnacl-finalize
34 CXXFLAGS := -I$(NACL_SDK_ROOT)/include
35 LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi
36
37 #
38 # Disable DOS PATH warning when using Cygwin based tools Windows
39 #
40 CYGWIN ?= nodosfilewarning
41 export CYGWIN
42
43
44 # Declare the ALL target first, to make the 'all' target the default build
45 all: hello_tutorial.pexe
46
47 clean:
48 $(RM) hello_tutorial.pexe hello_tutorial.bc
49
50 hello_tutorial.bc: hello_tutorial.cc
51 $(PNACL_CXX) -o $@ $< -O2 $(CXXFLAGS) $(LDFLAGS)
52
53 hello_tutorial.pexe: hello_tutorial.bc
54 $(PNACL_FINALIZE) -o $@ $<
55
56
57 #
58 # File to redirect to to in order to hide output.
59 #
60 ifeq ($(OSNAME),win)
61 DEV_NULL = nul
62 else
63 DEV_NULL = /dev/null
64 endif
65
66 #
67 # Assign a sensible default to CHROME_PATH.
68 #
69 CHROME_PATH ?= $(shell $(GETOS) --chrome 2> $(DEV_NULL))
70
71 #
72 # Verify we can find the Chrome executable if we need to launch it.
73 #
74 .PHONY: check_for_chrome
75 check_for_chrome:
76 ifeq (,$(wildcard $(CHROME_PATH)))
77 $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH))
78 $(error Set CHROME_PATH via an environment variable, or command-line.)
79 else
80 $(warning Using chrome at: $(CHROME_PATH))
81 endif
82
83 #
84 # Variables for running examples with Chrome.
85 #
86 RUN_PY := python $(NACL_SDK_ROOT)/tools/run.py
87
88 # Additional arguments to pass to Chrome.
89 CHROME_ARGS += --enable-pnacl --no-first-run
90 CHROME_ARGS += --user-data-dir=$(CURDIR)/user-data-dir
91
92 # Define a phony rule so it always runs, to run the pexe.
93 .PHONY: run
94 run: check_for_chrome all
95 $(RUN_PY) -C $(CURDIR) -P index.html -- $(CHROME_PATH) $(CHROME_ARGS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698