Chromium Code Reviews| 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 |
| 84 # | 91 # |
| 85 # The default target | 92 # The default target |
| 86 # | 93 # |
| 87 # If no targets are specified on the command-line, the first target listed in | 94 # If no targets are specified on the command-line, the first target listed in |
| 88 # the makefile becomes the default target. By convention this is usually called | 95 # the makefile becomes the default target. By convention this is usually called |
| 89 # the 'all' target. Here we leave it blank to be first, but define it later | 96 # the 'all' target. Here we leave it blank to be first, but define it later |
| 90 # | 97 # |
| 91 all: | 98 all: |
| 92 | 99 |
| 93 | 100 |
| 94 # | 101 # |
| 95 # Target a toolchain | 102 # Target a toolchain |
| 96 # | 103 # |
| 97 # $1 = Toolchain Name | 104 # $1 = Toolchain Name |
| 98 # | 105 # |
| 106 RECURSIVE_TARGET?=all | |
|
noelallen1
2013/02/11 23:02:44
Separate change pls.
Sam Clegg
2013/02/11 23:07:14
Done.
| |
| 99 define TOOLCHAIN_RULE | 107 define TOOLCHAIN_RULE |
| 100 .PHONY: all_$(1) | 108 .PHONY: all_$(1) |
| 101 all_$(1): | 109 all_$(1): |
| 102 » +$(MAKE) TOOLCHAIN=$(1) | 110 » +$(MAKE) TOOLCHAIN=$(1) $(RECURSIVE_TARGET) |
| 103 TOOLCHAIN_LIST+=all_$(1) | 111 TOOLCHAIN_LIST+=all_$(1) |
| 104 endef | 112 endef |
| 105 | 113 |
| 106 | 114 |
| 107 # | 115 # |
| 108 # The target for all versions | 116 # The target for all versions |
| 109 # | 117 # |
| 110 USABLE_TOOLCHAINS=$(filter $(OSNAME) newlib glibc pnacl,$(VALID_TOOLCHAINS)) | 118 USABLE_TOOLCHAINS=$(filter $(OSNAME) newlib glibc pnacl,$(VALID_TOOLCHAINS)) |
| 111 | 119 |
| 112 ifeq (1,$(NO_HOST_BUILDS)) | 120 ifeq (1,$(NO_HOST_BUILDS)) |
| 113 USABLE_TOOLCHAINS:=$(filter-out $(OSNAME),$(USABLE_TOOLCHAINS)) | 121 USABLE_TOOLCHAINS:=$(filter-out $(OSNAME),$(USABLE_TOOLCHAINS)) |
| 114 endif | 122 endif |
| 115 | 123 |
| 116 $(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool),$(dep)) )) | 124 $(foreach tool,$(USABLE_TOOLCHAINS),$(eval $(call TOOLCHAIN_RULE,$(tool),$(dep)) )) |
| 117 | 125 |
| 118 .PHONY: all_versions | 126 .PHONY: all_versions |
| 119 all_versions: $(TOOLCHAIN_LIST) | 127 all_versions: $(TOOLCHAIN_LIST) |
| 120 | 128 |
| 121 # | 129 # |
| 122 # Target to remove temporary files | 130 # Target to remove temporary files |
| 123 # | 131 # |
| 124 .PHONY: clean | 132 .PHONY: clean |
| 125 clean: | 133 clean: |
| 126 » $(RM) $(TARGET).nmf | 134 » $(RM) -f $(TARGET).nmf |
| 127 $(RM) -fr $(TOOLCHAIN) | 135 $(RM) -fr $(TOOLCHAIN) |
| 128 | 136 |
| 129 | 137 |
| 130 # | 138 # |
| 131 # Rules for output directories. | 139 # Rules for output directories. |
| 132 # | 140 # |
| 133 # Output will be places in a directory name based on Toolchain and configuration | 141 # 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 | 142 # 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 | 143 # proivde a cross platform solution. The use of '|' checks for existance instead |
| 136 # of timestamp, since the directory can update when files change. | 144 # of timestamp, since the directory can update when files change. |
| 137 # | 145 # |
| 138 %dir.stamp : | 146 %dir.stamp : |
| 139 $(MKDIR) -p $(dir $@) | 147 $(MKDIR) -p $(dir $@) |
| 140 » echo "Directory Stamp" > $@ | 148 » @echo "Directory Stamp" > $@ |
| 141 | 149 |
| 142 OUTDIR:=$(TOOLCHAIN)/$(CONFIG) | 150 OUTDIR:=$(TOOLCHAIN)/$(CONFIG) |
| 143 STAMPDIR?=$(OUTDIR) | 151 STAMPDIR?=$(OUTDIR) |
| 144 | 152 |
| 145 # | 153 # |
| 146 # Dependency Macro | 154 # Dependency Macro |
| 147 # | 155 # |
| 148 # $1 = Name of stamp | 156 # $1 = Name of stamp |
| 149 # $2 = Directory for the sub-make | 157 # $2 = Directory for the sub-make |
| 150 # $3 = Extra Settings | 158 # $3 = Extra Settings |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 # Common Compile Options | 192 # Common Compile Options |
| 185 # | 193 # |
| 186 ifeq ('Release','$(CONFIG)') | 194 ifeq ('Release','$(CONFIG)') |
| 187 POSIX_FLAGS?=-g -O2 -pthread -MMD | 195 POSIX_FLAGS?=-g -O2 -pthread -MMD |
| 188 else | 196 else |
| 189 POSIX_FLAGS?=-g -O0 -pthread -MMD | 197 POSIX_FLAGS?=-g -O0 -pthread -MMD |
| 190 endif | 198 endif |
| 191 | 199 |
| 192 NACL_CFLAGS?=-Wno-long-long -Werror | 200 NACL_CFLAGS?=-Wno-long-long -Werror |
| 193 NACL_CXXFLAGS?=-Wno-long-long -Werror | 201 NACL_CXXFLAGS?=-Wno-long-long -Werror |
| 202 NACL_LDFLAGS?=-Wl,-as-needed | |
| 194 | 203 |
| 195 # | 204 # |
| 196 # Default Paths | 205 # Default Paths |
| 197 # | 206 # |
| 198 ifeq (,$(findstring $(TOOLCHAIN),linux mac win)) | 207 ifeq (,$(findstring $(TOOLCHAIN),linux mac win)) |
| 199 INC_PATHS?=$(NACL_SDK_ROOT)/include $(EXTRA_INC_PATHS) | 208 INC_PATHS?=$(NACL_SDK_ROOT)/include $(EXTRA_INC_PATHS) |
| 200 else | 209 else |
| 201 INC_PATHS?=$(NACL_SDK_ROOT)/include/$(OSNAME) $(NACL_SDK_ROOT)/include $(EXTRA_I NC_PATHS) | 210 INC_PATHS?=$(NACL_SDK_ROOT)/include/$(OSNAME) $(NACL_SDK_ROOT)/include $(EXTRA_I NC_PATHS) |
| 202 endif | 211 endif |
| 203 | 212 |
| 204 LIB_PATHS?=$(NACL_SDK_ROOT)/lib $(EXTRA_LIB_PATHS) | 213 LIB_PATHS?=$(NACL_SDK_ROOT)/lib $(EXTRA_LIB_PATHS) |
| 205 | 214 |
| 215 # | |
| 216 # Define a LOG macro that allow a command to be run in quiet mode where | |
| 217 # the command echoed is not the same as the actual command executed. | |
| 218 # The primary use case for this is to avoid echoing the full compiler | |
| 219 # and linker command in the default case. Defining V=1 will restore | |
| 220 # the verbose behavior | |
| 221 # | |
| 222 # $1 = The name of the tool being run | |
| 223 # $2 = The target file being built | |
| 224 # $3 = The full command to run | |
| 225 # | |
| 226 ifdef V | |
| 227 define LOG | |
| 228 $(3) | |
| 229 endef | |
| 230 else | |
| 231 define LOG | |
| 232 @echo " $(1) $(2)" && $(3) | |
| 233 endef | |
| 234 endif | |
| 235 | |
| 206 | 236 |
| 207 # | 237 # |
| 208 # If the requested toolchain is a NaCl or PNaCl toolchain, the use the | 238 # 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 | 239 # macros and targets defined in nacl.mk, otherwise use the host sepecific |
| 210 # macros and targets. | 240 # macros and targets. |
| 211 # | 241 # |
| 212 ifneq (,$(findstring $(TOOLCHAIN),linux mac)) | 242 ifneq (,$(findstring $(TOOLCHAIN),linux mac)) |
| 213 include $(NACL_SDK_ROOT)/tools/host_gcc.mk | 243 include $(NACL_SDK_ROOT)/tools/host_gcc.mk |
| 214 endif | 244 endif |
| 215 | 245 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 | 304 |
| 275 SYSARCH=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --chrome) | 305 SYSARCH=$(shell python $(NACL_SDK_ROOT)/tools/getos.py --chrome) |
| 276 GDB_ARGS+=-D $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/$(SYSARCH)-nacl-gdb | 306 GDB_ARGS+=-D $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/$(SYSARCH)-nacl-gdb |
| 277 GDB_ARGS+=-D $(CURDIR)/$(OUTDIR)/$(TARGET)_$(SYSARCH).nexe | 307 GDB_ARGS+=-D $(CURDIR)/$(OUTDIR)/$(TARGET)_$(SYSARCH).nexe |
| 278 | 308 |
| 279 DEBUG: CHECK_FOR_CHROME all | 309 DEBUG: CHECK_FOR_CHROME all |
| 280 $(RUN_PY) $(GDB_ARGS) \ | 310 $(RUN_PY) $(GDB_ARGS) \ |
| 281 -C $(CURDIR) -P $(PAGE) $(addprefix -E ,$(CHROME_ENV)) -- \ | 311 -C $(CURDIR) -P $(PAGE) $(addprefix -E ,$(CHROME_ENV)) -- \ |
| 282 $(CHROME_PATH) $(CHROME_ARGS) --enable-nacl-debug \ | 312 $(CHROME_PATH) $(CHROME_ARGS) --enable-nacl-debug \ |
| 283 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" | 313 --register-pepper-plugins="$(PPAPI_DEBUG),$(PPAPI_RELEASE)" |
| OLD | NEW |