OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2013 The Native Client Authors. All rights reserved. | |
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 # | |
25 GETOS :=python $(NACL_SDK_ROOT)/tools/getos.py | |
eliben
2013/09/09 19:10:53
This is still inconsistent indentation
binji
2013/09/09 20:59:04
Done.
| |
26 OSHELPERS = python $(NACL_SDK_ROOT)/tools/oshelpers.py | |
27 OSNAME := $(shell $(GETOS)) | |
28 RM := $(OSHELPERS) rm | |
29 | |
30 PNACL_TC_PATH := $(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_pnacl) | |
31 PNACL_CXX := $(PNACL_TC_PATH)/newlib/bin/pnacl-clang++ | |
32 PNACL_FINALIZE := $(PNACL_TC_PATH)/newlib/bin/pnacl-finalize | |
33 CXXFLAGS := -I$(NACL_SDK_ROOT)/include | |
34 LDFLAGS := -L$(NACL_SDK_ROOT)/lib/pnacl/Release -lppapi_cpp -lppapi | |
35 | |
36 # | |
37 # Disable DOS PATH warning when using Cygwin based tools Windows | |
38 # | |
39 CYGWIN ?= nodosfilewarning | |
40 export CYGWIN | |
41 | |
42 | |
43 # Declare the ALL target first, to make the 'all' target the default build | |
44 all: hello_tutorial.pexe | |
45 | |
46 clean: | |
47 $(RM) hello_tutorial.pexe hello_tutorial.bc | |
48 | |
49 hello_tutorial.bc: hello_tutorial.cc | |
50 $(PNACL_CXX) -o $@ $< -O2 $(CXXFLAGS) $(LDFLAGS) | |
51 | |
52 hello_tutorial.pexe: hello_tutorial.bc | |
53 $(PNACL_FINALIZE) -o $@ $< | |
54 | |
55 | |
56 # | |
57 # File to redirect to to in order to hide output. | |
58 # | |
59 ifeq ($(OSNAME),win) | |
60 DEV_NULL = nul | |
eliben
2013/09/09 19:10:53
Indentation here? and within else?
binji
2013/09/09 20:59:04
Hm. Seems like we're inconsistent about this in ou
| |
61 else | |
62 DEV_NULL = /dev/null | |
63 endif | |
64 | |
65 # | |
66 # Assign a sensible default to CHROME_PATH. | |
67 # | |
68 CHROME_PATH ?= $(shell $(GETOS) --chrome 2> $(DEV_NULL)) | |
69 | |
70 # | |
71 # Verify we can find the Chrome executable if we need to launch it. | |
72 # | |
73 .PHONY: check_for_chrome | |
74 check_for_chrome: | |
75 ifeq (,$(wildcard $(CHROME_PATH))) | |
76 $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH)) | |
77 $(error Set CHROME_PATH via an environment variable, or command-line.) | |
78 else | |
79 $(warning Using chrome at: $(CHROME_PATH)) | |
80 endif | |
81 | |
82 # | |
83 # Variables for running examples with Chrome. | |
84 # | |
85 RUN_PY := python $(NACL_SDK_ROOT)/tools/run.py | |
86 | |
87 # Additional arguments to pass to Chrome. | |
88 CHROME_ARGS += --enable-pnacl --no-first-run | |
89 CHROME_ARGS += --user-data-dir=$(CURDIR)/user-data-dir | |
90 | |
91 # Define a phony rule so it always runs, to run the pexe. | |
92 .PHONY: run | |
93 run: check_for_chrome all | |
94 $(RUN_PY) -C $(CURDIR) -P index.html -- $(CHROME_PATH) $(CHROME_ARGS) | |
OLD | NEW |