OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium 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 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 # | 58 # |
59 # Disable DOS PATH warning when using Cygwin based NaCl tools on Windows. | 59 # Disable DOS PATH warning when using Cygwin based NaCl tools on Windows. |
60 # | 60 # |
61 CYGWIN?=nodosfilewarning | 61 CYGWIN?=nodosfilewarning |
62 export CYGWIN | 62 export CYGWIN |
63 | 63 |
64 | 64 |
65 # | 65 # |
66 # Alias for standard POSIX file system commands | 66 # Alias for standard POSIX file system commands |
67 # | 67 # |
68 CP:=python $(NACL_SDK_ROOT)/tools/oshelpers.py cp | 68 OSHELPERS=python $(NACL_SDK_ROOT)/tools/oshelpers.py |
69 MKDIR:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mkdir | 69 WHICH:=$(OSHELPERS) which |
70 MV:=python $(NACL_SDK_ROOT)/tools/oshelpers.py mv | 70 ifdef V |
71 RM:=python $(NACL_SDK_ROOT)/tools/oshelpers.py rm | 71 RM:=$(OSHELPERS) rm |
72 WHICH:=python $(NACL_SDK_ROOT)/tools/oshelpers.py which | 72 CP:=$(OSHELPERS) cp |
73 | 73 MKDIR:=$(OSHELPERS) mkdir |
| 74 MV:=$(OSHELPERS) mv |
| 75 else |
| 76 RM:=@$(OSHELPERS) rm |
| 77 CP:=@$(OSHELPERS) cp |
| 78 MKDIR:=@$(OSHELPERS) mkdir |
| 79 MV:=@$(OSHELPERS) mv |
| 80 endif |
74 | 81 |
75 # | 82 # |
76 # Compute path to requested NaCl Toolchain | 83 # Compute path to requested NaCl Toolchain |
77 # | 84 # |
78 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) | 85 OSNAME:=$(shell python $(NACL_SDK_ROOT)/tools/getos.py) |
79 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain) | 86 TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain) |
80 | 87 |
81 | 88 |
82 | 89 |
83 | 90 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 $(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool),$(dep))
)) | 123 $(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool),$(dep))
)) |
117 | 124 |
118 .PHONY: all_versions | 125 .PHONY: all_versions |
119 all_versions: $(TOOLCHAIN_LIST) | 126 all_versions: $(TOOLCHAIN_LIST) |
120 | 127 |
121 # | 128 # |
122 # Target to remove temporary files | 129 # Target to remove temporary files |
123 # | 130 # |
124 .PHONY: clean | 131 .PHONY: clean |
125 clean: | 132 clean: |
126 » $(RM) $(TARGET).nmf | 133 » $(RM) -f $(TARGET).nmf |
127 $(RM) -fr $(TOOLCHAIN) | 134 $(RM) -fr $(TOOLCHAIN) |
128 | 135 |
129 | 136 |
130 # | 137 # |
131 # Rules for output directories. | 138 # Rules for output directories. |
132 # | 139 # |
133 # Output will be places in a directory name based on Toolchain and configuration | 140 # Output will be places in a directory name based on Toolchain and configuration |
134 # be default this will be "newlib/Debug". We use a python wrapped MKDIR to | 141 # be default this will be "newlib/Debug". We use a python wrapped MKDIR to |
135 # proivde a cross platform solution. The use of '|' checks for existance instead | 142 # proivde a cross platform solution. The use of '|' checks for existance instead |
136 # of timestamp, since the directory can update when files change. | 143 # of timestamp, since the directory can update when files change. |
137 # | 144 # |
138 %dir.stamp : | 145 %dir.stamp : |
139 $(MKDIR) -p $(dir $@) | 146 $(MKDIR) -p $(dir $@) |
140 » echo "Directory Stamp" > $@ | 147 » @echo "Directory Stamp" > $@ |
141 | 148 |
142 OUTDIR:=$(TOOLCHAIN)/$(CONFIG) | 149 OUTDIR:=$(TOOLCHAIN)/$(CONFIG) |
143 STAMPDIR?=$(OUTDIR) | 150 STAMPDIR?=$(OUTDIR) |
144 | 151 |
145 # | 152 # |
146 # Dependency Macro | 153 # Dependency Macro |
147 # | 154 # |
148 # $1 = Name of stamp | 155 # $1 = Name of stamp |
149 # $2 = Directory for the sub-make | 156 # $2 = Directory for the sub-make |
150 # $3 = Extra Settings | 157 # $3 = Extra Settings |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 # Common Compile Options | 191 # Common Compile Options |
185 # | 192 # |
186 ifeq ('Release','$(CONFIG)') | 193 ifeq ('Release','$(CONFIG)') |
187 POSIX_FLAGS?=-g -O2 -pthread -MMD | 194 POSIX_FLAGS?=-g -O2 -pthread -MMD |
188 else | 195 else |
189 POSIX_FLAGS?=-g -O0 -pthread -MMD | 196 POSIX_FLAGS?=-g -O0 -pthread -MMD |
190 endif | 197 endif |
191 | 198 |
192 NACL_CFLAGS?=-Wno-long-long -Werror | 199 NACL_CFLAGS?=-Wno-long-long -Werror |
193 NACL_CXXFLAGS?=-Wno-long-long -Werror | 200 NACL_CXXFLAGS?=-Wno-long-long -Werror |
| 201 NACL_LDFLAGS?=-Wl,-as-needed |
194 | 202 |
195 # | 203 # |
196 # Default Paths | 204 # Default Paths |
197 # | 205 # |
198 ifeq (,$(findstring $(TOOLCHAIN),linux mac win)) | 206 ifeq (,$(findstring $(TOOLCHAIN),linux mac win)) |
199 INC_PATHS?=$(NACL_SDK_ROOT)/include $(EXTRA_INC_PATHS) | 207 INC_PATHS?=$(NACL_SDK_ROOT)/include $(EXTRA_INC_PATHS) |
200 else | 208 else |
201 INC_PATHS?=$(NACL_SDK_ROOT)/include/$(OSNAME) $(NACL_SDK_ROOT)/include $(EXTRA_I
NC_PATHS) | 209 INC_PATHS?=$(NACL_SDK_ROOT)/include/$(OSNAME) $(NACL_SDK_ROOT)/include $(EXTRA_I
NC_PATHS) |
202 endif | 210 endif |
203 | 211 |
204 LIB_PATHS?=$(NACL_SDK_ROOT)/lib $(EXTRA_LIB_PATHS) | 212 LIB_PATHS?=$(NACL_SDK_ROOT)/lib $(EXTRA_LIB_PATHS) |
205 | 213 |
| 214 # |
| 215 # Define a LOG macro that allow a command to be run in quiet mode where |
| 216 # the command echoed is not the same as the actual command executed. |
| 217 # The primary use case for this is to avoid echoing the full compiler |
| 218 # and linker command in the default case. Defining V=1 will restore |
| 219 # the verbose behavior |
| 220 # |
| 221 # $1 = The name of the tool being run |
| 222 # $2 = The target file being built |
| 223 # $3 = The full command to run |
| 224 # |
| 225 ifdef V |
| 226 define LOG |
| 227 $(3) |
| 228 endef |
| 229 else |
| 230 define LOG |
| 231 @echo " $(1) $(2)" && $(3) |
| 232 endef |
| 233 endif |
| 234 |
206 | 235 |
207 # | 236 # |
208 # If the requested toolchain is a NaCl or PNaCl toolchain, the use the | 237 # If the requested toolchain is a NaCl or PNaCl toolchain, the use the |
209 # macros and targets defined in nacl.mk, otherwise use the host sepecific | 238 # macros and targets defined in nacl.mk, otherwise use the host sepecific |
210 # macros and targets. | 239 # macros and targets. |
211 # | 240 # |
212 ifneq (,$(findstring $(TOOLCHAIN),linux mac)) | 241 ifneq (,$(findstring $(TOOLCHAIN),linux mac)) |
213 include $(NACL_SDK_ROOT)/tools/host_gcc.mk | 242 include $(NACL_SDK_ROOT)/tools/host_gcc.mk |
214 endif | 243 endif |
215 | 244 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 303 |
275 SYSARCH=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --chrome) | 304 SYSARCH=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --chrome) |
276 GDB_ARGS+=-D $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/$(SYSARCH)-nacl-gdb | 305 GDB_ARGS+=-D $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/$(SYSARCH)-nacl-gdb |
277 GDB_ARGS+=-D $(CURDIR)/$(OUTDIR)/$(TARGET)_$(SYSARCH).nexe | 306 GDB_ARGS+=-D $(CURDIR)/$(OUTDIR)/$(TARGET)_$(SYSARCH).nexe |
278 | 307 |
279 DEBUG: CHECK_FOR_CHROME all | 308 DEBUG: CHECK_FOR_CHROME all |
280 $(RUN_PY) $(GDB_ARGS) \ | 309 $(RUN_PY) $(GDB_ARGS) \ |
281 -C $(CURDIR) -P $(PAGE) $(addprefix -E ,$(CHROME_ENV)) -- \ | 310 -C $(CURDIR) -P $(PAGE) $(addprefix -E ,$(CHROME_ENV)) -- \ |
282 $(CHROME_PATH) $(CHROME_ARGS) --enable-nacl-debug \ | 311 $(CHROME_PATH) $(CHROME_ARGS) --enable-nacl-debug \ |
283 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" | 312 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" |
OLD | NEW |