OLD | NEW |
1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # | 5 # |
6 # GNU Make based build file. For details on GNU Make see: | 6 # GNU Make based build file. For details on GNU Make see: |
7 # http://www.gnu.org/software/make/manual/make.html | 7 # http://www.gnu.org/software/make/manual/make.html |
8 # | 8 # |
9 | 9 |
10 # | 10 # |
| 11 # Get pepper directory for toolchain and includes. |
| 12 # |
| 13 # If NACL_SDK_ROOT is not set, then assume it can be found a two directories up, |
| 14 # from the default example directory location. |
| 15 # |
| 16 THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST))) |
| 17 NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) |
| 18 CHROME_PATH?=Undefined |
| 19 |
| 20 # |
11 # Defaults | 21 # Defaults |
12 # | 22 # |
13 NACL_WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -Werror -pedantic | 23 NACL_WARNINGS:=-Wno-long-long -Wall -Wswitch-enum -Werror -pedantic |
14 NACL_CCFLAGS:=-O0 -g -pthread $(NACL_WARNINGS) | 24 NACL_CCFLAGS:=-O0 -g -pthread $(NACL_WARNINGS) |
15 NACL_CXXFLAGS:= -O0 -g -pthread -std=gnu++98 $(NACL_WARNINGS) | 25 NACL_CXXFLAGS:= -O0 -g -pthread -std=gnu++98 $(NACL_WARNINGS) |
16 NACL_LDFLAGS:=-Wl,-as-needed -g -pthread -lppapi_cpp -lppapi | 26 NACL_LDFLAGS:=-Wl,-as-needed -g -pthread -lppapi_cpp -lppapi |
17 | 27 |
18 | |
19 # | 28 # |
20 # Project Settings | 29 # Project Settings |
21 # | 30 # |
22 __PROJECT_SETTINGS__ | 31 __PROJECT_SETTINGS__ |
23 | 32 |
24 # | 33 # |
25 # Project Targets | 34 # Project Targets |
26 # | 35 # |
27 __PROJECT_TARGETS__ | 36 __PROJECT_TARGETS__ |
28 | 37 |
29 | 38 |
30 # | 39 # |
31 # Get pepper directory for toolchain and includes. | |
32 # | |
33 # If NACL_SDK_ROOT is not set, then assume it can be found a two directories up, | |
34 # from the default example directory location. | |
35 # | |
36 THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST))) | |
37 NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..) | |
38 CHROME_PATH?=Undefined | |
39 | |
40 | |
41 # | |
42 # Alias for standard commands | 40 # Alias for standard commands |
43 # | 41 # |
44 CP:=python $(NACL_SDK_ROOT)/tools/oshelpers.py cp | 42 CP:=python $(NACL_SDK_ROOT)/tools/oshelpers.py cp |
45 MKDIR:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mkdir | 43 MKDIR:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mkdir |
46 MV:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mv | 44 MV:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mv |
47 | 45 |
48 | 46 |
49 # | 47 # |
50 # Verify we selected a valid toolchain for this example | 48 # Verify we selected a valid toolchain for this example |
51 # | 49 # |
52 ifeq (,$(findstring $(TOOLCHAIN),$(VALID_TOOLCHAINS))) | 50 ifeq (,$(findstring $(TOOLCHAIN),$(VALID_TOOLCHAINS))) |
53 $(warning Availbile choices are: $(VALID_TOOLCHAINS)) | 51 $(warning Availbile choices are: $(VALID_TOOLCHAINS)) |
54 $(error Can not use TOOLCHAIN=$(TOOLCHAIN) on this example.) | 52 $(error Can not use TOOLCHAIN=$(TOOLCHAIN) on this example.) |
55 endif | 53 endif |
56 | 54 |
57 | 55 |
58 # | 56 # |
59 # Compute path to requested NaCl Toolchain | 57 # Compute path to requested NaCl Toolchain |
60 # | 58 # |
61 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) | 59 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) |
62 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_$(TOOLCHAIN)) | 60 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain) |
63 | |
64 | |
65 # | |
66 # Compute path to requested NaCl Toolchain | |
67 # | |
68 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) | |
69 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_$(TOOLCHAIN)) | |
70 | 61 |
71 | 62 |
72 # | 63 # |
73 # Verify we have a valid NACL_SDK_ROOT by looking for the toolchain directory | 64 # Verify we have a valid NACL_SDK_ROOT by looking for the toolchain directory |
74 # | 65 # |
75 ifeq (,$(wildcard $(TC_PATH))) | 66 ifeq (,$(wildcard $(TC_PATH))) |
76 $(warning No valid NACL_SDK_ROOT at $(NACL_SDK_ROOT)) | 67 $(warning No valid NACL_SDK_ROOT at $(NACL_SDK_ROOT)) |
77 ifeq ($(origin NACL_SDK_ROOT), 'file') | 68 ifeq ($(origin NACL_SDK_ROOT), 'file') |
78 $(error Override the default value via enviornment variable, or command-line.) | 69 $(error Override the default value via enviornment variable, or command-line.) |
79 else | 70 else |
80 $(error Fix the NACL_SDK_ROOT specified in the environment or command-line.) | 71 $(error Fix the NACL_SDK_ROOT specified in the environment or command-line.) |
81 endif | 72 endif |
82 endif | 73 endif |
83 | 74 |
84 | 75 |
85 # | 76 # |
86 # Disable DOS PATH warning when using Cygwin based NaCl tools on Windows | 77 # Disable DOS PATH warning when using Cygwin based NaCl tools on Windows |
87 # | 78 # |
88 CYGWIN ?= nodosfilewarning | 79 CYGWIN ?= nodosfilewarning |
89 export CYGWIN | 80 export CYGWIN |
90 | 81 |
91 | 82 |
92 # | 83 # |
93 # NaCl Tools | 84 # NaCl Tools |
94 # | 85 # |
95 NACL_CC?=$(TC_PATH)/bin/i686-nacl-gcc -c | 86 NEWLIB_CC?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-gcc -c |
96 NACL_CXX?=$(TC_PATH)/bin/i686-nacl-g++ -c | 87 NEWLIB_CXX?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-g++ -c |
97 NACL_LINK?=$(TC_PATH)/bin/i686-nacl-g++ | 88 NEWLIB_LINK?=$(TC_PATH)/$(OSNAME)_x86_newlib/bin/i686-nacl-g++ |
| 89 NEWLIB_DUMP?=$(TC_PATH)/$(OSNAME)_x86_newlib/x86_64-nacl/bin/objdump |
| 90 NEWLIB_PATHS:= |
| 91 |
| 92 GLIBC_CC?=$(TC_PATH)/$(OSNAME)_x86_glibc/bin/i686-nacl-gcc -c |
| 93 GLIBC_CXX?=$(TC_PATH)/$(OSNAME)_x86_glibc/bin/i686-nacl-g++ -c |
| 94 GLIBC_LINK?=$(TC_PATH)/$(OSNAME)_x86_glibc/bin/i686-nacl-g++ |
| 95 GLIBC_DUMP?=$(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/bin/objdump |
| 96 GLIBC_PATHS:=-L $(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib32 |
| 97 GLIBC_PATHS+=-L $(TC_PATH)/$(OSNAME)_x86_glibc/x86_64-nacl/lib |
| 98 |
| 99 # |
| 100 # NMF Manifiest generation |
| 101 # |
| 102 # Use the python script create_nmf to scan the binaries for dependencies using |
| 103 # objdump. Pass in the (-L) paths to the default library toolchains so that we |
| 104 # can find those libraries and have it automatically copy the files (-s) to |
| 105 # the target directory for us. |
| 106 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py |
| 107 NMF_PATHS:=-L $(TC_PATH)/x86_64-nacl/lib32 -L $(TC_PATH)/x86_64-nacl/lib |
98 | 108 |
99 | 109 |
100 # | 110 # |
101 # Verify we can find the Chrome executable if we need to launch it. | 111 # Verify we can find the Chrome executable if we need to launch it. |
102 # | 112 # |
103 .PHONY: CHECK_FOR_CHROME | 113 .PHONY: CHECK_FOR_CHROME |
104 CHECK_FOR_CHROME: | 114 CHECK_FOR_CHROME: |
105 ifeq (,$(wildcard $(CHROME_PATH))) | 115 ifeq (,$(wildcard $(CHROME_PATH))) |
106 $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH)) | 116 $(warning No valid Chrome found at CHROME_PATH=$(CHROME_PATH)) |
107 $(error Set CHROME_PATH via an environment variable, or command-line.) | 117 $(error Set CHROME_PATH via an environment variable, or command-line.) |
108 else | 118 else |
109 $(warning Using chrome at: $(CHROME_PATH)) | 119 $(warning Using chrome at: $(CHROME_PATH)) |
110 endif | 120 endif |
111 | 121 |
112 | 122 |
113 __PROJECT_RULES__ | 123 __PROJECT_RULES__ |
114 # | |
115 # NMF Manifiest generation | |
116 # | |
117 # Use the python script create_nmf to scan the binaries for dependencies using | |
118 # objdump. Pass in the (-L) paths to the default library toolchains so that we | |
119 # can find those libraries and have it automatically copy the files (-s) to | |
120 # the target directory for us. | |
121 NMF:=python $(NACL_SDK_ROOT)/tools/create_nmf.py | |
122 NMF_ARGS:=-D $(TC_PATH)/x86_64-nacl/bin/objdump -s . | |
123 NMF_PATHS:=-L $(TC_PATH)/x86_64-nacl/lib32 -L $(TC_PATH)/x86_64-nacl/lib | |
124 | |
125 __PROJECT_NMFS__ | |
126 | |
127 __PROJECT_PRERUN__ | 124 __PROJECT_PRERUN__ |
128 | 125 |
129 RUN: all | 126 RUN: all |
130 python ../httpd.py | 127 python ../httpd.py |
131 | 128 |
132 __PROJECT_PRELAUNCH__ | 129 LAUNCH_NEXE: CHECK_FOR_CHROME all |
| 130 » $(CHROME_PATH) $(NEXE_ARGS) "localhost:5103/$(PROJECT).html?tool=$(TOOLC
HAIN)" |
133 | 131 |
134 LAUNCH_NEXE: CHECK_FOR_CHROME all | 132 __PROJECT_POSTLAUNCH__ |
135 » $(CHROME_PATH) $(NEXE_ARGS) "localhost:5103/$(PROJECT).html" | |
136 | |
137 | |
OLD | NEW |